--- uae/src/od-win32/parser.c 2018/04/24 17:03:02 1.1.1.3 +++ uae/src/od-win32/parser.c 2018/04/24 17:19:21 1.1.1.5 @@ -7,7 +7,6 @@ * Copyright 1998-1999 Brian King - added MIDI output support */ -#include "config.h" #include "sysconfig.h" #include #include @@ -50,16 +49,16 @@ void flushprtbuf (void) if( WritePrinter( hPrt, prtbuf, prtbufbytes, &written ) ) { if( written != prtbufbytes ) - write_log( "PRINTER: Only wrote %d of %d bytes!\n", written, prtbufbytes ); + write_log ( "PRINTER: Only wrote %d of %d bytes!\n", written, prtbufbytes ); } else { - write_log( "PRINTER: Couldn't write data!\n" ); + write_log ( "PRINTER: Couldn't write data!\n" ); } } else { - write_log( "PRINTER: Not open!\n" ); + write_log ( "PRINTER: Not open!\n" ); } prtbufbytes = 0; } @@ -115,11 +114,11 @@ FILE *openprinter( void ) } if( hPrt != INVALID_HANDLE_VALUE ) { - write_log( "PRINTER: Opening printer \"%s\" with handle 0x%x.\n", currprefs.prtname, hPrt ); + write_log ( "PRINTER: Opening printer \"%s\" with handle 0x%x.\n", currprefs.prtname, hPrt ); } else if( *currprefs.prtname ) { - write_log( "PRINTER: ERROR - Couldn't open printer \"%s\" for output.\n", currprefs.prtname ); + write_log ( "PRINTER: ERROR - Couldn't open printer \"%s\" for output.\n", currprefs.prtname ); } return result; @@ -133,7 +132,7 @@ void closeprinter( void ) EndDocPrinter( hPrt ); ClosePrinter( hPrt ); hPrt = INVALID_HANDLE_VALUE; - write_log( "PRINTER: Closing printer.\n" ); + write_log ( "PRINTER: Closing printer.\n" ); } KillTimer( hAmigaWnd, prttimer ); prttimer = 0; @@ -223,39 +222,39 @@ void doserout( void ) if (hCom != INVALID_HANDLE_VALUE) { - if (outlast) - { - ResetEvent (ol.hEvent = writeevent); - actual = 0; - - if (!WriteFile (hCom, outbuf, outlast, &actual, &ol)) - { + if (outlast) + { + ResetEvent (ol.hEvent = writeevent); + actual = 0; + + if (!WriteFile (hCom, outbuf, outlast, &actual, &ol)) + { //GetOverlappedResult (hCom, &ol, &actual, FALSE); - /* while (outlast -= actual) - { - if ((dwErrorFlags = GetLastError ()) == ERROR_IO_INCOMPLETE || dwErrorFlags == ERROR_IO_PENDING) - { + /* while (outlast -= actual) + { + if ((dwErrorFlags = GetLastError ()) == ERROR_IO_INCOMPLETE || dwErrorFlags == ERROR_IO_PENDING) + { actual = 0; GetOverlappedResult (hCom, &ol, &actual, FALSE); if ((dwErrorFlags = GetLastError ()) != ERROR_IO_INCOMPLETE && dwErrorFlags != ERROR_IO_PENDING) - { + { write_log ("writeser: error %d, lost %d chars!\n", GetLastError (), outlast - actual); outlast = 0; break; } if (WaitForSingleObject (writeevent, 100) == WAIT_TIMEOUT) - { + { write_log ("writeser: timeout, lost %d chars!\n", outlast - actual); outlast = 0; break; } - } - else - { + } + else + { if (dwErrorFlags) - { + { write_log ("writeser: error %d while writing, lost %d chars!\n", dwErrorFlags, outlast - actual); ClearCommError (hCom, &dwErrorFlags, NULL); } @@ -266,7 +265,7 @@ void doserout( void ) } */ - outlast=0; + outlast=0; } } } @@ -288,7 +287,7 @@ void writeser (char c) if (outlast == 100/*sizeof outbuf*/) { doserout(); - wantwrite=2000; + wantwrite=2000; return; } } @@ -362,7 +361,7 @@ int readser (char *buffer) //if(intreq&&1); //else /*if (WaitForSingleObject (writeevent,0) != WAIT_TIMEOUT) - { + { serdat|=0x2000; intreq|=0x1; INTREQ(0x8000 | (0x01)); @@ -447,21 +446,21 @@ void getserstat (int *status) int setbaud (long baud) { - write_log( "Baud-rate is %d\n", baud ); + write_log ( "Baud-rate is %d\n", baud ); { - if (hCom != INVALID_HANDLE_VALUE) - { - if (GetCommState (hCom, &dcb)) - { - dcb.BaudRate = baud; - if (!SetCommState (hCom, &dcb)) - write_log ("SERIAL: Error setting baud rate %d!\n", baud); - } - else - { - write_log ("SERIAL: setbaud internal error!\n"); - } - } + if (hCom != INVALID_HANDLE_VALUE) + { + if (GetCommState (hCom, &dcb)) + { + dcb.BaudRate = baud; + if (!SetCommState (hCom, &dcb)) + write_log ("SERIAL: Error setting baud rate %d!\n", baud); + } + else + { + write_log ("SERIAL: setbaud internal error!\n"); + } + } } return 0; }