Example #1
0
ptcgen_t *Generators::linkToList(ptcgen_t *gen, uint listIndex)
{
    DENG_ASSERT(listIndex < d->listsSize);

    // Sanity check - generator is one from this collection.
    DENG_ASSERT(generatorId(gen) >= 0);

    // Must check that it isn't already there...
    for(ListNode *it = d->lists[listIndex]; it; it = it->next)
    {
        if(it->gen == gen)
        {
            // Warning message disabled as these are occuring so thick and fast
            // that logging is pointless (and negatively affecting performance).
            //LOG_AS("Generators::linkToList");
            //LOG_DEBUG("Attempted repeat link of generator %p to list %u.")
            //        << de::dintptr(gen) << listIndex;

            return gen; // No, no...
        }
    }

    // We need a new link.
    if(ListNode *link = d->newLink())
    {
        link->gen = gen;
        link->next = d->lists[listIndex];
        d->lists[listIndex] = link;
    }

    return gen;
}
Example #2
0
//读取用户输入的信息,我们将会得到用户的身份证号码,密码,开户的余额
int main_getServiceId(int* serviceId,struct account* acc){
	printf("请输入需要办理的业务编号\n");
	scanf(" %d",serviceId);
	int res;
	switch(*serviceId){
		case 1:printf("您正在办理开户业务\n");
			   do{
				   res = getUserData(acc);
				   if(-1 == res)
					   puts("您的输入有误\n");
			   }while(-1 == res);
				acc->idNum = generatorId();
			   return 0;
		case 2:printf("您正在办理销户业务\n");
			   return 0;
		case 3:printf("您正在办理存款业务\n");
			   return 0;
		case 4:printf("您正在办理取款业务\n");
			   return 0;
		case 5:printf("您正在办理查询业务\n");
			   return 0;
		case 6:printf("您正在办理转帐业务\n");
			   return 0;
		case 0:printf("正在退出系统\n");
			   exit(0);
			   return 0;
		defult:printf("您的输入有误\n");
			   return -1;
	}

}
Example #3
0
ptcgen_t *Generators::link(ptcgen_t *gen, ptcgenid_t slot)
{
    if(gen && slot < GENERATORS_MAX)
    {
        // Sanity check - generator is not already linked.
        DENG_ASSERT(generatorId(gen) < 0);

        d->activeGens[slot] = gen;
    }
    return gen;
}