Example #1
0
bool permission_setMember(const char* name)
{
  User* tempuser = userFromName(std::string(name));
  if (tempuser == NULL)
  {
    return false;
  }
  tempuser->permissions = 0; // reset any previous permissions
  SET_MEMBER(tempuser->permissions);
  return true;
}
Example #2
0
bool permission_setMember(const char* name)
{
  User* tempuser = User::byNick(name);
  if (tempuser == NULL)
  {
    return false;
  }
  tempuser->permissions = 0; // reset any previous permissions
  SET_MEMBER(tempuser->permissions);
  return true;
}
Example #3
0
void NOT( ADNFClause dst)
{
	ADNFClause oldChainHead;
	ADNFClause newORClause;	//each previously AND clause becomes an OR clause
	int i;

	oldChainHead->next= dst->next;
	oldChainHead->prev= 0;
	
	dst->next=0;
	InitAndClauseLinkedList(&newORClause);
	
	for (oldChainHead= oldChainHead->next; oldChainHead; oldChainHead= oldChainHead->next)
	{
		for (i=0; i<ASET_SIZE; i++)
			if (SET_MEMBER(oldChainHead->set, i))
				AddClause(newORClause, SET_ADDE(0, SET_INDEX_NEGATE(i)));

		AND(dst, newORClause);
		ClearDNFClause(newORClause);
	}
}
Example #4
0
static void
and_pullup(struct block *b)
{
	int val, at_top;
	struct block *pull;
	struct block **diffp, **samep;
	struct edge *ep;

	ep = b->in_edges;
	if (ep == 0)
		return;

	/*
	 * Make sure each predecessor loads the same value.
	 */
	val = ep->pred->val[A_ATOM];
	for (ep = ep->next; ep != 0; ep = ep->next)
		if (val != ep->pred->val[A_ATOM])
			return;

	if (JT(b->in_edges->pred) == b)
		diffp = &JT(b->in_edges->pred);
	else
		diffp = &JF(b->in_edges->pred);

	at_top = 1;
	while (1) {
		if (*diffp == 0)
			return;

		if (JF(*diffp) != JF(b))
			return;

		if (!SET_MEMBER((*diffp)->dom, b->id))
			return;

		if ((*diffp)->val[A_ATOM] != val)
			break;

		diffp = &JT(*diffp);
		at_top = 0;
	}
	samep = &JT(*diffp);
	while (1) {
		if (*samep == 0)
			return;

		if (JF(*samep) != JF(b))
			return;

		if (!SET_MEMBER((*samep)->dom, b->id))
			return;

		if ((*samep)->val[A_ATOM] == val)
			break;

		/* XXX Need to check that there are no data dependencies
		   between diffp and samep.  Currently, the code generator
		   will not produce such dependencies. */
		samep = &JT(*samep);
	}
#ifdef notdef
	/* XXX This doesn't cover everything. */
	for (i = 0; i < N_ATOMS; ++i)
		if ((*samep)->val[i] != pred->val[i])
			return;
#endif
	/* Pull up the node. */
	pull = *samep;
	*samep = JT(pull);
	JT(pull) = *diffp;

	/*
	 * At the top of the chain, each predecessor needs to point at the
	 * pulled up node.  Inside the chain, there is only one predecessor
	 * to worry about.
	 */
	if (at_top) {
		for (ep = b->in_edges; ep != 0; ep = ep->next) {
			if (JT(ep->pred) == b)
				JT(ep->pred) = pull;
			else
				JF(ep->pred) = pull;
		}
	}
	else
		*diffp = pull;

	done = 0;
}
Example #5
0
EStatus StationSetId(Station* pThis, StationId id)
{
	SET_MEMBER(id, pThis, id);
}
Example #6
0
EStatus StationSetVelocity(Station* pThis, Velocity newVelocity)
{
	SET_MEMBER(newVelocity, pThis, velocity);
}
int AddClause(ADNFClause dnf, ASet clause) //returns address if really added
{
	int i;
	AAndClause *cur= dnf;
	ASet allAtomsIntersection;

	if (SET_ISFALSE(clause))	//Not adding ( a AND NOT(a) )
		return 0;
	

	while (cur->next)
	{
		cur=cur->next;


		switch (Contains( &(cur->set), &clause) )// The one in the chain is preferred if they are equal
		{
		case 1:	//The one in the chain contains the one to be added ( Is more specific)
//				printf("head %d head->prev->next %d\n", head, head->prev->next);
							
			cur= RemoveClause(cur);
			break;
			
		case -1:	//The one to be added contains (is more specific than) the one already in the chain
			#ifdef LOG_LINKEDLIST
			printf("Clause %d>%d already there in wire %d at stack entry %d\n", clause, cur->set, w, cur->inQueue);
			#endif
			break;
				
		case 0: //Nothing to see here
			allAtomsIntersection= SET_INTERSECTION( SET_ALL_ATOMS(cur->set), SET_ALL_ATOMS(clause) );
		
			for (i=0; i<ASET_SIZE_HALF; i++)
			{
				if (SET_MEMBER(allAtomsIntersection, i) )	//looking for a and ~a
				{
					if ( LOGIC_NORMALIZE(SET_MEMBER(cur->set, i)) != LOGIC_NORMALIZE(SET_MEMBER(clause, i)) ) //one of them has a and the other ~a
					{
						ASet f1, f2;
						if ( SET_MEMBER(clause, i))
						{
							f1=clause;
							f2=cur->set;
						}
						else
						{
							f2= clause;
							f1= cur->set;
						}
						// f1 has a and f2 has ~a
						SET_REMOVE(f2, SET_INDEX_NEGATE(i));
						SET_REMOVE(f1, i);
					
						//Now neither has either!!
						
						if (f1==f2)
						{
							RemoveClause(cur);
							clause= f1;
							cur= dnf;
							break;	//break out of the for loop.
						}
						else
						{
							int fa=	//1 if it is of form fa + ff'~a, -1 if f~a + ff'a, 0 if neither
								SET_CONTAINS(f2,f1);
							
							if (fa==1)	//fa+ ff'~a = fa + ff'a. f1=f, f2=ff'
							{
								//if fa is in the chain, we need not touch it! Just simplify ff'~a to ff'
								if ( SET_MEMBER(cur->set, i))
									clause= f2;

								else // if ff'~a is in the chain, we have to delete it and insert ff' in again. Then fa will be added back. (Is it necessary?)
								{
									RemoveClause(cur);
									AddClause(dnf, f2);
								}
								
								cur= dnf;// Restart the outer while loop
								break; //from the for loop
		
							}
							else if (fa==-1)//ff'a + f~a= ff' + f~a. f1=ff', f2=f
							{
								//if f~a is in the chain, we need not touch it. Just simplify ff'a to ff'
								if (SET_MEMBER(cur->set, SET_INDEX_NEGATE(i)) )
									clause= f1;
								else // if ff'a is in the chain, we delete it and insert ff' in again. Then f~a will be added again.
								{
									RemoveClause(cur);
									AddClause(dnf, f1);
								}
								
								cur= dnf;
								break;
							}
						}//end if
					
					}//end if
				}//end if
			}//end for

		}//end switch

		
		
		
	}
	
	return AddClauseNoQuestionsAsked(cur, clause);
}
Example #8
0
bool
CBFgpInfo_load( CBFgpInfo fgp_info, const char* filename, const char* sec_name )
{
	ZnkMyf myf = ZnkMyf_create();
	bool result = false;

	result = ZnkMyf_load( myf, filename );
	if( result ){
		ZnkVarpAry vars;
		vars = ZnkMyf_find_vars( myf, sec_name );
	
		SET_MEMBER( fgp_info, vars, Fgp_userAgent );
		SET_MEMBER( fgp_info, vars, Fgp_language );
		SET_MEMBER( fgp_info, vars, Fgp_colorDepth );
		SET_MEMBER( fgp_info, vars, Fgp_ScreenResolution );
		SET_MEMBER( fgp_info, vars, Fgp_TimezoneOffset );
		SET_MEMBER( fgp_info, vars, Fgp_SessionStorage );
		SET_MEMBER( fgp_info, vars, Fgp_LocalStorage );
		SET_MEMBER( fgp_info, vars, Fgp_IndexedDB );
		SET_MEMBER( fgp_info, vars, Fgp_BodyAddBehavior );
		SET_MEMBER( fgp_info, vars, Fgp_OpenDatabase );
		SET_MEMBER( fgp_info, vars, Fgp_CpuClass );
		SET_MEMBER( fgp_info, vars, Fgp_Platform );
		SET_MEMBER( fgp_info, vars, Fgp_doNotTrack );
		SET_MEMBER( fgp_info, vars, Fgp_PluginsString );
	}

	ZnkMyf_destroy( myf );

	return result;
}
Example #9
0
void
CBFgpInfo_init_byCBVars( CBFgpInfo fgp_info, ZnkVarpAry cb_vars )
{
	SET_MEMBER( fgp_info, cb_vars, Fgp_userAgent );
	SET_MEMBER( fgp_info, cb_vars, Fgp_language );
	SET_MEMBER( fgp_info, cb_vars, Fgp_colorDepth );
	SET_MEMBER( fgp_info, cb_vars, Fgp_ScreenResolution );
	SET_MEMBER( fgp_info, cb_vars, Fgp_TimezoneOffset );
	SET_MEMBER( fgp_info, cb_vars, Fgp_SessionStorage );
	SET_MEMBER( fgp_info, cb_vars, Fgp_LocalStorage );
	SET_MEMBER( fgp_info, cb_vars, Fgp_IndexedDB );
	SET_MEMBER( fgp_info, cb_vars, Fgp_BodyAddBehavior );
	SET_MEMBER( fgp_info, cb_vars, Fgp_OpenDatabase );
	SET_MEMBER( fgp_info, cb_vars, Fgp_CpuClass );
	SET_MEMBER( fgp_info, cb_vars, Fgp_Platform );
	SET_MEMBER( fgp_info, cb_vars, Fgp_doNotTrack );
	SET_MEMBER( fgp_info, cb_vars, Fgp_PluginsString );
}