Пример #1
0
Command::Dpt_Error	Show_Inquiry::execute( String_List **output )
	{
	ENTER( "Command::Dpt_Error	Show_Inquiry::execute( String_List **output )" );
	Dpt_Error	err;

	Init_Engine();

	// allocate this object once for all functions.
	*output	= new String_List();

	err	= Show_Inq_on_Dev( **output, show_Ctlr );

	if( err.Is_Error() )
		{
		(**output).add_Item (EventStrings[STR_FAILURE]);
		(**output).add_Item ((char *) err);
		}
		else
		{
		if( (**output).get_Num_Items() == 0 )
			{
			(**output).add_Item(EventStrings[STR_NO_ITEMS_FOUND]);
			err = Dpt_Error::DPT_CMD_ERR_CANT_FIND_COMPONENT;
			}
		}

	EXIT();
	return( err );
	}
Пример #2
0
int main (void)
{
	Init_Engine ();
	SDL_ShowCursor(0);
	
	Frames_Per_Seconds ();
	
	run_flag = 1;
	while (run_flag)
	{
		Input_System ();
		Script_Engine ();
		Render_System ();
		Audio_System ();
	}
	
	return 0;
}
Пример #3
0
Command::Dpt_Error	AlarmStatus::execute( String_List **output )
	{
	ENTER( "Command::Dpt_Error	AlarmStatus::execute( String_List **output )" );
	Dpt_Error		err;
	bool			hbaIndexFound = true;
	DPT_TAG_T		thisHBATag;

	Init_Engine(1); // only scan hbas (1)

	*output	= new String_List();

	(**output).add_Item (EventStrings[STR_ALARM_STATUS_HEADER]);
	(**output).add_Item (STR_DEV_DIVIDING_LINE);

	// If our HBA is -1 then we are going to process all the HBAs in the
	// system.
	if ( whichHBA != -1)
		{
		// Determine the hba address from the index.
		thisHBATag = Get_HBA_by_Index( whichHBA, &hbaIndexFound );
		err |= DoEachHBA( output, thisHBATag );
		}
	else
		{
		// We want to process all the HBA's on the system.  Let the games begin!
		for ( int hbaIndex = 0; hbaIndexFound ; hbaIndex++ )
			{
				thisHBATag = Get_HBA_by_Index( hbaIndex, &hbaIndexFound );

				if ( hbaIndexFound )
					{
					err |= DoEachHBA( output, thisHBATag );
					}
			}


		}

	return ( err );
	}
