CSSM_RETURN CSSMAPI
CSSM_CSP_CreateDeriveKeyContext (CSSM_CSP_HANDLE CSPHandle,
                                 CSSM_ALGORITHMS AlgorithmID,
                                 CSSM_KEY_TYPE DeriveKeyType,
                                 uint32 DeriveKeyLengthInBits,
                                 const CSSM_ACCESS_CREDENTIALS *AccessCred,
                                 const CSSM_KEY *BaseKey,
                                 uint32 IterationCount,
                                 const CSSM_DATA *Salt,
                                 const CSSM_CRYPTO_DATA *Seed,
                                 CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(DeriveKeyType, CSSMERR_CSP_INVALID_ATTR_KEY_TYPE);
    maker.setup(DeriveKeyLengthInBits, CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH);
    maker.setup(AccessCred);
    maker.setup(BaseKey);
    maker.setup(IterationCount);
    maker.setup(Salt);
    maker.setup(Seed);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_KEY_TYPE, DeriveKeyType);
    maker.put(CSSM_ATTRIBUTE_KEY_LENGTH, DeriveKeyLengthInBits);
    maker.put(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS, AccessCred);
    maker.put(CSSM_ATTRIBUTE_KEY, BaseKey);
    maker.put(CSSM_ATTRIBUTE_ITERATION_COUNT, IterationCount);
    maker.put(CSSM_ATTRIBUTE_SALT, Salt);
    maker.put(CSSM_ATTRIBUTE_SEED, Seed);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_DERIVEKEY, AlgorithmID);
    END_API(CSSM)
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateKeyGenContext (CSSM_CSP_HANDLE CSPHandle,
                              CSSM_ALGORITHMS AlgorithmID,
                              uint32 KeySizeInBits,
                              const CSSM_CRYPTO_DATA *Seed,
                              const CSSM_DATA *Salt,
                              const CSSM_DATE *StartDate,
                              const CSSM_DATE *EndDate,
                              const CSSM_DATA *Params,
                              CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(KeySizeInBits, CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH);
    maker.setup(Seed);
    maker.setup(Salt);
    maker.setup(StartDate);
    maker.setup(EndDate);
    maker.setup(Params);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_KEY_LENGTH, KeySizeInBits);
    maker.put(CSSM_ATTRIBUTE_SEED, Seed);
    maker.put(CSSM_ATTRIBUTE_SALT, Salt);
    maker.put(CSSM_ATTRIBUTE_START_DATE, StartDate);
    maker.put(CSSM_ATTRIBUTE_END_DATE, EndDate);
    maker.put(CSSM_ATTRIBUTE_ALG_PARAMS, Params);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_KEYGEN, AlgorithmID);
    END_API(CSSM)
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateDigestContext (CSSM_CSP_HANDLE CSPHandle,
                              CSSM_ALGORITHMS AlgorithmID,
                              CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.make();
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_DIGEST, AlgorithmID);
    END_API(CSSM)
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreatePassThroughContext (CSSM_CSP_HANDLE CSPHandle,
                                   const CSSM_KEY *Key,
                                   CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(Key, CSSMERR_CSP_MISSING_ATTR_KEY);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_KEY, Key);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_NONE, CSSM_ALGID_NONE);
    END_API(CSSM)
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateMacContext (CSSM_CSP_HANDLE CSPHandle,
                           CSSM_ALGORITHMS AlgorithmID,
                           const CSSM_KEY *Key,
                           CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(Key, CSSMERR_CSP_MISSING_ATTR_KEY);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_KEY, Key);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_MAC, AlgorithmID);
    END_API(CSSM)
}
void WikiAreaPages::createAreaPages_createRegionPages( String wikiDir , MindArea *area ) {
	MapStringToClass<MindRegion>& regions = area -> getRegions();
	for( int k = 0; k < regions.count(); k++ ) {
		WikiRegionPage maker( wm , wikiDir , regions.getClassByIndex( k ) );
		maker.execute();
	}
}
Beispiel #7
0
//装备打造
void equip_make(SceneUser* user,DWORD thisID,bool drop,int flag)
{
    EquipMaker maker(NULL);
    zObject* o = goi->getObjectByThisid(thisID);
    if(o)
        maker.assign(user,o,o->base,1);
}
Beispiel #8
0
/** Read from a file */
static int NcFile__init(PyClass<NcFile> *self, PyObject *args, PyObject *kwds)
{
	try {
		// Get arguments
		char *fname_py = NULL;
		char *filemode_py = NULL;
		if (!PyArg_ParseTuple(args, "ss", &fname_py, &filemode_py)) {
			// Throw an exception...
			PyErr_SetString(PyExc_ValueError,
				"Bad arguments to NcFile_save().");
			return 0;
		}

		auto mode = ((strcmp(filemode_py, "w") == 0) ?
			NcFile::Replace : NcFile::ReadOnly);

		// Instantiate C++ NcFile
		std::unique_ptr<NcFile> maker(new NcFile(fname_py, mode));

		// Move it to Python NcFile object.
		self->init(std::move(maker));
		return 0;
	} catch(...) {
		PyErr_SetString(PyExc_ValueError, "Error in NcFile__init()");
		return 0;
	}
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateRandomGenContext (CSSM_CSP_HANDLE CSPHandle,
                                 CSSM_ALGORITHMS AlgorithmID,
                                 const CSSM_CRYPTO_DATA *Seed,
                                 CSSM_SIZE Length,
                                 CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(Seed);
    maker.setup(Length, CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_SEED, Seed);
    maker.put(CSSM_ATTRIBUTE_OUTPUT_SIZE, Length);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_RANDOMGEN, AlgorithmID);
    END_API(CSSM)
}
//
// Context management functions
//
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateSignatureContext (CSSM_CSP_HANDLE CSPHandle,
                                 CSSM_ALGORITHMS AlgorithmID,
                                 const CSSM_ACCESS_CREDENTIALS *AccessCred,
                                 const CSSM_KEY *Key,
                                 CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(AccessCred);
    maker.setup(Key, CSSMERR_CSP_MISSING_ATTR_KEY);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS, AccessCred);
    maker.put(CSSM_ATTRIBUTE_KEY, Key);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_SIGNATURE, AlgorithmID);
    END_API(CSSM)
}
Beispiel #11
0
void assign_set(DWORD thisid)
{
    zObject* o = goi->getObjectByThisid(thisid);
    if(o)
    {
        EquipMaker maker(NULL);
        maker.assign_set(o);
    }
}
Beispiel #12
0
JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc,
                                    jsval *argv, jsval *rval)
{
    SkJSDisplayable *p = (SkJSDisplayable*) JS_GetPrivate(cx, obj);
    SkASSERT(p->fDisplayable->isDrawable());
    SkDrawable* drawable = (SkDrawable*) p->fDisplayable;
    SkAnimateMaker maker(NULL, gCanvas, gPaint);
    drawable->draw(maker);
    return JS_TRUE;
}
Beispiel #13
0
CWGSDataLoader::TRegisterLoaderInfo CWGSDataLoader::RegisterInObjectManager(
    CObjectManager& om,
    CObjectManager::EIsDefault is_default,
    CObjectManager::TPriority priority)
{
    SLoaderParams params;
    TMaker maker(params);
    CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
    return maker.GetRegisterInfo();
}
Beispiel #14
0
sk_sp<SkImage> SkImage::makeTextureImage(GrContext *context) const {
    if (!context) {
        return nullptr;
    }
    if (GrTexture* peek = as_IB(this)->peekTexture()) {
        return peek->getContext() == context ? sk_ref_sp(const_cast<SkImage*>(this)) : nullptr;
    }

    if (SkImageCacherator* cacher = as_IB(this)->peekCacherator()) {
        GrImageTextureMaker maker(context, cacher, this, kDisallow_CachingHint);
        return create_image_from_maker(&maker, this->alphaType(), this->uniqueID());
    }

    if (const SkBitmap* bmp = as_IB(this)->onPeekBitmap()) {
        GrBitmapTextureMaker maker(context, *bmp);
        return create_image_from_maker(&maker, this->alphaType(), this->uniqueID());
    }
    return nullptr;
}
Beispiel #15
0
CAsnCache_DataLoader::TRegisterLoaderInfo CAsnCache_DataLoader::RegisterInObjectManager(
    CObjectManager& om,
    const string& db_path,
    CObjectManager::EIsDefault is_default,
    CObjectManager::TPriority priority)
{
    TDbMaker maker(db_path);
    CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
    return maker.GetRegisterInfo();
}
CSSM_RETURN CSSMAPI
CSSM_CSP_CreateAsymmetricContext (CSSM_CSP_HANDLE CSPHandle,
                                  CSSM_ALGORITHMS AlgorithmID,
                                  const CSSM_ACCESS_CREDENTIALS *AccessCred,
                                  const CSSM_KEY *Key,
                                  CSSM_PADDING Padding,
                                  CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.setup(AccessCred, CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS);
    maker.setup(Key, CSSMERR_CSP_MISSING_ATTR_KEY);
    maker.setup(Padding);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS, AccessCred);
    maker.put(CSSM_ATTRIBUTE_KEY, Key);
    maker.put(CSSM_ATTRIBUTE_PADDING, Padding);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_ASYMMETRIC, AlgorithmID);
    END_API(CSSM)
}
Beispiel #17
0
sk_sp<SkImage> SkImage::makeTextureImage(GrContext *context) const {
    if (!context) {
        return nullptr;
    }
    if (GrTexture* peek = as_IB(this)->peekTexture()) {
        return peek->getContext() == context ? sk_ref_sp(const_cast<SkImage*>(this)) : nullptr;
    }
    // No way to check whether a image is premul or not?
    SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;

    if (SkImageCacherator* cacher = as_IB(this)->peekCacherator()) {
        GrImageTextureMaker maker(context, cacher, this, kDisallow_CachingHint);
        return create_image_from_maker(&maker, at, this->uniqueID());
    }
    SkBitmap bmp;
    if (!this->asLegacyBitmap(&bmp, kRO_LegacyBitmapMode)) {
        return nullptr;
    }
    GrBitmapTextureMaker maker(context, bmp);
    return create_image_from_maker(&maker, at, this->uniqueID());
}
Beispiel #18
0
CSRADataLoader::TRegisterLoaderInfo CSRADataLoader::RegisterInObjectManager(
    CObjectManager& om,
    const string& rep_path,
    const string& vol_path,
    CObjectManager::EIsDefault is_default,
    CObjectManager::TPriority priority)
{
    SLoaderParams params;
    params.m_RepPath = rep_path;
    params.m_VolPath = vol_path;
    TMaker maker(params);
    CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
    return maker.GetRegisterInfo();
}
Beispiel #19
0
bool Include::MakeMakefiles(bool Silent)
{
    Maker maker(Silent, false, false, false);
    for (auto goal : *this)
    {
        maker.AddGoal(goal);
    }
    for (auto file : ignoredFiles)
    {
        maker.SetIgnoreFailed(file);
    }
    maker.CreateDependencyTree();
    return maker.RunCommands();
}
/**
 * \brief 根据物品id调整物品在包裹中的数量,如果大于该物品最大数量则创建一个新物品
 * \param user: 要改变包裹的用户
 * \param id: 物品的objectid
 * \param number: 增加的数量
 * \param orig_ob: 数量被改变的物品,如果没有物品数量被改变,该参数被忽略
 * \param new_obs: 新创建的物品的列表,如果没有物品被创建,该参数被忽略
 * \param upgrade: 物品等级
 * \author lqy
 * \return 失败返回-1, 没有物品被创建返回0, 包裹满返回1, 成功添加所有创建的物品返回2
 */
