Changeset 4164 for trunk/src/win32k/misc/vprintf.c
- Timestamp:
- Sep 2, 2000, 11:08:23 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/misc/vprintf.c
r2501 r4164 1 /* $Id: vprintf.c,v 1. 7 2000-01-22 18:21:03bird Exp $1 /* $Id: vprintf.c,v 1.8 2000-09-02 21:08:15 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 … … 39 47 #include <stdarg.h> 40 48 49 #include "devSegDf.h" /* Win32k segment definitions. */ 41 50 #include "dev32.h" 42 51 #include "vprintf.h" 52 #ifdef COMOUTPUT 53 #include <builtin.h> 54 #endif 43 55 #ifdef RING0 44 #include <builtin.h>45 56 #include "options.h" 46 57 #endif … … 222 233 int vprintf(const char *pszFormat, va_list args) 223 234 { 224 #if def RING0235 #if defined(RING0) && !defined(R3TST) 225 236 if (!options.fLogging) 226 237 return 0; … … 239 250 int vprintf2(const char *pszFormat, va_list args) 240 251 { 241 #ifndef RING0 242 int cch = 0; 243 #endif 252 int cch = 0; 244 253 245 254 while (*pszFormat != '\0') … … 247 256 if (*pszFormat == '%') 248 257 { 249 #ifndef RING0 250 if (cch > 0) 251 { 252 strout((char*)(pszFormat - cch), cch); 253 cch = 0; 254 } 255 #endif 258 if (cch > 0) 259 { 260 strout((char*)(pszFormat - cch), cch); 261 cch = 0; 262 } 256 263 257 264 pszFormat++; /* skip '%' */ … … 396 403 else 397 404 { 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 405 cch++; 406 pszFormat++; 407 } 408 } 409 410 if (cch > 0) 411 { 412 strout((char*)(pszFormat - cch), cch); 413 cch = 0; 414 } 414 415 415 416 return 0UL; … … 479 480 static void chout(int ch) 480 481 { 481 #ifndef RING0 482 483 482 #ifdef DOSWRITEOUTPUT 483 ULONG ulWrote; 484 #endif 484 485 485 486 if (ch != '\r') … … 487 488 if (ch == '\n') 488 489 { 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 490 #ifdef COMOUTPUT 499 491 #pragma info(noeff) 500 492 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 501 _outp(options.usCom, ch );/* Put the char. */493 _outp(options.usCom, chReturn); /* Put the char. */ 502 494 #pragma info(restore) 503 Yield();504 #else505 DosWrite(1, (void*)&ch, 1, &ulWrote);506 495 #endif 496 #ifdef DOSWRITEOUTPUT 497 DosWrite(1, (void*)&chReturn, 1, SSToDS(&ulWrote)); 498 #endif 499 } 500 #ifdef COMOUTPUT 501 #pragma info(noeff) 502 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 503 _outp(options.usCom, ch); /* Put the char. */ 504 #pragma info(restore) 505 Yield(); 506 #endif 507 #ifdef DOSWRITEOUTPUT 508 DosWrite(1, SSToDS(&ch), 1, SSToDS(&ulWrote)); 509 #endif 507 510 } 508 511 } … … 529 532 530 533 /* 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 534 #ifdef COMOUTPUT 535 for (ul = 0; ul < cch; ul++) 536 { 537 #pragma info(noeff) 538 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 539 _outp(options.usCom, psz[ul]); /* Put the char. */ 540 #pragma info(restore) 541 } 542 #endif 543 #ifdef DOSWRITEOUTPUT 544 DosWrite(1, psz, cch, SSToDS(&ul)); 545 #endif 542 546 543 547 /* cr and lf check + skip */ 544 if ( psz[cch] == '\n' || psz[cch] == '\r')548 if (cch < cchMax && (psz[cch] == '\n' || psz[cch] == '\r')) 545 549 { 546 550 if (psz[cch] == '\n') 547 551 { 548 #ifdef RING0552 #ifdef COMOUTPUT 549 553 #pragma info(noeff) 550 554 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ … … 552 556 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 553 557 _outp(options.usCom, chNewLine); /* Put the char. */ 554 cchYield 558 cchYield++; 555 559 #pragma info(restore) 556 #else 557 DosWrite(1, (void*)&chReturn, 1, &ul); 558 DosWrite(1, (void*)&chNewLine, 1, &ul); 560 #endif 561 #ifdef DOSWRITEOUTPUT 562 DosWrite(1, (void*)&chReturn, 1, SSToDS(&ul)); 563 DosWrite(1, (void*)&chNewLine, 1, SSToDS(&ul)); 559 564 #endif 560 565
Note:
See TracChangeset
for help on using the changeset viewer.