Пример #4
0
  int  main( int  argc, char**  argv )
  {
    int    i, total, mode, base, rendered_glyphs;
    char   filename[128 + 4];
    char   alt_filename[128 + 4];
    char*  execname;

    long   t, t0, tz0;


    execname    = argv[0];

    gray_render = 0;
    visual      = 0;

    while ( argc > 1 && argv[1][0] == '-' )
    {
      switch ( argv[1][1] )
      {
      case 'g':
        gray_render = 1;
        break;

      case 'v':
        visual = 1;
        break;

      default:
        Panic( "Unknown argument '%s'!\n", argv[1] );
      }
      argc--;
      argv++;
    }

    if ( argc != 2 )
    {
      fprintf( stderr, "fttimer: simple performance timer -- part of the FreeType project\n" );
      fprintf( stderr,"-----------------------------------------------------------------\n\n" );
      fprintf( stderr,"Usage: %s [-g] [-v] fontname[.ttf|.ttc]\n\n", execname );
      fprintf( stderr,"  where '-g' asks for gray-levels rendering\n" );
      fprintf( stderr,"        '-v' displays while rendering (slower)\n" );

      exit( EXIT_FAILURE );
    }

    i = strlen( argv[1] );
    while ( i > 0 && argv[1][i] != '\\' )
    {
      if ( argv[1][i] == '.' )
        i = 0;
      i--;
    }

    filename[128] = '\0';
    alt_filename[128] = '\0';

    strncpy( filename, argv[1], 128 );
    strncpy( alt_filename, argv[1], 128 );

    if ( i >= 0 )
    {
      strncpy( filename + strlen( filename ), ".ttf", 4 );
      strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
    }

    /* Initialize engine */

    if ( (error = TT_Init_FreeType( &engine )) )
      Panic( "Error while initializing engine, code = 0x%x.\n", error );

    /* Load face */

    error = TT_Open_Face( engine, filename, &face );

    if ( error == TT_Err_Could_Not_Open_File )
    {
      strcpy( filename, alt_filename );
      error = TT_Open_Face( engine, alt_filename, &face );
    }

    if ( error == TT_Err_Could_Not_Open_File )
      Panic( "Could not find/open %s.\n", filename );
    else if ( error )
      Panic( "Error while opening %s, error code = 0x%x.\n",
             filename, error );

    /* get face properties and allocate preload arrays */

    TT_Get_Face_Properties( face, &properties );

    num_glyphs = properties.num_Glyphs;

    tab_glyphs = MAX_GLYPHS;
    if ( tab_glyphs > num_glyphs )
      tab_glyphs = num_glyphs;

    /* create glyph */

    error = TT_New_Glyph( face, &glyph );
    if ( error )
      Panic( "Could not create glyph container.\n" );

    /* create instance */

    error = TT_New_Instance( face, &instance );
    if ( error )
      Panic( "Could not create instance for %s.\n", filename );

    error = TT_Set_Instance_CharSize( instance, 400*64 );
    if ( error )
      Panic( "Could not reset instance for %s.\n", filename );

    if ( gray_render )
      mode = Graphics_Mode_Gray;
    else
      mode = Graphics_Mode_Mono;

    if ( visual )
    {
      if ( !SetGraphScreen( mode ) )
        Panic( "Could not set graphics mode.\n" );
      TT_Set_Raster_Gray_Palette( engine, gray_palette );
    }
    else
    {
      /* This is the default bitmap size used */
      vio_Width  = 640;
      vio_Height = 450;
    }

    Init_Engine();

    Num  = 0;
    Fail = 0;

    total = num_glyphs;
    base  = 0;

    rendered_glyphs = 0;

    t0 = 0;  /* Initial time */

    tz0 = Get_Time();

    while ( total > 0 )
    {
      /* First, preload 'tab_glyphs' in memory */

      cur_glyph   = 0;
      cur_point   = 0;
      cur_contour = 0;

      printf( "loading %d glyphs", tab_glyphs );

      for ( Num = 0; Num < tab_glyphs; Num++ )
      {
        error = LoadTrueTypeChar( base + Num );
        if ( error )
          Fail++;

        total--;
      }

      base += tab_glyphs;

      if ( tab_glyphs > total )
        tab_glyphs = total;

      printf( ", rendering... " );

      /* Now, render the loaded glyphs */

      t = Get_Time();

      for ( Num = 0; Num < cur_glyph; Num++ )
      {
        if ( (error = ConvertRaster( Num )) )
          Fail++;
        else
        {
          rendered_glyphs ++;

          if ( visual )
          {
            sprintf( Header, "Glyph: %5d", Num );
            Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols );

            Clear_Buffer();
          }
        }
      }

      t = Get_Time() - t;
      if ( t < 0 )
        t += 100L * 60 * 60;

      printf( " = %f s\n", (double)t / 1000 );
      t0 += t;

      /* Now free all loaded outlines */
      for ( Num = 0; Num < cur_glyph; Num++ )
        TT_Done_Outline( &outlines[Num] );
    }

    tz0 = Get_Time() - tz0;

    if ( visual )
      RestoreScreen();

    TT_Close_Face( face );

    printf( "\n" );
    printf( "rendered glyphs  = %d\n", rendered_glyphs );
    printf( "render time      = %f s\n", (double)t0 / 1000 );
    printf( "fails            = %d\n", Fail );
    printf( "average glyphs/s = %f\n",
             (double)rendered_glyphs / t0 * 1000 );

    printf( "total timing     = %f s\n", (double)tz0 / 1000 );
    printf( "Fails = %d\n", Fail );

    TT_Done_FreeType( engine );

    exit( EXIT_SUCCESS );      /* for safety reasons */

    return 0;       /* never reached */
  }