int UserObjectM::addObjectNum(SceneUser* user, DWORD id, DWORD number, zObject* & orig_ob, Obj_vec& new_obs, BYTE upgrade)
{
	//check if exist this object id
	zObjectB* o = objectbm.get(id);
	if (!o) {
		return -1;
	}
	
	DWORD capacity = o->maxnum;
	
	//check if we have a instance of this object which havn't reached max number
	zObject* ob = getObjectByID(id, upgrade);
	if (ob) {
		number += ob->data.dwNum;
		if (capacity >= number) { //have enough space to put this 
			ob->data.dwNum = number;			
			orig_ob = ob;
			return 0;
		}else { //space isn't enough, set max number first, then create new object
			ob->data.dwNum = capacity;
			number -= capacity;
			orig_ob = ob;
		}
	}
	
	while ((int)number > 0) {
		zObject *tmp = zObject::create(o, (number>=capacity)?capacity:number, upgrade);
		if (tmp) {
			EquipMaker maker(NULL);
			maker.assign(NULL, tmp, tmp->base);
			
			if (user->packs.addObject(tmp, true, AUTO_PACK)) {
				//如果是双倍经验道具和荣誉道具需要绑定
				if(tmp->base->kind == ItemType_DoubleExp || tmp->base->kind == ItemType_Honor || tmp->base->kind == ItemType_ClearProperty)
				{
					tmp->data.bind=1;
				}
			zObject::logger(tmp->createid,tmp->data.qwThisID,tmp->data.strName,tmp->data.dwNum,tmp->data.dwNum,1,0,NULL,user->id,user->name,"新增",tmp->base,tmp->data.kind,tmp->data.upgrade);
				new_obs.push_back(tmp);		
			}else {
				//maybe package is full, stop process, but still return true
				zObject::destroy(tmp);	
				return 1;
			}
		}
		number -= capacity;
	}
	
	return 2;
}
Beispiel #21
0
void MazeWindow::createMaze() {
  
  auto selected = algorithmSelector->currentText();
  auto factory = MakerFactory::byName(selected);
  
  maker = factory->maker();

  int w,h;
  w = h = dimensionSetter->value();
  stepCount = 0;
  maker->setGrid(Grid(w,h));
  mazeWidget->setMaker(maker);
  mazeWidget->setColorizer(factory->colorizer());
  mazeWidget->repaint();
}
Beispiel #22
0
void makeRawTree(const Char_t* rawfilename,
                 const Char_t* outdir) {
   
   TSnRawTreeMaker maker(rawfilename, outdir);
   
   Printf("Making file [%s].",maker.GetTreeFilename().Data());
   
   maker.ProcFile();
   
   Printf("Wrote: %lld events, %lld power readings, %lld heartbeats.",
          maker.GetNevtsWritten(),
          maker.GetNpwrsWritten(),
          maker.GetNhrtsWritten());
   
}
Beispiel #23
0
    /**
     * @brief RelationFactory::make
     * @param relType
     * @param tail
     * @param head
     * @param addToScene
     * @return
     */
    SharedRelation RelationFactory::make(RelationType relType, const common::ID &tail,
                                         const common::ID &head, CreationOptions options) const
    {
        if (auto pr = G_ASSERT(project())) {
            if (G_ASSERT(pr->database() && project()->globalDatabase())) {
                if (auto maker = G_ASSERT(relationMaker[relType])) {
                    if (auto relation = maker(tail, head, {pr->database(), pr->globalDatabase()})) {
                        addRelation(relation, pr->database(), scene(), options);
                        return relation;
                    }
                }
            }
        }

        return nullptr;
    }
