Ignore:
Timestamp:
Jul 17, 2000, 12:43:41 AM (25 years ago)
Author:
bird
Message:

Checkin of current code in the Grace brance for backup purpose.

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:03 bird Exp $
     1/* $Id: vprintf.c,v 1.7.4.1 2000-07-16 22:43:41 bird Exp $
    22 *
    33 * vprintf and printf
     
    2525
    2626
    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
    2836    #define INCL_NOAPI
    2937#else
     
    4149#include "dev32.h"
    4250#include "vprintf.h"
     51#ifdef COMOUTPUT
     52    #include <builtin.h>
     53#endif
    4354#ifdef RING0
    44     #include <builtin.h>
    4555    #include "options.h"
    4656#endif
     
    222232int vprintf(const char *pszFormat, va_list args)
    223233{
    224     #ifdef RING0
     234    #if defined(RING0) && !defined(R3TST)
    225235    if (!options.fLogging)
    226236        return 0;
     
    239249int vprintf2(const char *pszFormat, va_list args)
    240250{
    241     #ifndef RING0
    242         int cch = 0;
    243     #endif
     251    int cch = 0;
    244252
    245253    while (*pszFormat != '\0')
     
    247255        if (*pszFormat == '%')
    248256        {
    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            }
    256262
    257263            pszFormat++;  /* skip '%' */
     
    396402        else
    397403        {
    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    }
    414414
    415415    return 0UL;
     
    479479static void chout(int ch)
    480480{
    481     #ifndef RING0
    482         ULONG ulWrote;
    483     #endif
     481#ifdef DOSWRITEOUTPUT
     482    ULONG ulWrote;
     483#endif
    484484
    485485    if (ch != '\r')
     
    487487        if (ch == '\n')
    488488        {
    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
    499490            #pragma info(noeff)
    500491            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. */
    502493            #pragma info(restore)
    503             Yield();
    504         #else
    505             DosWrite(1, (void*)&ch, 1, &ulWrote);
    506494        #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
    507509    }
    508510}
     
    529531
    530532        /* 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
    542545
    543546        /* cr and lf check + skip */
    544         if (psz[cch] == '\n' || psz[cch] == '\r')
     547        if (cch < cchMax && (psz[cch] == '\n' || psz[cch] == '\r'))
    545548        {
    546549            if (psz[cch] == '\n')
    547550            {
    548             #ifdef RING0
     551            #ifdef COMOUTPUT
    549552                #pragma info(noeff)
    550553                while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
     
    552555                while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
    553556                _outp(options.usCom, chNewLine);            /* Put the char. */
    554                 cchYield ++;
     557                cchYield++;
    555558                #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));
    559563            #endif
    560564
Note: See TracChangeset for help on using the changeset viewer.