Пример #5
0
/*******************************************************
Main exe loop
*******************************************************/
Command::Dpt_Error RMWFlash::execute(String_List **output)
{
    ENTER("Command::Dpt_Error RMWFlash::execute(String_List **output)");
    Dpt_Error err;
    bool more_Devs_Left = true;
    DPT_TAG_T hbaTag;

    Init_Engine(1);
    *output = new String_List();

    for (int dev_Index = 0; more_Devs_Left; dev_Index++)
    {
        hbaTag = Get_HBA_by_Index(dev_Index, &more_Devs_Left);
        if (more_Devs_Left == 0)
        {
            break;
        }

        if (( hbaNum == -1 ) || ( hbaNum == dev_Index ))
        {
            unsigned long region_size = 8192;

            switch (region) {
            case 0: region_size = 2 * 1024L * 1024L;        break;
            case 1: region_size = 65536L;                   break;
            case 2: region_size = 512L * 1024L;             break;
            case 3: region_size = 8192;                     break;
            case 4: region_size = 8192;                     break;
            }
            char * original = new char[ region_size ];

            if (original != NULL) {
                // Send the command to the engine to set the region of flash memory to use.
                engine->Reset();
                engine->Insert((uLONG) region);
                err = engine->Send(MSG_FLASH_SET_REGION, hbaTag);
                if (err.Success())
                {
                    // Send the command to the engine to read the flash memory.
                    engine->Reset();
                    engine->Insert((uLONG) 0);
                    engine->Insert((uLONG) region_size);
                    err = engine->Send(MSG_FLASH_READ, hbaTag);

                    // If the read succeeded then copy the data that was read from the flash
                    // memory into the caller's buffer.
                    if (err.Success())
                    {
                        engine->Extract(original, region_size);
#                       if (defined(DEBUG_RMWFlash))
                            {
                                int fd = creat ("before", 0777);
                                write (fd, original, (unsigned)region_size);
                                close (fd);
                            }
#                       endif
                        if (strcmp (data, "-") == 0)
                        {
                            char temp_Buf[ 256 ];
                            sprintf(temp_Buf, "%.*s\r\n", size, original + offset);
                            (**output).add_Item (temp_Buf);
                            continue;
                        }

                        engine->Reset();
                        engine->Insert((uLONG) region);
                        err = engine->Send(MSG_FLASH_SET_REGION, hbaTag);
                        if (err.Success())
                        {
                            /* Ideally we want the caller to specify the checksum handling, but for now ... */
                            switch (region) {
                            case 4:
                                if ((0x14 < offset) && (offset < 0x7F))
                                {
                                    break;
                                }
                                *((unsigned long *)(&original[0x10])) += CheckSum (data, size) - CheckSum (original + offset, size);
                            case 0:
                            case 1:
                            case 2:
                            case 3:
                                break;
                            }

                            memcpy (original + offset, data, size);
#                           if (defined(DEBUG_RMWFlash))
                                {
                                    int fd = creat ("after", 0777);
                                    write (fd, original, (unsigned)region_size);
                                    close (fd);
                                }
#                           endif
                            // Send the command to the engine to write the flash memory.
                            engine->Reset();
                            engine->Insert((void *)original, region_size);
                            err = engine->Send(MSG_FLASH_WR_NO_VERIFY, hbaTag);
                            if (err.Success())
                            {
                                // Send the command to the engine to stop writing flash memory.
                                engine->Reset();
                                err = engine->Send(MSG_FLASH_WRITE_DONE, hbaTag);
                                if (err.Success())
                                {
                                    (**output).add_Item(EventStrings[STR_FLASH_COMPLETE]);
                                }
                            }
                        }
                    }
                }
                delete [] original;
                if (err.Failure())
                {
                    extern void Flush( String_List * );
                    char temp_Buf[ 256 ];
                    sprintf(temp_Buf,
                      EventStrings[STR_FLASH_ERR_MSG],
                      0L, (int)err, (char *)err);

                    (**output).add_Item (temp_Buf);
                    Flush (*output);
                    // Send the command to the engine to stop writing flash memory.
                    engine->Reset();
                    engine->Insert((uCHAR) 1);
                    err = engine->Send(MSG_FLASH_WRITE_DONE, hbaTag);
                    break;
                }
            } else {
                err = Dpt_Error::DPT_ERR_NOT_ENOUGH_MEMORY;
                break;
            }
        }
    }
    (**output).add_Item("\n");
    return (err);
}
Пример #6
0
Command::Dpt_Error Expand::execute( String_List **output )
{
	ENTER ("Command::Dpt_Error	Expand::execute (String_List **output)");
	Dpt_Error err, temp_err;
	String_List	*out;
	raidHeader_S raid_hdr;
	raidCompList_S	comp_list;
   DPT_TAG_T compTag;
   uLONG buffSize;

   *output = out = new String_List();

	Init_Engine();
	engine->Reset();

   // warning to all OSs except NT (and 2000 - same define)
#if !defined _DPT_WIN_NT
   out->add_Item (EventStrings[STR_WARN_ONLY_NT_2000]);
#endif

   err = RaidExpandable();

   	int		dev_Index = 0;
	bool	more_Devs_Left = true;
	bool	first_time_through = true;
	bool	cluster_ON = false;

	for(dev_Index = 0; more_Devs_Left && !err.Is_Error(); dev_Index ++){

		DPT_TAG_T		hba_Tag;
		
		hba_Tag = Get_HBA_by_Index(dev_Index, &more_Devs_Left);
		engine->Reset();
		engine->Send(MSG_GET_INFO, hba_Tag);

		//if the cluster bit is enabled, DISABLE this feature
		if (engine->hbaInfo_P->flags2 & FLG_HBA_CLUSTER_MODE)
			cluster_ON = true;
	}

	if (cluster_ON)
		(**output).add_Item ( EventStrings[STR_CLSTR_FEAT_DISABLE]);

	else if (!err.Is_Error())
	{

		dptBuffer_S *deadBuff_P = dptBuffer_S::newBuffer(10);
		dptBuffer_S *tempBuff_P = dptBuffer_S::newBuffer(1024);
		smUserBuff_S *smUB_P = (smUserBuff_S *) tempBuff_P->data;

		memset(&raid_hdr, 0, sizeof(raidHeader_S));
		memset(&comp_list, 0, sizeof(raidCompList_S));

		if (components->get_Num_Items())
		{
         raid_hdr.refNum = raidToExpandType;
         buffSize = sizeof(DPT_TAG_T) + sizeof(uCHAR) + 
            sizeof(raidHeader_S) + 
            sizeof(raidCompList_S) * components->get_Num_Items();
         dptBuffer_S *raidBuff_P = dptBuffer_S::newBuffer(buffSize);
         raidBuff_P->reset ();
         raidBuff_P->insert ((uLONG) raidToExpandTag);
         raidBuff_P->insert ((uCHAR) 0);
         raidBuff_P->insert (&raid_hdr, sizeof(raidHeader_S));
         // loop on each drive to add
      	bool component_Found = true;
         bool includeDrive = true;
         while (component_Found && components->num_Left() &&
            includeDrive)
         {
            includeDrive = true;
		      compTag = Get_Dev_by_Address_and_Type (GET_SCSI_DASD,
			      components->get_Next_Item(), &component_Found);
            if (component_Found)
            {
               // must be unarrayed drive, but redirected okay
            	err = engine->Send (MSG_GET_INFO, compTag);
               // if part o f a logical ...
               if (engine->devInfo_P->flags & FLG_DEV_RAID_COMPONENT)
               {
                  // check the hba ...
         	      err = engine->Send (MSG_GET_INFO, 
                     engine->devInfo_P->raidParent);
                  // if not redirected, get out
                  if (engine->devInfo_P->raidType != RAID_REDIRECT)
                     includeDrive = false;
               }
               if (includeDrive)
               {
                  // be sure hba has enough memory to add this drive
                  if (StripeSizeCapable (compTag))
                  {
                     comp_list.tag = compTag;
                     raidBuff_P->insert (&comp_list, sizeof(raidCompList_S));
                  }
                  else
                  {
                     err = Dpt_Error::DPT_CMD_ERR_CANT_FIND_COMPONENT;
                     break;
                  }
               }
            }
            else
            {
               err = Dpt_Error::DPT_CMD_ERR_CANT_FIND_COMPONENT;
               break;
            }
         }
         if (!err.Is_Error())
            err = engine->Send(MSG_RAID_CHANGE, mgrTag, deadBuff_P, 
               raidBuff_P);
         delete[] raidBuff_P;
      }

      if (!err.Is_Error())
      {
         tempBuff_P->reset();
         tempBuff_P->writeIndex = 4;
         smUB_P->arrayFlags |= SMU_EXPANDING;
         smUB_P->raidType = (uCHAR) 5;
         err = engine->Send(MSG_SET_USER_BUFF, raidToExpandTag, 
            deadBuff_P, tempBuff_P);
      }

      delete[] deadBuff_P;
      delete[] tempBuff_P;

      if (!err.Is_Error())
      {
         engine->Insert (mgrTag);
         engine->Send (MSG_UPDATE_ALL_STATUS);
      }
	}

   if (err.Is_Error())
		out->add_Item ((char *) err);
   else
   {
      err = engine->Send (MSG_RAID_HW_ENABLE);
   	if (!err.Is_Error() && !cluster_ON) 
         PrintRaidAddress(raidToExpandTag, out);
   }
	EXIT ();
	return (err);
}