Пример #1
0
void
RunVideoTests()
{
    static const struct
    {
        int w, h, bpp;
    } mode_list[] = {
        {
        640, 480, 8}, {
        640, 480, 16}, {
        640, 480, 32}, {
        800, 600, 8}, {
        800, 600, 16}, {
        800, 600, 32}, {
        1024, 768, 8}, {
        1024, 768, 16}, {
        1024, 768, 32}
    };
    static const Uint32 flags[] = {
        (SDL_SWSURFACE),
        (SDL_SWSURFACE | SDL_FULLSCREEN),
        (SDL_HWSURFACE | SDL_FULLSCREEN),
        (SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF)
    };
    int i, j;
    SDL_Surface *screen;

    /* Test out several different video mode combinations */
    SDL_WM_SetCaption("SDL Video Benchmark", "vidtest");
    SDL_ShowCursor(0);
    for (i = 0; i < SDL_TABLESIZE(mode_list); ++i) {
        for (j = 0; j < SDL_TABLESIZE(flags); ++j) {
            printf("===================================\n");
            printf("Setting video mode: %dx%d at %d bpp, flags: ",
                   mode_list[i].w, mode_list[i].h, mode_list[i].bpp);
            PrintFlags(flags[j]);
            printf("\n");
            screen = SDL_SetVideoMode(mode_list[i].w,
                                      mode_list[i].h,
                                      mode_list[i].bpp, flags[j]);
            if (!screen) {
                printf("Setting video mode failed: %s\n", SDL_GetError());
                continue;
            }
            if ((screen->flags & FLAG_MASK) != flags[j]) {
                printf("Flags didn't match: ");
                PrintFlags(screen->flags);
                printf("\n");
                continue;
            }
            if (!RunModeTests(screen)) {
                return;
            }
        }
    }
}
Пример #2
0
static void
ReadType3MsgBody(const PRUint8 *inBuf, PRUint32 start)
{
    const PRUint8 *cursor = inBuf + start;

    SecBuf secbuf;

    ReadSecBuf(&secbuf, cursor); // LM response
    PrintBuf("LM response", inBuf + secbuf.offset, secbuf.length);

    ReadSecBuf(&secbuf, cursor); // NTLM response
    PrintBuf("NTLM response", inBuf + secbuf.offset, secbuf.length);

    ReadSecBuf(&secbuf, cursor); // domain name
    PrintBuf("domain name", inBuf + secbuf.offset, secbuf.length);

    ReadSecBuf(&secbuf, cursor); // user name
    PrintBuf("user name", inBuf + secbuf.offset, secbuf.length);

    ReadSecBuf(&secbuf, cursor); // workstation name
    PrintBuf("workstation name", inBuf + secbuf.offset, secbuf.length);

    ReadSecBuf(&secbuf, cursor); // session key
    PrintBuf("session key", inBuf + secbuf.offset, secbuf.length);

    PRUint32 flags = ReadUint32(cursor);
    PrintBuf("flags", (const PRUint8 *) &flags, sizeof(flags));
    PrintFlags(flags);
}
Пример #3
0
static void
ReadType2MsgBody(const PRUint8 *inBuf, PRUint32 start)
{
    PRUint16 targetLen, offset;
    PRUint32 flags;
    const PRUint8 *target;
    const PRUint8 *cursor = inBuf + start;

    // read target name security buffer
    targetLen = ReadUint16(cursor);
    ReadUint16(cursor); // discard next 16-bit value
    offset = ReadUint32(cursor); // get offset from inBuf
    target = inBuf + offset;

    PrintBuf("target", target, targetLen);

    PrintBuf("flags", cursor, 4);
    // read flags
    flags = ReadUint32(cursor);
    PrintFlags(flags);

    // read challenge
    PrintBuf("challenge", cursor, 8);
    cursor += 8;

    PrintBuf("context", cursor, 8);
    cursor += 8;

    SecBuf secbuf;
    ReadSecBuf(&secbuf, cursor);
    PrintBuf("target information", inBuf + secbuf.offset, secbuf.length);
}
Пример #4
0
int wmain(int argc, LPWSTR argv[])
{
    if (!ParseCmdline(argc, argv))
    {
        wprintf(L"Usage: gflags [/p [image.exe] [/enable|/disable [/full]]]\n"
                L"              [/i <image.exe> [<Flags>]]\n"
                L"    image.exe:  Image you want to deal with\n"
                L"    /enable:    enable page heap for the image\n"
                L"    /disable:   disable page heap for the image\n"
                L"    /full:      activate full debug page heap\n"
                L"    <Flags>:    A 32 bit hex number (0x00000001) that specifies\n"
                L"                one or more global flags to set.\n"
                L"                Without any flags, the current settings are shown.\n"
                L"                Specify FFFFFFFF to delete the GlobalFlags entry.\n"
                L"                Additionally, instead of a single hex number,\n"
                L"                specify a list of abbreviations prefixed with\n"
                L"                a '+' to add, and '-' to remove a bit.\n"
                L"                Valid abbreviations:\n");
        PrintFlags(~0, DEST_IMAGE);
        return 1;
    }

    if (UsePageHeap)
    {
        return PageHeap_Execute();
    }
    else if (UseImageFile)
    {
        return ImageFile_Execute();
    }
    return 2;
}
Пример #5
0
BOOL RegisterStateChangeCallback (
    UINT32 CodeOffset,
    UINT32 RegisterNumber,
    GcSlotFlags Flags,
    GcSlotState NewState,
    PVOID pvData)
{
    GcInfoDumpState *pState = (GcInfoDumpState*)pvData;

    if (pState->fSafePoint && (GC_SLOT_LIVE != NewState))
    {
        // Don't print deaths for safepoints
        return FALSE;
    }

    if (pState->LastCodeOffset != CodeOffset)
    {
        if (pState->fAnythingPrinted)
            pState->pfnPrintf("\n");

        pState->pfnPrintf("%08x", CodeOffset);

        pState->LastCodeOffset = CodeOffset;
    }

    char delta = ((GC_SLOT_LIVE == NewState) ? '+' : '-');

    pState->pfnPrintf(" %c%s", delta, GetRegName(RegisterNumber));

    PrintFlags(pState->pfnPrintf, Flags);

    pState->fAnythingPrinted = TRUE;

    return FALSE;
}
Пример #6
0
void ListBackends()
{
uint32_t NBackends, i;
char flags_str[40];

	nvmBackendDescriptor *BackendList= nvmGetBackendList(&NBackends);
	
	fprintf(stdout, "Avalable backends:\n");
	fprintf(stdout, "N\t\tName\t\tMax Opt\t\tCan Do\n");
	for (i = 0; i < NBackends; i++)
	{
		PrintFlags(flags_str, BackendList[i].Flags);
		fprintf(stdout, "%d\t\t%s\t\t%d\t\t%s\n", i, BackendList[i].Name, BackendList[i].MaxOptLevel, flags_str);
	}
}
Пример #7
0
static void
ReadType1MsgBody(const PRUint8 *inBuf, PRUint32 start)
{
    const PRUint8 *cursor = inBuf + start;
    PRUint32 flags;

    PrintBuf("flags", cursor, 4);
    // read flags
    flags = ReadUint32(cursor);
    PrintFlags(flags);

    // type 1 message may not include trailing security buffers
    if ((flags & kNegotiateDomainSupplied) |
            (flags & kNegotiateWorkstationSupplied))
    {
        SecBuf secbuf;
        ReadSecBuf(&secbuf, cursor);
        PrintBuf("supplied domain", inBuf + secbuf.offset, secbuf.length);

        ReadSecBuf(&secbuf, cursor);
        PrintBuf("supplied workstation", inBuf + secbuf.offset, secbuf.length);
    }
}
Пример #8
0
int main(int argc, char **argv)
{
    /*
     * Parse args.
     */
    if (argc <= 1)
    {
        printf("usage: %s [-C|--dir <UCD-dir>] [UnicodeData.txt [DerivedCoreProperties.txt [PropList.txt] [DerivedNormalizationProps.txt]]]\n",
                argv[0]);
        return 1;
    }

    const char *pszBaseDir                      = NULL;
    const char *pszUnicodeData                  = "UnicodeData.txt";
    const char *pszDerivedCoreProperties        = "DerivedCoreProperties.txt";
    const char *pszPropList                     = "PropList.txt";
    const char *pszDerivedNormalizationProps    = "DerivedNormalizationProps.txt";
    int iFile = 0;
    for (int argi = 1;  argi < argc; argi++)
    {
        if (argv[argi][0] != '-')
        {
            switch (iFile++)
            {
                case 0: pszUnicodeData                  = argv[argi]; break;
                case 1: pszDerivedCoreProperties        = argv[argi]; break;
                case 2: pszPropList                     = argv[argi]; break;
                case 3: pszDerivedNormalizationProps    = argv[argi]; break;
                default:
                    fprintf(stderr, "uniread: syntax error at '%s': too many filenames\n", argv[argi]);
                    return 1;
            }
        }
        else if (   !strcmp(argv[argi], "--dir")
                 || !strcmp(argv[argi], "-C"))
        {
            if (argi + 1 >= argc)
            {
                fprintf(stderr, "uniread: syntax error: '%s' is missing the directory name.\n", argv[argi]);
                return 1;
            }
            argi++;
            pszBaseDir = argv[argi];
        }
        else if (   !strcmp(argv[argi], "-q")
                 || !strcmp(argv[argi], "--quiet"))
            g_fQuiet = true;
        else
        {
            fprintf(stderr, "uniread: syntax error at '%s': Unknown argument\n", argv[argi]);
            return 1;
        }
    }

    /*
     * Read the data.
     */
    int rc = ReadUnicodeData(pszBaseDir, pszUnicodeData);
    if (rc)
        return rc;
    rc = GenerateExcludedData();
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszPropList);
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszDerivedCoreProperties);
    if (rc)
        return rc;
    rc = ReadProperties(pszBaseDir, pszDerivedNormalizationProps);
    if (rc)
        return rc;

    /*
     * Print stuff.
     */
    rc = PrintHeader(argv[0]);
    if (rc)
        return rc;
    rc = PrintFlags();
    if (rc)
        return rc;
    rc = PrintUpper();
    if (rc)
        return rc;
    rc = PrintLower();
    if (rc)
        return rc;

    /* done */
    fflush(stdout);

    return rc;
}
Пример #9
0
int main(int nargs, char **args)
{
   ATL_arg_t *cmpb, *asmb, *lnkb, *filb, *ap, *rmb=NULL, *rp;
   int bits, lcmp, lasm, llnk, lfil, i, lout=0, CPPONLY;
   char *cmps, *asms, *lnks, *outn;
   #ifdef DEBUG
      fplog = fopen("ATL_CCWRAP.log", "w");
      PrintFlags(nargs, args);
   #endif

   outn = ParseCompFlags(nargs, args, &bits, &filb, &cmpb, &asmb, &lnkb,
                         &CPPONLY);
   if (outn)
      lout = strlen(outn);
/*
 * Now, compile each file to the standard name ATL_tmp#.s using gcc -S
 */
   if (cmpb)
   {
      rp = rmb = NewArg("rm");
      lcmp = FindTotLen(cmpb);
      lfil = FindMaxLen(filb);
      cmps = malloc(lcmp + lfil + 32);
      assert(cmps);
      i = PrintAllArgsToStr(cmpb, cmps);
      if (i != lcmp)
      {
         fprintf(stderr, "ERROR: lcmp=%d, i=%d, strlen=%d, str='%s'\n",
                 lcmp, i, (int)strlen(cmps), cmps);
         #ifdef DEBUG
            fprintf(fplog, "ERROR: lcmp=%d, i=%d, strlen=%d, str='%s'\n",
                    lcmp, i, (int)strlen(cmps), cmps);
            fflush(fplog);
         #endif
         assert(i == lcmp);
      }
      for (i=0,ap=filb; ap; i++, ap = ap->next)
      {
         int k;
         char tmpnam[16];
         sprintf(tmpnam, "ATL_tmp%d.[s,o]", i);
         rp->next = NewArg(tmpnam);
         rp = rp->next;
         if (ap->arg[ap->len-1] == 'S' || CPPONLY)
            k = lcmp + sprintf(cmps+lcmp, "-E -o ATL_tmp%d.s ", i);
         else
            k = lcmp + sprintf(cmps+lcmp, "-S -o ATL_tmp%d.s ", i);
         PrintArgToStr(ap, cmps+k);
         #ifdef DEBUG
            fprintf(fplog, "COMP: %s\n", cmps);
            fflush(fplog);
         #endif
         assert(!system(cmps));
      }
      KillAllArgs(cmpb);
      free(cmps);
/*
 *    If we aren't linking and we have only one file with a specified name,
 *    assemble the .s file to the specified .o file
 */
      lasm = FindTotLen(asmb);
      cmps = malloc(lasm + lfil + 64);
      assert(cmps);
      i = PrintAllArgsToStr(asmb, cmps);
      assert(i == lasm);
      if (!lnkb && !filb->next)
      {
         int k;
         char *sp;
         if (outn)
            sp = outn;
         else
            sp = GetDefObjNam(filb->arg);
         k = lasm + sprintf(cmps+lasm, "-c ATL_tmp0.s");
         if (sp != outn)
            sprintf(cmps+k, " -o %s", sp);
         #ifdef DEBUG
            fprintf(fplog, "ASSEMBLE: %s\n", cmps);
         #endif
         k = system(cmps);
         KillAllArgs(filb);
         KillAllArgs(asmb);
         free(cmps);
         if (sp != outn)
            free(sp);
         return(k);
      }
/*
 *    Now assemble every .s into a .o
 */
      for (i=0,ap=filb; ap; i++, ap = ap->next)
      {
         int k;
         k = lasm + sprintf(cmps+lasm, "-c ATL_tmp%d.s -o ATL_tmp%d.o", i, i);
         #ifdef DEBUG
            fprintf(fplog, "ASSEMBLE: %s\n", cmps);
            fflush(fplog);
         #endif
         assert(!system(cmps));
      }
      KillAllArgs(asmb);
      free(cmps);
   }
/*
 * Now issue link line
 */
   if (lnkb)
   {
/*
 *    Put files back into link line in the order in which they were found
 *    NULL-arg nodes are placeholders for the names.
 */
      for (i=0,ap=filb; ap; i++,ap = ap->next)
      {
         ATL_arg_t *tp;
         for (tp=lnkb; tp && tp->arg; tp = tp->next);
         assert(tp);
         tp->arg = malloc(16);
         assert(tp->arg);
         tp->len = sprintf(tp->arg, "ATL_tmp%d.o", i);
      }
      llnk = FindTotLen(lnkb);
      cmps = malloc(llnk + 1);
      assert(cmps);
      i = PrintAllArgsToStr(lnkb, cmps);
      assert(i == llnk);
      #ifdef DEBUG
         fprintf(fplog, "LINK: '%s'\n", cmps);
         fflush(fplog);
      #endif
      assert(!system(cmps));
      KillAllArgs(lnkb);
      free(cmps);
   }
   KillAllArgs(filb);
/*
 * Now delete the temporary files that we have created
 */
   i = FindTotLen(rmb);
   cmps = malloc(i + 1);
   assert(cmps);
   assert(i == PrintAllArgsToStr(rmb, cmps));
   KillAllArgs(rmb);
   printf("%s\n", cmps);
   system(cmps);
   free(cmps);

   #ifdef DEBUG
      system("cat ATL_CCWRAP.log");
      fclose(fplog);
   #endif
   return(0);
}
Пример #10
0
BOOL StackSlotStateChangeCallback (
    UINT32 CodeOffset,
    GcSlotFlags flags,
    GcStackSlotBase BaseRegister,
    SSIZE_T StackOffset,
    GcSlotState NewState,
    PVOID pvData)
{
    GcInfoDumpState *pState = (GcInfoDumpState*)pvData;

    if (pState->fSafePoint && (GC_SLOT_LIVE != NewState))
    {
        // Don't print deaths for safepoints
        return FALSE;
    }

    if (pState->LastCodeOffset != CodeOffset)
    {
        if (pState->fAnythingPrinted)
            pState->pfnPrintf("\n");

        if ((CodeOffset == -2) && !pState->fAnythingPrinted)
            pState->pfnPrintf("Untracked:");
        else
            pState->pfnPrintf("%08x", CodeOffset);

        pState->LastCodeOffset = CodeOffset;
    }

    char delta = ((GC_SLOT_LIVE == NewState) ? '+' : '-');

    CHAR sign = '+';

    // the dumper's call back (in GcInfoDumper.cpp) has to "guess" the base register
    // for stack slots it usually guesses it wrong ......
    // We try to filter out at least the non-sensical combinations
    //     - negative offset relative to SP
    //     - positive offset relative to CALLER_SP

    if (StackOffset < 0)
    {
        StackOffset = -StackOffset;
        sign = '-';
#ifndef GCINFODUMPER_IS_FIXED
        if (BaseRegister == GC_SP_REL)
        {   // negative offset to SP????
            BaseRegister = GC_CALLER_SP_REL;
        }
#endif // !GCINFODUMPER_IS_FIXED
    }
#ifndef GCINFODUMPER_IS_FIXED
    else if (BaseRegister == GC_CALLER_SP_REL)
    {   // positive offset to Caller_SP????
        BaseRegister = GC_SP_REL;
    }
#endif // !GCINFODUMPER_IS_FIXED



    PCSTR pszBaseReg;

    switch (BaseRegister)
    {
    case GC_CALLER_SP_REL:
        pszBaseReg = "caller.sp";
        break;
    case GC_SP_REL:
        pszBaseReg = "sp";
        break;
    case GC_FRAMEREG_REL:
        pszBaseReg = GetRegName(pState->FrameRegister);
        break;
    default:
        pszBaseReg = "???";
        break;
    }

    pState->pfnPrintf(" %c%s%c%x", delta, pszBaseReg, sign, StackOffset);

    PrintFlags(pState->pfnPrintf, flags);

    pState->fAnythingPrinted = TRUE;

    return FALSE;
}
Пример #11
0
int RunModeTests(SDL_Surface *screen)
{
	Uint32 then, now;
	Uint32 frames;
	float seconds;
	int i;
	Uint8 r, g, b;
	SDL_Surface *bmp, *bmpcc, *tmp;
	SDL_Event event;

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

	/* First test fills and screen update speed */
	printf("Running color fill and fullscreen update test\n");
	then = SDL_GetTicks();
	frames = 0;
	for ( i = 0; i < 256; ++i ) {
		r = i;
		g = 0;
		b = 0;
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
		SDL_Flip(screen);
		++frames;
	}
	for ( i = 0; i < 256; ++i ) {
		r = 0;
		g = i;
		b = 0;
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
		SDL_Flip(screen);
		++frames;
	}
	for ( i = 0; i < 256; ++i ) {
		r = 0;
		g = 0;
		b = i;
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, r, g, b));
		SDL_Flip(screen);
		++frames;
	}
	now = SDL_GetTicks();
	seconds = (float)(now - then) / 1000.0f;
	if ( seconds > 0.0f ) {
		printf("%d fills and flips in %2.2f seconds, %2.2f FPS\n", frames, seconds, (float)frames / seconds);
	} else {
		printf("%d fills and flips in zero seconds!n", frames);
	}

        /* clear the screen after fill test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the generic blit test */
	bmp = SDL_LoadBMP("sample.bmp");
	if ( ! bmp ) {
		printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
		return 0;
	}
	printf("Running freshly loaded blit test: %dx%d at %d bpp, flags: ",
		bmp->w, bmp->h, bmp->format->BitsPerPixel);
	PrintFlags(bmp->flags);
	printf("\n");
	then = SDL_GetTicks();
	frames = RunBlitTests(screen, bmp, NUM_BLITS);
	now = SDL_GetTicks();
	seconds = (float)(now - then) / 1000.0f;
	if ( seconds > 0.0f ) {
		printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
	} else {
		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
	}

        /* clear the screen after blit test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the colorkeyed blit test */
	bmpcc = SDL_LoadBMP("sample.bmp");
	if ( ! bmpcc ) {
		printf("Couldn't load sample.bmp: %s\n", SDL_GetError());
		return 0;
	}
	printf("Running freshly loaded cc blit test: %dx%d at %d bpp, flags: ",
		bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
        SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, *(Uint8 *)bmpcc->pixels);

	PrintFlags(bmpcc->flags);
	printf("\n");
	then = SDL_GetTicks();
	frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
	now = SDL_GetTicks();
	seconds = (float)(now - then) / 1000.0f;
	if ( seconds > 0.0f ) {
		printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
	} else {
		printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
	}

        /* clear the screen after cc blit test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the generic blit test */
	tmp = bmp;
	bmp = SDL_DisplayFormat(bmp);
	SDL_FreeSurface(tmp);
	if ( ! bmp ) {
		printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
		return 0;
	}
	printf("Running display format blit test: %dx%d at %d bpp, flags: ",
		bmp->w, bmp->h, bmp->format->BitsPerPixel);
	PrintFlags(bmp->flags);
	printf("\n");
	then = SDL_GetTicks();
	frames = RunBlitTests(screen, bmp, NUM_BLITS);
	now = SDL_GetTicks();
	seconds = (float)(now - then) / 1000.0f;
	if ( seconds > 0.0f ) {
		printf("%d blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
	} else {
		printf("%d blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
	}

        /* clear the screen after blit test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the colorkeyed blit test */
	tmp = bmpcc;
	bmpcc = SDL_DisplayFormat(bmpcc);
	SDL_FreeSurface(tmp);
	if ( ! bmpcc ) {
		printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
		return 0;
	}
	printf("Running display format cc blit test: %dx%d at %d bpp, flags: ",
		bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
	PrintFlags(bmpcc->flags);
	printf("\n");
	then = SDL_GetTicks();
	frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
	now = SDL_GetTicks();
	seconds = (float)(now - then) / 1000.0f;
	if ( seconds > 0.0f ) {
		printf("%d cc blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
	} else {
		printf("%d cc blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
	}

        /* clear the screen after cc blit test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the alpha blit test only if screen bpp>8 */
        if (bmp->format->BitsPerPixel>8)
        {
		SDL_FreeSurface(bmp);
                bmp = SDL_LoadBMP("sample.bmp");
		SDL_SetAlpha(bmp, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
		tmp = bmp;
		bmp = SDL_DisplayFormat(bmp);
		SDL_FreeSurface(tmp);
		if ( ! bmp ) {
			printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
			return 0;
		}
		printf("Running display format alpha blit test: %dx%d at %d bpp, flags: ",
			bmp->w, bmp->h, bmp->format->BitsPerPixel);
		PrintFlags(bmp->flags);
		printf("\n");
		then = SDL_GetTicks();
		frames = RunBlitTests(screen, bmp, NUM_BLITS);
		now = SDL_GetTicks();
		seconds = (float)(now - then) / 1000.0f;
		if ( seconds > 0.0f ) {
			printf("%d alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
		} else {
			printf("%d alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
		}
	}

        /* clear the screen after alpha blit test */
        SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
	SDL_Flip(screen);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}

        /* run the cc+alpha blit test only if screen bpp>8 */
        if (bmp->format->BitsPerPixel>8)
        {
		SDL_FreeSurface(bmpcc);
                bmpcc = SDL_LoadBMP("sample.bmp");
		SDL_SetAlpha(bmpcc, SDL_SRCALPHA, 85); /* 85 - 33% alpha */
                SDL_SetColorKey(bmpcc, SDL_SRCCOLORKEY | SDL_RLEACCEL, *(Uint8 *)bmpcc->pixels);
		tmp = bmpcc;
		bmpcc = SDL_DisplayFormat(bmpcc);
		SDL_FreeSurface(tmp);
		if ( ! bmpcc ) {
			printf("Couldn't convert sample.bmp: %s\n", SDL_GetError());
			return 0;
		}
		printf("Running display format cc+alpha blit test: %dx%d at %d bpp, flags: ",
			bmpcc->w, bmpcc->h, bmpcc->format->BitsPerPixel);
		PrintFlags(bmpcc->flags);
		printf("\n");
		then = SDL_GetTicks();
		frames = RunBlitTests(screen, bmpcc, NUM_BLITS);
		now = SDL_GetTicks();
		seconds = (float)(now - then) / 1000.0f;
		if ( seconds > 0.0f ) {
			printf("%d cc+alpha blits / %d updates in %2.2f seconds, %2.2f FPS\n", NUM_BLITS*frames, frames, seconds, (float)frames / seconds);
		} else {
			printf("%d cc+alpha blits / %d updates in zero seconds!\n", NUM_BLITS*frames, frames);
		}
	}

	SDL_FreeSurface(bmpcc);
	SDL_FreeSurface(bmp);

	while ( SDL_PollEvent(&event) ) {
		if ( event.type == SDL_KEYDOWN )
			return 0;
	}
	return 1;
}
Пример #12
0
 std::string MovementFlagsExtra_ToString(uint32 flags)
 {
     std::string str;
     PrintFlags(flags, MovementFlagExtraNames, str);
     return str;
 }
Пример #13
0
 std::string MoveSplineFlag::ToString() const
 {
     std::string str;
     PrintFlags(raw(), SplineFlagNames, str);
     return str;
 }
Пример #14
0
void
DisClients()
{
	struct sam_fs_status *fsarray;
	int		i, j;

	if ((numfs = GetFsStatus(&fsarray)) == -1) {
		Error("GetFsStatus failed");
		/*NOTREACHED*/
	}

	if (finfo != NULL) free(finfo);
	finfo = (struct sam_fs_info *)
	    malloc(numfs * sizeof (struct sam_fs_info));


	for (i = 0; i < numfs; i++) {
		struct sam_fs_status *fs;
		struct sam_fs_info *fi;

		fs = fsarray + i;
		fi = finfo + i;
		if (GetFsInfo(fs->fs_name, fi) == -1) {
			Error("GetFsInfo(%s) failed", fs->fs_name);
			/*NOTREACHED*/
		}
	}
	free(fsarray);

	fclient = malloc(SAM_MAX_SHARED_HOSTS * sizeof (sam_client_info_t));
	ln = 2;

	for (i = fsfirst; i < numfs; i++) {
		struct sam_fs_info *fi;

		if (ln > LINES - 3) {
			break;
		}
		fi = finfo + i;

		if (fi->fi_config1 & MC_SHARED_FS) {
			struct sam_get_fsclistat_arg arg;
			sam_client_info_t *fc;

			strncpy(arg.fs_name, fi->fi_name, sizeof (arg.fs_name));
			arg.maxcli = SAM_MAX_SHARED_HOSTS;
			arg.numcli = 0;
			arg.fc.ptr = fclient;

			if (sam_syscall(SC_getfsclistat, &arg,
			    sizeof (arg)) < 0) {
				Mvprintw(ln++, 0, "SC_getfsclistat failed");
				return;
			}
			ncli = arg.maxcli;
			if (*fi->fi_server == '\0') {
				continue;
			}
			Mvprintw(ln++, 0, catgets(catfd, SET, 7420,
			    "%s is shared, server is %s, %d clients %d max"),
			    fi->fi_name, fi->fi_server, arg.numcli, arg.maxcli);
			Mvprintw(ln++, 0, catgets(catfd, SET, 7421,
"ord hostname              seqno nomsgs status   config  conf1  flags"));

			for (j = clifirst; j < ncli; j++) {
				char extra[21];

				if (ln > LINES - 3) {
					break;
				}
				fc = fclient + j;

				if (fc->cl_status == 0) {
					continue;
				}

					/*    "MNT SRV BLK OFF DEAD" */
					/*    "MNT CLI BLK OFF DOWN" */
				strcpy(extra, "                    ");
				if (fc->cl_status & FS_MOUNTED) {
					strcpy(extra, "MNT ");
				}
				if (fc->cl_status & FS_SERVER) {
					strcpy(extra+4, "SVR ");
				} else {
					strcpy(extra+4, "CLI ");
				}
				if ((fc->cl_flags & SAM_CLIENT_SOCK_BLOCKED) ||
				    (fc->cl_flags & SAM_CLIENT_NOT_RESP)) {
					strcpy(extra+8, "BLK ");
				}
				if ((fc->cl_flags & SAM_CLIENT_OFF_PENDING) ||
				    (fc->cl_flags & SAM_CLIENT_OFF)) {
					strcpy(extra+12, "OFF ");
				}
				if (fc->cl_flags & SAM_CLIENT_DEAD) {
					strcpy(extra+16, "DEAD ");
				} else if (fc->cl_flags & SAM_CLIENT_SC_DOWN) {
					strcpy(extra+16, "DOWN ");
				}
				Mvprintw(ln++, 0,
				    "%3d %-16s %6d %6d %6x %8x %6x %6x %s",
				    j+1, fc->hname,
				    fc->cl_min_seqno, fc->cl_nomsg,
				    fc->cl_status,
				    fc->cl_config, fc->cl_config1,
				    fc->cl_flags, extra);

				if (details == 1 || ScreenMode == FALSE) {
					if (ln > LINES - 8) {
						break;
					}
					PrintFlags(fc->cl_config, confTable,
					    confTableSize, "config");
					PrintFlags(fc->cl_config1, conf1Table,
					    conf1TableSize, "config1");
					PrintFlags(fc->cl_flags, cflagsTable,
					    cflagsTableSize, "flags");
					PrintFlags(fc->cl_status, statusTable,
					    statusTableSize, "status");
					Mvprintw(ln++, 6, "%-8s :  %s",
					    "last_msg",
					    ctime((time_t *)
					    &fc->cl_lastmsg_time));
					Mvprintw(ln++, 0, "");
				}
			}
			Mvprintw(ln++, 0, "");
		}
	}

	free(fclient);

#ifdef DeBug
	Mvprintw(LINES-2, 0, " fs %d part %d nfs %d np %d ln %d ",
	    fsfirst, clclist, numfs, 0, ln);
#endif

	if (i >= numfs) {  /* the end */
		Mvprintw(LINES-1, 0, "         ");
	} else {
		Mvprintw(LINES-1, 0, catgets(catfd, SET, 2, "     more"));
	}
}