示例#1
0
文件: Symbol.cpp 项目: usnistgov/QIF
ISymbol::ISymbol()
{
	Parsed()=0; 
	Visited()=0; 
	Type()=(SymbolType) -1; 
	ListType()=unknown_; 
	Dimension()=0;
	SimpleType()=true;
	Required()=false;
	Abstract()=false;
	Compositor()=0;
	DerivedType() = XercesAdditions::DERIVATION_NONE;
	XercesType() = XercesAdditions::NO_DECLARATION;
	Global()=false;
	SqlCount()=0;
	SubstitutionGroupAffiliation().clear();
	symbols.push_back(this);
	Variable()=NULL;
	SimpleContent()=false;
	List()=false;
	Atomic()=false;
	Level()=0;
	ListSize()=0;
	intrusive_ptr_add_ref((IExpress *) symbols.back().get());
}
示例#2
0
static void 
mputch(int x, int y, int c, unsigned fg, unsigned bg)
{
	Atomic();
	mt_cons_gotoxy(x, y);
	cprintk(fg, bg, "%c", c);
	Unatomic();
}
示例#3
0
static void
close_barrier(DIRECTION dir)
{
	Atomic();
	while ( get_road(dir, BARRIER_POS) != EMPTY )
		Yield();
	set_road(dir, BARRIER_POS, BARRIER, BARRIER_FG, ROAD_BG);
	Unatomic();
	set_border(dir, BARRIER_POS-1, NOTHING, BORDER_FG, BORDER_BG);
}
示例#4
0
void			
LeaveMonitor(Monitor_t *mon)
{
	if ( mon->owner != mt_curr_task )
		Panic("LeaveMonitor: la tarea no posee el monitor %s", GetName(mon));

	Atomic();
	mon->owner = SignalQueue(&mon->queue);
	Unatomic();
}
示例#5
0
static int 
mprint(int x, int y, char *format, ...)
{
	int n;
	va_list args;

	Atomic();
	mt_cons_gotoxy(x, y);
	mt_cons_setattr(LIGHTCYAN, BLACK);
	va_start(args, format);
	n = vprintk(format, args);
	va_end(args);
	mt_cons_clreol();
	Unatomic();
	return n;
}
示例#6
0
文件: Symbol.cpp 项目: usnistgov/QIF
void ISymbol::MergeTypeInfo(ISymbolPtr c)
{
	c->TypeName() = Name();
	// Ignore, Name(), Namespace(), and Type()

	c->Abstract() = Abstract();
	c->Atomic() = Atomic();
	c->Attributes() = Attributes();
	c->BaseTypeName() = BaseTypeName();
	c->Compositor() = Compositor();
	c->DerivedType() = DerivedType();
	c->Enumerations() = Enumerations();
	c->FacetKinds() = FacetKinds();
	c->Facets() = Facets();
	c->Global() = Global();
	c->Level() = Level();
	c->List() = List();
	c->ListSize() = ListSize();
	c->ListType() = ListType();
	c->Optional() = Optional();
	c->Parent() = Parent();
	c->Parsed() = Parsed();
	c->PrimitiveType() = PrimitiveType();
	c->Required() = Required();
	c->SimpleContent() = SimpleContent();
	c->SimpleType() = SimpleType();
	c->SqlCount() = SqlCount();
	c->SqlType() = SqlType();
	c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation();
	c->SubstitutionList() = SubstitutionList();
	c->SubTypes() = SubTypes();
	c->SuperTypes() =  SuperTypes();

	c->Variable() = Variable();
	c->Visited() = Visited();
	c->XercesType() = XercesType();
	
	// These are element particle definitions
	// c->Dimension() = Dimension(); // always 1
	//c->LowerBounds() = LowerBounds();
	//c->UpperBounds() = UpperBounds();
	//c->OuterElementName() = OuterElementName();
	// c->OuterElementTypeName() = OuterElementTypeName();

}
示例#7
0
bool			
EnterMonitorTimed(Monitor_t *mon, unsigned msecs)
{
	if ( mon->owner == mt_curr_task )
		Panic("EnterMonitorTimed: monitor %s ya ocupado por esta tarea", GetName(mon));

	Atomic();
	if ( !mon->owner )
	{
		mon->owner = mt_curr_task;
		Unatomic();
		return true;
	}
	bool success = WaitQueueTimed(&mon->queue, msecs);
	Unatomic();

	return success;
}
示例#8
0
bool				
WaitConditionTimed(Condition_t *cond, unsigned msecs)
{
	bool success;
	Monitor_t *mon = cond->monitor;

	if ( mon->owner != mt_curr_task )
		Panic("WaitConditionTimed %s: la tarea no posee el monitor %s", GetName(cond), GetName(cond->monitor));

	Atomic();
	LeaveMonitor(mon);
	success = WaitQueueTimed(&cond->queue, msecs);
	while ( !EnterMonitor(mon) )	// Hay que volver a tomar el monitor si o si
		;
	Unatomic();

	return success;
}
示例#9
0
文件: Symbol.cpp 项目: usnistgov/QIF
void ISymbol::DeepCopy(ISymbolPtr c)
{
	c->Name()=Name();

	c->Abstract() = Abstract();
	c->Atomic() = Atomic();
	c->Attributes() = Attributes();
	c->BaseTypeName() = BaseTypeName();
	c->Compositor() = Compositor();
	c->DerivedType() = DerivedType();
	c->Dimension() = Dimension();
	c->Enumerations() = Enumerations();
	c->FacetKinds() = FacetKinds();
	c->Facets() = Facets();
	c->Global() = Global();
	c->Level() = Level();
	c->List() = List();
	c->ListSize() = ListSize();
	c->ListType() = ListType();
	c->LowerBounds() = LowerBounds();
	c->Namespace() = Namespace();
	c->Optional() = Optional();
	c->OuterElementName() = OuterElementName();
	c->OuterElementTypeName() = OuterElementTypeName();
	c->Parent() = Parent();
	c->Parsed() = Parsed();
	c->PrimitiveType() = PrimitiveType();
	c->Required() = Required();
	c->SimpleContent() = SimpleContent();
	c->SimpleType() = SimpleType();
	c->SqlCount() = SqlCount();
	c->SqlType() = SqlType();
	c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation();
	c->SubstitutionList() = SubstitutionList();
	c->SubTypes() = SubTypes();
	c->SuperTypes() =  SuperTypes();
	c->Type() = Type();
	c->TypeName() = TypeName();
	c->UpperBounds() = UpperBounds();
	c->Variable() = Variable();
	c->Visited() = Visited();
	c->XercesType() = XercesType();
}
示例#10
0
static size_t SingleStep()
{
	switch (State)
	{
	case GCS_Pause:
		MarkRoot();		// Start a new collection
		return 0;

	case GCS_Propagate:
		if (Gray != NULL)
		{
			return PropagateMark();
		}
		else
		{ // no more gray objects
			Atomic();	// finish mark phase
			return 0;
		}

	case GCS_Sweep: {
		size_t old = AllocBytes;
		size_t finalize_count;
		SweepPos = SweepList(SweepPos, GCSWEEPMAX, &finalize_count);
		if (*SweepPos == NULL)
		{ // Nothing more to sweep?
			State = GCS_Finalize;
		}
		assert(old >= AllocBytes);
		Estimate -= old - AllocBytes;
		return (GCSWEEPMAX - finalize_count) * GCSWEEPCOST + finalize_count * GCFINALIZECOST;
	  }

	case GCS_Finalize:
		State = GCS_Pause;		// end collection
		Dept = 0;
		return 0;

	default:
		assert(0);
		return 0;
	}
}
示例#11
0
static void
car(void *arg)
{
	DIRECTION *dir = arg;
	int pos;
	int carsymbol = *dir == LEFTBOUND ? LEFTCAR : RIGHTCAR;
	MESSAGE car_in = *dir == LEFTBOUND ? LEFTBOUND_IN : RIGHTBOUND_IN; 
	MESSAGE car_barrier = *dir == LEFTBOUND ?
							LEFTBOUND_BARRIER : RIGHTBOUND_BARRIER; 
	MESSAGE car_out = *dir == LEFTBOUND ? LEFTBOUND_OUT : RIGHTBOUND_OUT; 

	++ncars; // suponemos que es atómico
	for ( pos = 0 ; pos < ROAD_LEN ; pos++ )
	{
		Atomic();
		while ( get_road(*dir, pos) != EMPTY )
			Yield();
		if ( pos < ROAD_END && get_road(*dir, pos+1) != EMPTY )
			Delay(TDELAY);
		while ( get_road(*dir, pos) != EMPTY )
			Yield();
		set_road(*dir, pos, carsymbol, CAR_FG, CAR_BG);
		if ( pos == SENSOR1_POS )
			Send(ctl, &car_in, sizeof car_in);
		else if ( pos == BARRIER_POS )
			Send(ctl, &car_barrier, sizeof car_barrier);
		else if ( pos == SENSOR2_POS )
			Send(ctl, &car_out, sizeof car_out);
		if ( pos )
			set_road(*dir, pos-1, EMPTY, ROAD_FG, ROAD_BG);
		Unatomic();
		Delay(TDELAY);
	}
	set_road(*dir, ROAD_END, EMPTY, ROAD_FG, ROAD_BG);
	--ncars;
}