示例#1
0
文件: helpers.c 项目: suborb/reelvdr
char *cFileInfo::FileNameWithoutExt(void)
{
  char *ext = NULL;
  char *filename = NULL;
  
  if(Extension())
     ext = strdup(Extension());
  if(FileName())
    filename = strdup(FileName());

  FREENULL(buffer);
  
  if(ext && filename)
  {
    int len = strlen(filename) - strlen(ext) + 1;
    buffer = (char*)malloc(len);
    strn0cpy(buffer, filename, len);
  }
  else if(filename)
    buffer = strdup(filename);

  free(ext);
  free(filename);

  MYDEBUG("FileInfo: FileNameWithoutExt: %s", buffer);

  return buffer;
}
示例#2
0
void    FormatIdd( void ) {
//=========================

    cs_label    fmt_label;
    grp_entry   *ge;

    if( RecName() && ( NameListFind() != NULL ) ) {
        BIOutNameList( CITNode->sym_ptr );
        ge = CITNode->sym_ptr->u.nl.group_list;
        while( ge != NULL ) {
            ge->sym->u.ns.flags |= SY_REFERENCED;
            ge = ge->link;
        }
        GSetNameList( FC_SET_NML );
        KWRememb( IO_NAMELIST );
    } else if( RecNumber() ) {
        GPassStmtNo( LkUpFormat(), FC_SET_FMT );
    } else if( RecNOpn() && RecNextOpr( OPR_MUL ) ) {
        if( CITNode->link->opn.ds == DSOPN_PHI ) {
            AdvanceITPtr();   // nothing needs to be loaded for default
            KWRememb( IO_LIST_DIR );
        }
    } else if( RecNOpn() && RecNextOpr( OPR_COM ) ) {
        Extension( IL_NO_ASTERISK );
    } else if( RecIntVar() ) {
        CkVarRef();
        StNumbers.var_format = true;
        GFmtVarSet();
    } else {
        ProcIOExpr();           // will allow for array name alone
        if( !AError ) {
            if( RecArrName() ) {
                if( CITNode->typ != FT_CHAR ) {
                    Extension( IL_NON_CHARACTER );
                }
                ChkAssumed();
                GFmtArrSet();
            } else if( CITNode->typ != FT_CHAR ) {
                Error( IL_BAD_FMT_SPEC );
            } else if( ( CITNode->opn.us == USOPN_CON ) ) {
                AddConst( CITNode ); // in case single constant
                fmt_label.g_label = NextLabel();
                FScan( CITNode->sym_ptr->u.lt.length,
                       (char *)&CITNode->sym_ptr->u.lt.value, fmt_label );
                GPassLabel( fmt_label.g_label, RT_SET_FMT );
            } else {
                GFmtExprSet();
            }
        }
    }
}
示例#3
0
void    DetCallList(void) {
//=====================

    itnode      *cit;

    cit = CITNode;
    AdvanceITPtr();
    if( RecNOpn() ) {
        AdvanceITPtr();
    } else {
        SetDefinedStatus();
        AdvanceITPtr();
        while( RecComma() ) {
            if( CheckColon() ) {
                Extension( SS_FUNCTION_VALUE );
                SubStrArgs( cit );
                Detach( cit );
                return;
            }
            if( RecNOpn() ) break;
            SetDefinedStatus();
            AdvanceITPtr();
        }
    }
    if( !RecCloseParen() ) {
        Error( PC_NO_CLOSEPAREN );
    }
    Detach( cit );
}
示例#4
0
void    StmtExtension( int errcode ) {
//====================================

    char        stmt[MAX_MSGLEN+1];

    Extension( errcode, StmtName( stmt ) );
}
示例#5
0
void    IFChkExtension( IFF func ) {
//==================================

    if( IFFlags[ func ].flags & IF_EXTENSION ) {
        Extension( LI_IF_NOT_STANDARD, IFNames[ func ] );
    }
}
示例#6
0
int main(int argc,char *argv[])
{

    //char *ext = NULL;
    char *str_exp = NULL;
    banner();
    str_exp = (char *)malloc(MAX_PATH);
    if( str_exp == NULL )
    {
        printf( "内存分配失败\n" );
        system("pause");
        return -1;
    }
    if(argv[1]==NULL)
    {
        system("pause");
        return -1;
    }
    Extension((argv[1]),str_exp);
    if (strcmp(str_exp,"mkv")==0||strcmp(str_exp,"mp4")==0)
        Decoding_xor(argv[1]);
    else
        printf("文件不是音频文件\n");
    free(str_exp);//内存泄露
    str_exp=NULL;
    system("pause");
    return 0;
}
示例#7
0
CSString CreateSrStringFilename (const char* pFilename, const char* pExtension)
{
	CSString	  BaseFilename(pFilename);
	CSString	  Pathname(pFilename);
	CSString	  Extension(pExtension);
	CSString	  Filename;
	int           Index;

	Index = Pathname.FindCharR('\\');

	if (Index > 0) 
	{
		Pathname.Truncate(Index);
		Pathname += "\\";
		BaseFilename.Delete(0, Index+1);
	}
	else
	{
		Pathname.Empty();
	}

	Pathname += "Strings\\";

	Index = BaseFilename.FindCharR('.');
	if (Index > 0) BaseFilename.Truncate(Index);

	Filename = Pathname + BaseFilename;
	Filename += "_" + g_SrLanguage + "." + Extension;
	
	return Filename;
}
示例#8
0
EXPORT_C TKeyIdentifier CX509Certificate::SubjectKeyIdL() const
	{
	// if it is a v1 or v2 type then there is no way of knowing which is a CA, treat all certs as CA as done in the certificate recognizer.
	if (Version() < 3 )
		{
		return SubjectKeyIdentifierL();
		}
	
	// if it is x509 v3 certificate then check for the basic constraint extension.
	const CX509CertExtension* ext = Extension(KBasicConstraints);
	if (ext)
		{
		CX509BasicConstraintsExt* basic = CX509BasicConstraintsExt::NewLC(ext->Data());
		TBool markedAsCA = basic->IsCA();
		CleanupStack::PopAndDestroy(basic);
		// it can be an intermediate as well as root CA
		if ( markedAsCA )
			{
			return SubjectKeyIdentifierL();
			}
		}
	// For non-CA certs, use the recommended method of computing it from RFC5280, section 4.2.1.2
	return KeyIdentifierL();									
		
	}
