Changeset 3834 for branches/GRACE/src/win32k/misc/vprintf.c
- Timestamp:
- Jul 17, 2000, 12:43:41 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRACE/src/win32k/misc/vprintf.c
r2501 r3834 1 /* $Id: vprintf.c,v 1.7 2000-01-22 18:21:03bird Exp $1 /* $Id: vprintf.c,v 1.7.4.1 2000-07-16 22:43:41 bird Exp $ 2 2 * 3 3 * vprintf and printf … … 25 25 26 26 27 #ifdef RING0 27 28 #if defined(RING0) && !defined(R3TST) 29 #define COMOUTPUT 30 #endif 31 #if !defined(RING0) || defined(R3TST) 32 #define DOSWRITEOUTPUT 33 #endif 34 35 #ifndef DOSWRITEOUTPUT 28 36 #define INCL_NOAPI 29 37 #else … … 41 49 #include "dev32.h" 42 50 #include "vprintf.h" 51 #ifdef COMOUTPUT 52 #include <builtin.h> 53 #endif 43 54 #ifdef RING0 44 #include <builtin.h>45 55 #include "options.h" 46 56 #endif … … 222 232 int vprintf(const char *pszFormat, va_list args) 223 233 { 224 #if def RING0234 #if defined(RING0) && !defined(R3TST) 225 235 if (!options.fLogging) 226 236 return 0; … … 239 249 int vprintf2(const char *pszFormat, va_list args) 240 250 { 241 #ifndef RING0 242 int cch = 0; 243 #endif 251 int cch = 0; 244 252 245 253 while (*pszFormat != '\0') … … 247 255 if (*pszFormat == '%') 248 256 { 249 #ifndef RING0 250 if (cch > 0) 251 { 252 strout((char*)(pszFormat - cch), cch); 253 cch = 0; 254 } 255 #endif 257 if (cch > 0) 258 { 259 strout((char*)(pszFormat - cch), cch); 260 cch = 0; 261 } 256 262 257 263 pszFormat++; /* skip '%' */ … … 396 402 else 397 403 { 398 #ifdef RING0 399 chout(*pszFormat++); 400 #else 401 cch++; 402 pszFormat++; 403 #endif 404 } 405 } 406 407 #ifndef RING0 408 if (cch > 0) 409 { 410 strout((char*)(pszFormat - cch), cch); 411 cch = 0; 412 } 413 #endif 404 cch++; 405 pszFormat++; 406 } 407 } 408 409 if (cch > 0) 410 { 411 strout((char*)(pszFormat - cch), cch); 412 cch = 0; 413 } 414 414 415 415 return 0UL; … … 479 479 static void chout(int ch) 480 480 { 481 #ifndef RING0 482 483 481 #ifdef DOSWRITEOUTPUT 482 ULONG ulWrote; 483 #endif 484 484 485 485 if (ch != '\r') … … 487 487 if (ch == '\n') 488 488 { 489 #ifdef RING0 490 #pragma info(noeff) 491 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 492 _outp(options.usCom, chReturn); /* Put the char. */ 493 #pragma info(restore) 494 #else 495 DosWrite(1, (void*)&chReturn, 1, &ulWrote); 496 #endif 497 } 498 #ifdef RING0 489 #ifdef COMOUTPUT 499 490 #pragma info(noeff) 500 491 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 501 _outp(options.usCom, ch );/* Put the char. */492 _outp(options.usCom, chReturn); /* Put the char. */ 502 493 #pragma info(restore) 503 Yield();504 #else505 DosWrite(1, (void*)&ch, 1, &ulWrote);506 494 #endif 495 #ifdef DOSWRITEOUTPUT 496 DosWrite(1, (void*)&chReturn, 1, SSToDS(&ulWrote)); 497 #endif 498 } 499 #ifdef COMOUTPUT 500 #pragma info(noeff) 501 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 502 _outp(options.usCom, ch); /* Put the char. */ 503 #pragma info(restore) 504 Yield(); 505 #endif 506 #ifdef DOSWRITEOUTPUT 507 DosWrite(1, SSToDS(&ch), 1, SSToDS(&ulWrote)); 508 #endif 507 509 } 508 510 } … … 529 531 530 532 /* write string part */ 531 #ifdef RING0 532 for (ul = 0; ul < cch; ul++) 533 { 534 #pragma info(noeff) 535 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 536 _outp(options.usCom, psz[ul]); /* Put the char. */ 537 #pragma info(restore) 538 } 539 #else 540 DosWrite(1, (void*)psz, cch, &ul); 541 #endif 533 #ifdef COMOUTPUT 534 for (ul = 0; ul < cch; ul++) 535 { 536 #pragma info(noeff) 537 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 538 _outp(options.usCom, psz[ul]); /* Put the char. */ 539 #pragma info(restore) 540 } 541 #endif 542 #ifdef DOSWRITEOUTPUT 543 DosWrite(1, psz, cch, SSToDS(&ul)); 544 #endif 542 545 543 546 /* cr and lf check + skip */ 544 if ( psz[cch] == '\n' || psz[cch] == '\r')547 if (cch < cchMax && (psz[cch] == '\n' || psz[cch] == '\r')) 545 548 { 546 549 if (psz[cch] == '\n') 547 550 { 548 #ifdef RING0551 #ifdef COMOUTPUT 549 552 #pragma info(noeff) 550 553 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ … … 552 555 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 553 556 _outp(options.usCom, chNewLine); /* Put the char. */ 554 cchYield 557 cchYield++; 555 558 #pragma info(restore) 556 #else 557 DosWrite(1, (void*)&chReturn, 1, &ul); 558 DosWrite(1, (void*)&chNewLine, 1, &ul); 559 #endif 560 #ifdef DOSWRITEOUTPUT 561 DosWrite(1, (void*)&chReturn, 1, SSToDS(&ul)); 562 DosWrite(1, (void*)&chNewLine, 1, SSToDS(&ul)); 559 563 #endif 560 564
Note:
See TracChangeset
for help on using the changeset viewer.