Beispiel #24
0
/**
 * Loads the given plugin from the specified library, including its
 * construction and destruction functions.
 *
 * @param filepath full file path to the dynamic library containing the plugin
 * @param classname the full name of the class comprising the conversion plugin
 * @throws std::runtime_error
 */
void Plugin::load(const std::string& filepath, const std::string& classname)
{
    const char *dlsym_error = dlerror();        // Reset error indicator

    // Attempt to open the library
    dll_ = std::shared_ptr<void>(dlopen(filepath.c_str(), RTLD_LAZY), dlclose);
    dlsym_error = dlerror();
    if (!dll_ || dlsym_error) {
        throw std::runtime_error("Failed to open library " + filepath +
                " (" + std::string(dlsym_error) + ")");
    }

    // Construct the name of the factory function (make_PluginName)
    std::string maker("make_" + classname);
    // then try to open it
    typedef SequenceConverter* (*maker_type)();
    maker_type create_converter = (maker_type) dlsym(dll_.get(), maker.c_str());
    dlsym_error = dlerror();
    if (dlsym_error) {
        throw std::runtime_error("Failed to load plugin function " + maker +
                " ( " + std::string(dlsym_error) + ")");
    }

    // Construct the name of the plugin destruction function (destroy_PluginName)
    std::string destroyer = "destroy_" + classname;
    // then try to open it
    typedef void (*destroyer_type)(SequenceConverter *);
    destroyer_type destroy_converter = (destroyer_type) dlsym(dll_.get(), destroyer.c_str());
    dlsym_error = dlerror();
    if (dlsym_error) {
        throw std::runtime_error("Failed to load plugin function " + destroyer +
                " (" + std::string(dlsym_error) + ")");
    }

    // Make `new` SequenceConverter class from DLL
    try {
        converter_ = std::shared_ptr<SequenceConverter>(create_converter(), destroy_converter);
    } catch (const std::exception& e) {
        throw std::runtime_error("Failed to create converter (" + std::string(e.what()) + ")");
    }
}
Beispiel #25
0
    /**
     * @brief RelationFactory::make
     * @param src
     * @param addToScene
     * @return
     */
    SharedRelation RelationFactory::make(const QJsonObject &src, ErrorList &errors,
                                         CreationOptions options) const
    {
        if (src.contains(relationship::Relation::typeMarker())) {
            auto relType = RelationType(src[relationship::Relation::typeMarker()].toInt());
            if (auto maker = G_ASSERT(relationMaker[relType])) {
                db::WeakTypeSearchers ts {G_ASSERT(project())->database(), G_ASSERT(project())->globalDatabase()};
                if (auto relation = maker(common::ID::nullID(), common::ID::nullID(), ts)) {
                    relation->fromJson(src, errors);

                    if (errors.isEmpty()) {
                        addRelation(relation, G_ASSERT(project())->database(), scene(), options);
                        return relation;
                    } else {
                        qWarning() << "Relation was loaded with errors.";
                    }
                }
            }
        }

        return nullptr;
    }