示例#9
0
void CpReturn( void )
{
    if( !(ProgSw & PS_IN_SUBPROGRAM) ) {
        Extension( RE_IN_PROGRAM );
    }
    CkRemBlock();
    if( RecNOpn() && RecNextOpr( OPR_TRM ) ) {
        if( ( ( SubProgId->u.ns.flags & SY_CLASS ) == SY_SUBPROGRAM ) &&
                ( ( SubProgId->u.ns.flags & SY_SUBPROG_TYPE ) == SY_SUBROUTINE ) ) {
            GNullRetIdx();
        }
    } else {
        IntSubExpr();
        if( ( ( SubProgId->u.ns.flags & SY_CLASS ) == SY_SUBPROGRAM ) &&
                ( ( SubProgId->u.ns.flags & SY_SUBPROG_TYPE ) == SY_SUBROUTINE ) ) {
            GRetIdx();
        } else {
            Error( RE_ALT_IN_SUBROUTINE );
        }
    }
    AdvanceITPtr();
    ReqEOS();
    GGotoEpilog();
    Remember.transfer = true;
    Remember.stop_or_return = true;
}
bool isFileXML(std::string FilePath)
{
    std::string::size_type LastDotPos = FilePath.find_last_of(".");
    ++LastDotPos;
    std::string Extension(FilePath.substr(LastDotPos, FilePath.length() - LastDotPos));

    return Extension.compare("xml") == 0;
}
FCFileTypeP  FCFileHandlerBase::getFileType(const BoostPath& FilePath, UInt32 Flags)
{
	 //Determine the file extension
	 std::string Extension(boost::filesystem::extension(FilePath.string()));
	 boost::algorithm::trim_if(Extension,boost::is_any_of("."));

     return getFileType(Extension, Flags);
}
示例#12
0
void    NameExt( int errcod, sym_id sym ) {
//=========================================

    char        buff[MAX_SYMLEN+1];

    STGetName( sym, buff );
    Extension( errcod, buff );
}
示例#13
0
bool Db_File::Filename (string rootname)
{
    part_flag = false;
    extend = 0;
    if (rootname == filename) return (true);

    filename.clear ();
    pathname.clear ();

    if (rootname.empty ()) return (false);

    filename = rootname;

    //---- check for a partition type ----

    size_t index = filename.find (".*");

    if (index != filename.npos) {
        part_flag = true;
        filename.erase (index);
        if (f_exist (filename + ".AA")) {
            Version (40);
            extend = 1;
        } else if (f_exist (filename + ".tAA")) {
            Version (40);
            extend = 2;
        }
    } else {
        index = filename.find (".t*");

        if (index != filename.npos) {
            part_flag = true;
            filename.erase (index);

            if (f_exist (filename + ".tAA")) {
                Version (40);
                extend = 2;
            }
        } else {
            part_flag = false;
        }
    }
    if (part_flag) {
        if (exe->Single_Partition ()) {
            filename += Extension (exe->First_Partition ());
            part_flag = false;
            extend = 3;
        }
    } else if (exe->MPI_Size () > 1 && exe->Slave () && File_Access () == CREATE) {
        filename += String (".%d") % exe->MPI_Rank ();
    }
    pathname = filename;

    return (Filename (0));
}
示例#14
0
bool Db_File::Find_File (int part_index)
{
    string name = pathname;

    if (part_flag) {
        part_index = exe->Partition_Number (part_index);
        if (part_index < 0) return (false);
        name += Extension (part_index);
    }
    return (f_exist (name));
}
示例#15
0
bool Load(const std::string& filename,
          const std::string& name,
          T& t,
          const bool fatal,
          format f)
{
  if (f == format::autodetect)
  {
    std::string extension = Extension(filename);

    if (extension == "xml")
      f = format::xml;
    else if (extension == "bin")
      f = format::binary;
    else if (extension == "txt")
      f = format::text;
    else
    {
      if (fatal)
        Log::Fatal << "Unable to detect type of '" << filename << "'; incorrect"
            << " extension?" << std::endl;
      else
        Log::Warn << "Unable to detect type of '" << filename << "'; load "
            << "failed.  Incorrect extension?" << std::endl;

      return false;
    }
  }

  // Now load the given format.
  std::ifstream ifs(filename);
  if (!ifs.is_open())
  {
    if (fatal)
      Log::Fatal << "Unable to open file '" << filename << "'." << std::endl;
    else
      Log::Warn << "Unable to open file '" << filename << "'." << std::endl;

    return false;
  }

  try
  {
    if (f == format::xml)
    {
      boost::archive::xml_iarchive ar(ifs);
      ar >> CreateNVP(t, name);
    }
    else if (f == format::text)
    {
      boost::archive::text_iarchive ar(ifs);
      ar >> CreateNVP(t, name);
    }
 FCFileHandlerBase::FCPtrStore FCFileHandlerBase::read(const BoostPath& FilePath)
 {
	 FCPtrStore Result;
	 //Determine if the file exists
	 if(!boost::filesystem::exists(FilePath))
	 {
		SWARNING << "FCFileHandlerBase::read(): " << FilePath.string() << " does not exists." << std::endl;
		return Result;
	 }

	 std::string filename = initPathHandler(FilePath.string().c_str());

	 //Determine the file extension
	 std::string Extension(boost::filesystem::extension(FilePath));
	 boost::algorithm::trim_if(Extension,boost::is_any_of("."));

     //Get the Parent Directory Path of the file
     _RootFilePath = FilePath;
     _RootFilePath.remove_leaf();

	 //Get the FileType for this extension
	 FCFileTypeP TheFileType(getFileType(Extension, FCFileType::OSG_READ_SUPPORTED));

	 //Is that extension supported for reading
	 if(TheFileType == NULL)
	 {
		SWARNING << "FCFileHandlerBase::read(): Cannot read Field Container file: " << FilePath.string() << ", because no File types support " << Extension <<  " extension." << std::endl;
		return Result;
	 }
	 else
	 {
		 //Open up the input stream of the file
		 std::ifstream InputStream(FilePath.string().c_str(), std::ios::binary);

		 if(!InputStream)
		 {
			SWARNING << "FCFileHandlerBase::read(): Couldn't open input stream for file " << FilePath.string() << std::endl;
			return Result;
		 }
		 else
		 {
             //Read from the input stream
             startReadProgressThread(InputStream);
             Result = TheFileType->read(InputStream, FilePath.string());
             stopReadProgressThread();
             
			 InputStream.close();
		 }
	 }

	 return Result;
 }
示例#17
0
static  void    ArithNewSubr(void) {
//==============================

    if( CITNode->flags & SY_TYPE ) {
        Extension( SR_FUNC_AS_SUB );
        CITNode->sym_ptr->u.ns.flags |= SY_USAGE | SY_SUBPROGRAM | SY_FUNCTION;
    } else {
        ASType |= AST_ALT;
        CITNode->sym_ptr->u.ns.flags |= SY_USAGE | SY_SUBPROGRAM |
                                        SY_SUBROUTINE;
    }
    Arith();
}
示例#18
0
		void Load( const std::string &fileName, const std::string &plugin = std::string("") )
		{
			constexpr const char *dbg_CurFunc = "Toolbox::Image::Load(const std::string &, const std::string &)";

			if ( _PluginMgr.Plugins().empty() )
				throw std::runtime_error( std::string(dbg_CurFunc) + ": No Image plugins loaded!" );

			// Find which plugin we need to load the file with
			if ( !plugin.empty() )
			{
				// If explicitly given, lets use it
				auto ImgPlugin = _PluginMgr.Create< Image_Plugin >( plugin );
				ImgPlugin->Load( fileName, this );
			}
			else
			{
				std::string Extension( Plugin::GetExtFromFilename(fileName) );
				auto Plugins = _PluginMgr.Plugins();

				// If plugin is not provided, we search our plugins for the fileName's extension
				bool Found = false;
				for ( auto p = Plugins.begin(), p_end = Plugins.end(); p != p_end; ++p )
				{
					auto ImgPlugin = _PluginMgr.Create< Image_Plugin >( (*p)->Name() );

					if ( !ImgPlugin )
						throw std::runtime_error( std::string(dbg_CurFunc) + ": Failed to create plugin instance." );

					Image_Plugin::tExtensionList Extensions = ImgPlugin->Extensions();

					for ( auto e = Extensions.begin(), e_end = Extensions.end(); e != e_end; ++e )
					{
						if ( !e->compare(Extension) )
						{
							Found = true;
							ImgPlugin->Load( fileName, this );
							break;
						}
					}

					ImgPlugin.reset();
					Extensions.clear();

					if ( Found )
						break;
				}

				if ( !Found )
					throw std::runtime_error( std::string(dbg_CurFunc) + ": Failed to load image.  Couldn't find a plugin to load '" + Extension + "' files." );
			}
		}
示例#19
0
void    CpCall(void) {
//================

    itnode      *next;
    unsigned_16 sp_type;

    next = CITNode->link;
    if( next->opr == OPR_TRM ) {
        ASType = AST_CNA;       // call with no parameter list
    } else if( ( next->opr == OPR_LBR ) &&
               ( next->opn.ds == DSOPN_PHI ) &&
               ( next->link->opr == OPR_RBR ) &&
               ( next->link->opn.ds == DSOPN_PHI ) &&
               ( next->link->link->opr == OPR_TRM ) ) {
        next->opr = OPR_TRM;    // make CALL SAM() same as CALL SAM
        ASType = AST_CNA;       // call with no parameter list
    } else {
        ReqNextOpr( OPR_LBR, SX_SURP_OPR );
        if( ( SPtr1 != NULL ) && ( SPtr1->link->opr != OPR_TRM ) ) {
            Error( SX_JUNK_AFTER_RBR ); // ignore anything after
            SPtr1->link->opr = OPR_TRM; // closing parenthesis
        }
        ASType = AST_OFF;
    }
    if( ReqName( NAME_SUBROUTINE ) ) {
        LkSym();
        if( ClassIs( SY_SUBPROGRAM ) ) {
            sp_type = CITNode->flags & SY_SUBPROG_TYPE;
            if( sp_type == SY_SUBROUTINE ) {
                ASType |= AST_ALT;
                Arith();
            } else if( sp_type == SY_FUNCTION ) {
                Extension( SR_FUNC_AS_SUB );
                Arith();
            } else if( sp_type == 0 ) {
                ArithNewSubr();
            } else {
                Error( SR_NO_SUBRTN_NAME );
            }
        } else {
            if( CITNode->flags & SY_USAGE ) {
                Error( SR_NO_SUBRTN_NAME );
            } else if( CITNode->flags & SY_SAVED ) {
                Error( SA_SAVED );
            } else {
                ArithNewSubr();
            }
        }
    }
}
示例#20
0
void CpDo( void )
{
// Compile a DO statement.

    signed_32   term;

    AddCSNode( CS_DO );
    term = DoLabel();
    if( term == 0 ) {
        Extension( DO_DO_EXT );
    }
    InitDo( term );
    ColonLabel();
}
示例#21
0
 TableDOMTransitPtr TableFileHandlerBase::forceRead(const BoostPath& FilePath)
 {
	 TableDOMRefPtr Result;
	 //Determine if the file exists
	 if(!boost::filesystem::exists(FilePath))
	 {
		SWARNING << "TableFileHandlerBase::read(): " << FilePath.string() << " does not exists." << std::endl;
		return TableDOMTransitPtr(NULL);
	 }

	 //Determine the file extension
	 std::string Extension(boost::filesystem::extension(FilePath));
	 boost::algorithm::trim_if(Extension,boost::is_any_of("."));

     //Get the Parent Directory Path of the file
     _RootFilePath = FilePath;
     _RootFilePath.remove_leaf();

	 //Get the FileType of a "txt" file (Forcing the document to be opened as a txt file)
	 TableFileTypeP TheFileType(getFileType("csv", TableFileType::OSG_READ_SUPPORTED));

	 //Is that extension supported for reading
	 if(TheFileType == NULL)
	 {
		SWARNING << "TableFileHandlerBase::read(): Cannot read Field Container file: " << FilePath.string() << ", because no File types support " << Extension <<  " extension." << std::endl;
		return TableDOMTransitPtr(NULL);
	 }
	 else
	 {
		 //Open up the input stream of the file
		 std::ifstream InputStream(FilePath.string().c_str(), std::ios::binary);

		 if(!InputStream)
		 {
			SWARNING << "TableFileHandlerBase::read(): Couldn't open input stream for file " << FilePath.string() << std::endl;
			return TableDOMTransitPtr(NULL);
		 }
		 else
		 {
             //Read from the input stream
             startReadProgressThread(InputStream);
             Result = TheFileType->read(InputStream, FilePath.string());
             stopReadProgressThread();
             
			 InputStream.close();
		 }
	 }

	return TableDOMTransitPtr(Result);
 }
示例#22
0
static  bool    DoGenerate( TYPE typ1, TYPE typ2, uint *res_size ) {
//================================================================

    if( CITNode->link->opr == OPR_EQU ) {
        ResultType = typ1;
        *res_size = CITNode->size;
        if( (ASType & AST_ASF) || CkAssignOk() ) return( true );
        return( false );
    } else {
        if( ( ( typ1 == FT_DOUBLE ) && ( typ2 == FT_COMPLEX ) ) ||
            ( ( typ2 == FT_DOUBLE ) && ( typ1 == FT_COMPLEX ) ) ) {
            ResultType = FT_DCOMPLEX;
            *res_size = TypeSize( FT_DCOMPLEX );
            Extension( MD_DBLE_WITH_CMPLX );
        } else if( ( ( typ1 == FT_TRUE_EXTENDED ) && ( typ2 == FT_COMPLEX ) )
            ||     ( ( typ2 == FT_TRUE_EXTENDED ) && ( typ1 == FT_COMPLEX ) )
            ||     ( ( typ1 == FT_TRUE_EXTENDED ) && ( typ2 == FT_DCOMPLEX ) )
            ||     ( ( typ2 == FT_TRUE_EXTENDED ) && ( typ1 == FT_DCOMPLEX ) ) ) {
            ResultType = FT_XCOMPLEX;
            *res_size = TypeSize( FT_XCOMPLEX );
            Extension( MD_DBLE_WITH_CMPLX );
        } else if( ( typ2 > typ1 ) || ( typ1 == FT_STRUCTURE ) || ( typ1 == FT_NO_TYPE ) ) {
            ResultType = typ2;
            *res_size = TypeSize( typ2 );
        } else {
            ResultType = typ1;
            if( _IsTypeInteger( ResultType ) ) {
                *res_size = CITNode->size;
                if( *res_size < CITNode->link->size ) {
                    *res_size = CITNode->link->size;
                }
            } else
                *res_size = TypeSize( typ1 );
        }
        return( true );
    }
}
示例#23
0
bool Ext_File::Filename (char *rootname, int ext_number)
{
	extend = 0;

	if (pathname != NULL) {
		delete [] pathname;
		pathname = NULL;
	}
	extension [0] = '\0';

	Db_File::Filename (NULL);

	if (rootname == NULL) return (false);

	int len = (int) strlen (rootname) + 1;
	pathname = new char [len];
	if (pathname == NULL) return (Status (MEMORY));
	str_cpy (pathname, len, rootname);

	char *str_ptr = strstr (pathname, ".*");

	if (str_ptr != NULL) {
		extend = 1;
		*str_ptr = '\0';
	} else {
		str_ptr = strstr (pathname, ".t*");

		if (str_ptr != NULL) {
			extend = 2;
			*str_ptr = '\0';
		} else {
			extend = 0;
		}
	}
	if (ext_number >= 0 && extend) {
		Extension (ext_number);
		extend = 0;

		len = (int) (strlen (pathname) + strlen (buffer) + 2);
		str_ptr = new char [len];
		if (str_ptr == NULL) return (Status (MEMORY));

		str_fmt (str_ptr, len, "%s.%s", pathname, buffer);

		delete [] pathname;
		pathname = str_ptr;
	}
	return (Filename (0));
}
示例#24
0
EXPORT_C TBool CX509Certificate::IsSelfSignedL() const
	{
	if (iSubjectName->Count() > 0)
		{
		return iSubjectName->ExactMatchL(*iIssuerName);
		}
	else
		{
		TBool res = EFalse;
		const CX509CertExtension* subjectExt = Extension(KIssuerAltName);
		const CX509CertExtension* issuerExt = Extension(KSubjectAltName);
		if ((subjectExt) && (issuerExt))
			{
			const CX509AltNameExt* issuerAltName = CX509AltNameExt::NewLC(subjectExt->Data());
			const CX509AltNameExt* subjectAltName = CX509AltNameExt::NewLC(issuerExt->Data());
			if (subjectAltName->Match(*issuerAltName))
				{
				res = ETrue;
				}
			CleanupStack::PopAndDestroy(2);//subjectAltName, issuerAltName
			}
		return res;
		} 
	}
示例#25
0
int Db_File::Num_Parts (void)
{
    if (part_flag) {
        int num;
        String name;

        for (int part=0; ; part++) {
            num = exe->Partition_Number (part);
            if (num < 0) return (part);
            name = pathname + Extension (num);
            if (!f_exist (name)) return (part);
        }
    } else {
        return (1);
    }
}
示例#26
0
void CpDoWhile( void )
{
// Compile a DO WHILE statement.

    Extension( DO_DO_EXT );
    InitLoop( CS_DO_WHILE );
    CSHead->cs_info.do_term = DoLabel();
    if( RecKeyWord( "WHILE" ) ) {
        RemKeyword( CITNode, 5 );
        CSCond( CSHead->bottom );
        BlockLabel();
    } else {
        if( ReqNOpn() ) {
            BlockLabel();
        }
    }
}
示例#27
0
static  void    ScanningFunction( void ) {
//==========================

// Must be scanning a function.

    if( CITNode->flags & SY_PS_ENTRY ) {
        Extension( SR_TRIED_RECURSION );
    } else if( CITNode->flags & ( SY_USAGE | SY_DO_PARM | SY_IN_EC ) ) {
        IllName( CITNode->sym_ptr );
    } else if( CITNode->flags & SY_SAVED ) {
        Error( SA_SAVED );
    } else {
        CkIntrinsic();
        CITNode->flags |= SY_SUBPROGRAM | SY_FUNCTION;
        SetTypeUsage( SY_TYPE | SY_USAGE );
    }
}
示例#28
0
文件: filter.hpp 项目: DingKe/vexcl
    /// List of device filters based on environment variables.
    inline std::vector< std::function<bool(const boost::compute::device&)> >
    backend_env_filters()
    {
        std::vector< std::function<bool(const boost::compute::device&)> > filter;

        const char *platform  = boost::compute::detail::getenv("OCL_PLATFORM");
        const char *vendor    = boost::compute::detail::getenv("OCL_VENDOR");
        const char *name      = boost::compute::detail::getenv("OCL_DEVICE");
        const char *devtype   = boost::compute::detail::getenv("OCL_TYPE");
        const char *extension = boost::compute::detail::getenv("OCL_EXTENSION");

        if (platform)  filter.push_back(Platform(platform));
        if (vendor)    filter.push_back(Vendor(vendor));
        if (name)      filter.push_back(Name(name));
        if (devtype)   filter.push_back(Type(devtype));
        if (extension) filter.push_back(Extension(extension));

        return filter;
    }
示例#29
0
static  void    NumOrLit( FCODE routine ) {
//===============================================

    if( RecNOpn() ) {
        AdvanceITPtr();
    }
    if( RecNOpn() ) {
        GBreak( routine );
    } else if( !RecLiteral() ) {
        if( CITNode->opn.ds == DSOPN_INT ) {
            if( CITNode->opnd_size > 5 ) {
                Extension( ST_LONG_NUM, StmtKeywords[ StmtProc ] );
            }
            BreakOpn( routine );
        } else {
            Error( SX_NUM_OR_LIT );
        }
    } else {
        BreakOpn( routine );
    }
}
void CreateImageFromFile( const Diligent::Char *FilePath, 
                          Image **ppImage,
                          IDataBlob **ppDDSData)
{
    auto *pDotPos = strrchr( FilePath, '.' );
    if( pDotPos == nullptr )
        LOG_ERROR_AND_THROW( "File path ", FilePath, " does not contain extension" );

    auto *pExtension = pDotPos + 1;
    if( *pExtension == 0 )
        LOG_ERROR_AND_THROW( "File path ", FilePath, " contains empty extension" );

    String Extension(pExtension);
    std::transform( Extension.begin(), Extension.end(), Extension.begin(), ::tolower );

    Diligent::RefCntAutoPtr<BasicFileStream> pFileStream( new BasicFileStream( FilePath, EFileAccessMode::Read ) );

    if( Extension == "dds" )
    {
        VERIFY_EXPR(ppDDSData != nullptr);
        *ppDDSData = new DataBlobImpl;
        pFileStream->Read(*ppDDSData);
        (*ppDDSData)->AddRef();
    }
    else
    {
        ImageLoadInfo ImgLoadInfo;
        if( Extension == "png" )
            ImgLoadInfo.Format = EImageFileFormat::png;
        else if( Extension == "jpeg" || Extension == "jpg" )
            ImgLoadInfo.Format = EImageFileFormat::jpeg;
        else if( Extension == "tiff" || Extension == "tif" )
            ImgLoadInfo.Format = EImageFileFormat::tiff;
        else
            LOG_ERROR_AND_THROW( "Unsupported file format ", Extension );

        *ppImage = new Image(pFileStream, ImgLoadInfo);
        (*ppImage)->AddRef();
    }
}