//
// InternalRequirements
//
void InternalRequirements::operator () (const Requirements *given, const Requirements *defaulted, const Requirement::Context &context)
{
	// first add the default internal requirements
	if (defaulted) {
		this->add(defaulted);
		::free((void *)defaulted);		// was malloc(3)ed by DiskRep
	}
	
	// now override them with any requirements explicitly given by the signer
	if (given)
		this->add(given);

	// now add the Designated Requirement, if we can make it and it's not been provided
	if (!this->contains(kSecDesignatedRequirementType)) {
		DRMaker maker(context);
		if (Requirement *dr = maker.make()) {
			this->add(kSecDesignatedRequirementType, dr);		// takes ownership of dr
		}
	}
	
	// return the result
	mReqs = this->make();
}
Beispiel #27
0
PMonsterAI MonsterAIFactory::getMonsterAI(Creature* c) {
  return PMonsterAI(maker(c));
}
Beispiel #28
0
int MakeMain::Run(int argc, char **argv, char **env)
{
    char *p = getenv("MAKEFLAGS");
    if (p)
    {
        Variable *v = new Variable("MAKEFLAGS", p, Variable::f_recursive, Variable::o_environ);
        *VariableContainer::Instance() += v;
        p = getenv("MAKEOVERRIDES");
        if (p)
        {
            Variable *v = new Variable("MAKEOVERRIDES", p, Variable::f_recursive, Variable::o_environ);
            *VariableContainer::Instance() += v;
        }
        Eval r(v->GetValue(), false);
        std::string cmdLine = r.Evaluate();
        Dispatch(cmdLine.c_str());
    }
    if (!switchParser.Parse(&argc, argv) || help.GetValue() || help2.GetValue())
    {
        Utils::banner(argv[0]);
        Utils::usage(argv[0], usageText);
    }
    if (dir.GetValue().size())
    {
        cwd = OS::GetWorkingDir();
        if (!OS::SetWorkingDir(dir.GetValue()))
        {
            std::cout << "Cannot set working dir to: " << dir.GetValue() << std::endl;
            return 2;
        }
    }
    if (printDir.GetValue())
    {
        std::cout << OS::GetWorkingDir() << std::endl;
    }
    if (cancelKeep.GetValue())
    {
        cancelKeep.SetValue(false);
        keepGoing.SetValue(false);
    }
    
    bool done = false;
    Eval::Init();
    Eval::SetWarnings(warnUndef.GetValue());
    while (!done && !Eval::GetErrCount())
    {
        VariableContainer::Instance()->Clear();
        RuleContainer::Instance()->Clear();
        Include::Instance()->Clear();
        Maker::ClearFirstGoal();
        LoadEnvironment(env);
        LoadCmdDefines();
        SetVariable("MAKE", argv[0], Variable::o_environ, false);
        Variable *v = VariableContainer::Instance()->Lookup("SHELL");
        if (!v)
        {
            v = VariableContainer::Instance()->Lookup("COMSPEC");
            if (!v)
                v = VariableContainer::Instance()->Lookup("ComSpec");
            if (v)
            {
                std::string val = v->GetValue();
                SetVariable("SHELL", val, Variable::o_environ, true);
            }
        }
        std::string goals;
        for (int i=1; i < argc; i++)
        {
            if (goals.size())
                goals += " ";
            goals += argv[i];
        }
        SetVariable("MAKECMDGOALS", goals, Variable::o_command_line, false);
        SetMakeFlags();
        if (restarts)
        {
            std::strstream str;
            std::string temp;
            str << restarts;
            str >> temp;
            SetVariable("MAKE_RESTARTS", temp, Variable::o_command_line, false);
        }
        v = VariableContainer::Instance()->Lookup("MAKE_LEVEL");
        if (!v)
        {
            SetVariable("MAKE_LEVEL", "0", Variable::o_environ, true);
        }
        else
        {
            std::strstream str;
            std::string temp;
            str << v->GetValue();
            int n;
            str >> n;
            n++;
            str <<  n;
            str >> temp;
            v->SetValue(temp);
        }
        SetVariable(".FEATURES","second-expansion order-only target-specific", Variable::o_environ, false);
        SetVariable(".DEFAULT_GOAL","", Variable::o_environ, false);
        SetVariable(".INCLUDE_DIRS",includes.GetValue(), Variable::o_command_line, false);
        SetVariable("VPATH",includes.GetValue(), Variable::o_environ, false);
        SetInternalVars();		
        v = VariableContainer::Instance()->Lookup("MAKEFILES");
        if (v)
        {
            v->SetExport(true);
            Include::Instance()->AddFileList(v->GetValue(), true, true);
        }
        Rule *rule = new Rule(".SUFFIXES", ".c .o .cpp .nas .asm", "", new Command("", 0), "", 0, false);
        RuleList *ruleList = new RuleList(".SUFFIXES");
        ruleList->Add(rule, false);
        *RuleContainer::Instance() += ruleList;
        std::string files = specifiedFiles.GetValue();
        if (!files.size())
            files = "makefile";
        Include::Instance()->AddFileList(files, false, false);
        SetupImplicit();
        RuleContainer::Instance()->SecondaryEval();
        done = !Include::Instance()->MakeMakefiles(silent.GetValue());
        if (!done)
            restarts++;
    }
    if (showDatabase.GetValue())
        ShowDatabase();
    int rv = 0;
    if (Eval::GetErrCount())
    {
        rv = 2;
    }
    else
    {
        bool xsilent = silent.GetValue();
        bool xignore = ignoreErrors.GetValue();
        bool xdontrun = displayOnly.GetValue();
        bool xtouch = touch.GetValue();
        xdontrun |= xtouch || query.GetValue();
        xsilent |= xtouch || query.GetValue();
        Maker maker(xsilent, xdontrun, xignore, xtouch, rebuild.GetValue(), newFiles.GetValue(), oldFiles.GetValue());
        for (int i = 1; i < argc; i++)
        {
            maker.AddGoal(argv[i]);
        }
        if (maker.CreateDependencyTree())
        {
            rv = maker.RunCommands(keepGoing.GetValue());
            if (query.GetValue() && rv == 0)
                rv = maker.HasCommands() ? 1 : 0;
        }
        else
        {
            rv = 2;
        }
    }
    if (dir.GetValue().size())
    {
        OS::SetWorkingDir(cwd);
    }
    if (printDir.GetValue())
    {
        std::cout << OS::GetWorkingDir() << std::endl;
    }
    return rv;
}
Beispiel #29
0
static bool
makerooms(void)
{
struct rectangle *rsp;
int lx, ly, hx, hy, lowx, lowy, hix, hiy, dx, dy;
int tryct = 0, xlim, ylim;

	/* init */
	xlim = XLIM + secret;
	ylim = YLIM + secret;
	if(nroom == 0) {
		rsp = rs;
		rsp->rlx = rsp->rly = 0;
		rsp->rhx = COLNO-1;
		rsp->rhy = ROWNO-1;
		rsmax = 1;
	}
	rscnt = rsmax;

	/* make rooms until satisfied */
	while(rscnt > 0 && nroom < MAXNROFROOMS-1) {
		if(!secret && nroom > (MAXNROFROOMS/3) &&
		   !rn2((MAXNROFROOMS-nroom)*(MAXNROFROOMS-nroom)))
			return(0);

		/* pick a rectangle */
		rsp = &rs[rn2(rscnt)];
		hx = rsp->rhx;
		hy = rsp->rhy;
		lx = rsp->rlx;
		ly = rsp->rly;

		/* find size of room */
		if(secret)
			dx = dy = 1;
		else {
			dx = 2 + rn2((hx-lx-8 > 20) ? 12 : 8);
			dy = 2 + rn2(4);
			if(dx*dy > 50)
				dy = 50/dx;
		}

		/* look whether our room will fit */
		if(hx-lx < dx + dx/2 + 2*xlim || hy-ly < dy + dy/3 + 2*ylim) {
					/* no, too small */
					/* maybe we throw this area out */
			if(secret || !rn2(MAXNROFROOMS+1-nroom-tryct)) {
				rscnt--;
				rs[rsmax] = *rsp;
				*rsp = rs[rscnt];
				rs[rscnt] = rs[rsmax];
				tryct = 0;
			} else
				tryct++;
			continue;
		}

		lowx = lx + xlim + rn2(hx - lx - dx - 2*xlim + 1);
		lowy = ly + ylim + rn2(hy - ly - dy - 2*ylim + 1);
		hix = lowx + dx;
		hiy = lowy + dy;

		if(maker(lowx, dx, lowy, dy)) {
			if(secret)
				return(1);
			addrs(lowx-1, lowy-1, hix+1, hiy+1);
			tryct = 0;
		} else
			if(tryct++ > 100)
				break;
	}
	return(0);	/* failed to make vault - very strange */
}
    BEGIN_API
    if (Reserved != NULL)
        CssmError::throwMe(CSSM_ERRCODE_INVALID_POINTER);
    HandleContext::Maker maker(CSPHandle);
    maker.setup(Mode);
    maker.setup(AccessCred);
    maker.setup(Key);
    maker.setup(InitVector);
    maker.setup(Padding);
    maker.make();
    maker.put(CSSM_ATTRIBUTE_MODE, Mode);
    maker.put(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS, AccessCred);
    maker.put(CSSM_ATTRIBUTE_KEY, Key);
    maker.put(CSSM_ATTRIBUTE_INIT_VECTOR, InitVector);
    maker.put(CSSM_ATTRIBUTE_PADDING, Padding);
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_SYMMETRIC, AlgorithmID);
    END_API(CSSM)
}


CSSM_RETURN CSSMAPI
CSSM_CSP_CreateDigestContext (CSSM_CSP_HANDLE CSPHandle,
                              CSSM_ALGORITHMS AlgorithmID,
                              CSSM_CC_HANDLE *NewContextHandle)
{
    BEGIN_API
    HandleContext::Maker maker(CSPHandle);
    maker.make();
    Required(NewContextHandle) = maker(CSSM_ALGCLASS_DIGEST, AlgorithmID);
    END_API(CSSM)
}