コード例 #1
0
ファイル: Object.c プロジェクト: 455475876github/SoftEtherVPN
// Release of the reference counter
UINT Release(REF *ref)
{
	UINT c;
	// Validate arguments
	if (ref == NULL)
	{
		return 0;
	}

	// KS
	KS_INC(KS_RELEASE_COUNT);
	KS_DEC(KS_CURRENT_REFED_COUNT);

	c = Dec(ref->c);
	if (c == 0)
	{
		// KS
		KS_DEC(KS_CURRENT_REF_COUNT);
		KS_INC(KS_FREEREF_COUNT);

		DeleteCounter(ref->c);
		ref->c = 0;
		Free(ref);
	}
	return c;
}
コード例 #2
0
ファイル: CIMInstance.cpp プロジェクト: ncultra/Pegasus-2.5
CIMInstance& CIMInstance::operator=(const CIMInstance& x)
{
    if (x._rep != _rep)
    {
        Dec(_rep);
        Inc(_rep = x._rep);
    }
    return *this;
}
コード例 #3
0
ファイル: CIMOMHandle.cpp プロジェクト: brunolauze/pegasus
CIMOMHandle & CIMOMHandle::operator =(const CIMOMHandle & handle)
{
    if (this != &handle)
    {
        Dec(_rep);
        Inc(_rep = handle._rep);
    }
    return *this;
}
コード例 #4
0
ファイル: sf_obj.cpp プロジェクト: kuailexs/symbiandump-os1
/**
Closes this dispatch object.

Decrements the reference count by one. If this becomes zero then the request 
will either call Dispatch() if currently not within the correct thread 
context otherwise the function calls DoClose() on this dispatch object.

@see CFsDispatchObject::IsCorrectThread
     CFsDispatchObject::Dispatch
     CFsObject::DoClose
*/
EXPORT_C void CFsDispatchObject::Close()
	{
	__THRD_PRINT1(_L("CFsDispatchObject::Close() 0x%x"),this);
	if(Dec()!=1)
		return;
	if(!IsCorrectThread())
		Dispatch();
	else
		DoClose();
	}
コード例 #5
0
CIMQualifierDecl& CIMQualifierDecl::operator=(const CIMQualifierDecl& x)
{
    if (x._rep != _rep)
    {
        Dec(_rep);
        Inc(_rep = x._rep);
    }

    return *this;
}
コード例 #6
0
ファイル: sf_obj.cpp プロジェクト: kuailexs/symbiandump-os1
/**
Destructor.
 
Deallocates memory associated with this objects name, if a name 
has been set.
 
@panic FSERV 104 if the reference count is not zero when
       the destructor is called.
*/
EXPORT_C  CFsObject::~CFsObject()
	{
	__PRINT1(_L("CFsObject::~CFsObject() 0x%x"),this);
	__ASSERT_ALWAYS(Dec()==0,Fault(EObjDestructorAccessCount));	
	__ASSERT_ALWAYS(!iContainer,Fault(EObjDestructorContainer));
	if(iName)
		User::Free(iName);
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
	__e32_atomic_add_ord32(&ObjectCount, (TUint32) -1);
#endif
	}
コード例 #7
0
ファイル: sgu_193.cpp プロジェクト: TRYang/acm
int main(){
	int i,j,k;
	scanf("%s",s);
	len=strlen(s);
	for (i=0;i<len;i++) a[i]=s[len-i-1]-'0';
	if (a[0]%2==0){
		Div2();
		if (a[0]%2==0){
			Dec();
			pr();
		}else{
			Dec();
			Dec();
			pr();
		}
	}else{
		Div2();
		pr();
	}
	return 0;
}
コード例 #8
0
ファイル: Missile.cpp プロジェクト: ukifuku/cloudphobia_cpp
void TSmoke2::Move()
{
	s32 RR = Rdeg;
	s32 SmokeLife = 60;  s32 FadeSpeed = 4;
	switch( EffLevel ){
		case 0:{  SmokeLife = 6;  FadeSpeed = 40;  }	break;
		case 1:{  SmokeLife = 30;  FadeSpeed = 8;  }	break;
		case 2:{  SmokeLife = 60;  FadeSpeed = 4;  }	break;
	}

	X = (s32)(Sprite[0]->GetSpr()->FCX);
	Y = (s32)(Sprite[0]->GetSpr()->FCY);

	if( PrevObj != NULL && !PrevObj->Dead()) {
		Sprite[0]->GetSpr()->FVisible = true;
		s32 DY = PrevObj->Y;
		s32 DX = PrevObj->X;
		distance = (s32)(pow(DX*DX+DY*DY, 0.5f));
		s32 RR = (s32)(atan2(DY, DX) / (f32)M_PI*2048.f) & 0xfff;
	}
	else Sprite[0]->GetSpr()->FVisible = false;

	if( Age % 2 == 0 ) {
		Sprite[0]->GetSpr()->SetColor(255-Age*FadeSpeed,ctBlue);
		Sprite[0]->GetSpr()->SetColor(255-Age*FadeSpeed,ctRed);
		Sprite[0]->GetSpr()->SetColor(255-Age*FadeSpeed,ctGreen);
		Sprite[0]->GetSpr()->SetColor(255-Age*FadeSpeed,ctAlpha);
	}

	Sprite[0]->GetSpr()->Rotate(0);
	Sprite[0]->GetSpr()->Zoom((f32)distance/32.f*3.f,ZoomRate);
	Sprite[0]->GetSpr()->Rotate(Rdeg);
	Sprite[0]->GetSpr()->SlideMoveR(Speed,0);
	Sprite[0]->GetSpr()->Rotate(RR);
	ZoomRate = ZoomRate+0.015f;

	if( Age % 3 == 0 ) Dec(Speed,1);
	if( Speed < 2 ) Speed = 2;

	if( ((X > 710) || (X <-70) || (Y > 480+70) || (Y <0-70)) ) Die();//画面外に消えたら消す
	if( Age >= SmokeLife ) Die();
	TOBJ::Move();

}
コード例 #9
0
ファイル: Missile.cpp プロジェクト: ukifuku/cloudphobia_cpp
void TMakeMissile2::Move()
{
	if( Age % ShotInt == 0 ) {
		for( u32 i = 0; i <= 1; i++ ) {                
			FOwner->LockOn2(SetNum,MissileNum);
			FOwner->Add(new TMissile(FOwner,FOwner->HeroPos.X,FOwner->HeroPos.Y,SetNum,MissileNum));
			Inc(MissileNum);
		}
		FOwner->Add(new TMissileFlash(FOwner,FOwner->HeroPos.X+16,FOwner->HeroPos.Y+8));
		if( CreateSE ) FOwner->SoundEffect->WavPlay(WAMissile,4);
	}

	if( Age >= (ShotInt*((MaxLock / 2) - 1)) ) {
		Dec(FOwner->RestMis,1);
		Die();
		FOwner->MissileON = false;
	}
	TOBJ::Move();

}
コード例 #10
0
ファイル: Link.c プロジェクト: OchinDesh2OchinPur/softether
// Stop the link
void StopLink(LINK *k)
{
	// Validate arguments
	if (k == NULL)
	{
		return;
	}

	LockLink(k);
	{
		if (k->Started == false)
		{
			UnlockLink(k);
			return;
		}
		k->Started = false;
		k->Halting = true;

		Dec(k->Cedar->CurrentActiveLinks);
	}
	UnlockLink(k);

	if (k->ClientSession != NULL)
	{
		// Disconnect the client session
		StopSession(k->ClientSession);

		LockLink(k);
		{
			ReleaseSession(k->ClientSession);
			k->ClientSession = NULL;
		}
		UnlockLink(k);
	}

	LockLink(k);
	{
		k->Halting = false;
	}
	UnlockLink(k);
}
コード例 #11
0
void AnimationIterator::Inc()
{ 
	if (on) 
	{
		// If Inc() is exactly what should be done
		if (!m_circular || goingForward) // If the iteration is linear, just do it. If it is circular, and should be iterating forwards, Inc()
		{
			if (MAX) // If at max
			{
				if (m_circular) goingForward = false; // Change direction
				else m_cycle = 0; // Set to min
			}
			else
				m_cycle++; // Increment
		}
		else if (m_circular && !goingForward) // Iteration is circular, and should be iterating backward. Delegate to Dec()
		{
			Dec();
		}
	}			 
	else throw AnimationIteratorException("Iterator is off. Cannot increment."); }
コード例 #12
0
void CatalogDB::GetAllObjects(const QString &catalog,
                              QList< SkyObject* > &sky_list,
                              QList < QPair <int, QString> > &object_names,
                              CatalogComponent *catalog_ptr) {
    sky_list.clear();
    QString selected_catalog = QString::number(FindCatalog(catalog));
    skydb_.open();
    QSqlQuery get_query(skydb_);
    get_query.prepare("SELECT Epoch, Type, RA, Dec, Magnitude, Prefix, "
                      "IDNumber, LongName, MajorAxis, MinorAxis, "
                      "PositionAngle, Flux FROM ObjectDesignation JOIN DSO "
                      "JOIN Catalog WHERE Catalog.id = :catID AND "
                      "ObjectDesignation.id_Catalog = Catalog.id AND "
                      "ObjectDesignation.UID_DSO = DSO.UID");
    get_query.bindValue("catID", selected_catalog);

//     kWarning() << get_query.lastQuery();
//     kWarning() << get_query.lastError();
//     kWarning() << FindCatalog(catalog);

    if (!get_query.exec()) {
        kWarning() << get_query.lastQuery();
        kWarning() << get_query.lastError();
    }

    while (get_query.next()) {

        int cat_epoch = get_query.value(0).toInt();
        unsigned char iType = get_query.value(1).toInt();
        dms RA(get_query.value(2).toDouble());
        dms Dec(get_query.value(3).toDouble());
        float mag = get_query.value(4).toFloat();
        QString catPrefix = get_query.value(5).toString();
        int id_number_in_catalog = get_query.value(6).toInt();
        QString lname = get_query.value(7).toString();
        float a = get_query.value(8).toFloat();
        float b = get_query.value(9).toFloat();
        float PA = get_query.value(10).toFloat();
        float flux = get_query.value(11).toFloat();

        QString name = catPrefix + ' ' + QString::number(id_number_in_catalog);
        SkyPoint t;
        t.set(RA, Dec);

        if (cat_epoch == 1950) {
            // Assume B1950 epoch
            t.B1950ToJ2000();  // t.ra() and t.dec() are now J2000.0
                               // coordinates
        } else if (cat_epoch == 2000) {
            // Do nothing
                 { }
               } else {
                 // FIXME: What should we do?
                 // FIXME: This warning will be printed for each line in the
                 //        catalog rather than once for the entire catalog
                 kWarning() << "Unknown epoch while dealing with custom "
                               "catalog. Will ignore the epoch and assume"
                               " J2000.0";
        }

        RA = t.ra();
        Dec = t.dec();

        if (iType == 0) {  // Add a star
            StarObject *o = new StarObject(RA, Dec, mag, lname);
            sky_list.append(o);
        } else {  // Add a deep-sky object
            DeepSkyObject *o = new DeepSkyObject(iType, RA, Dec, mag,
                                                 name, QString(), lname,
                                                 catPrefix, a, b, -PA);
            o->setFlux(flux);
            o->setCustomCatalog(catalog_ptr);

            sky_list.append(o);

            // Add name to the list of object names
            if (!name.isEmpty()) {
                object_names.append(qMakePair<int,QString>(iType, name));
            }
        }

        if (!lname.isEmpty() && lname != name) {
            object_names.append(qMakePair<int,QString>(iType, lname));
        }
    }

    get_query.clear();
    skydb_.close();
}
コード例 #13
0
ファイル: notifier.hpp プロジェクト: 0xec/server1
 void Notify() {
   Dec(1);
 }
コード例 #14
0
/*
 * Lock release
 */
EXPORT void Unlock( FastLock *lock )
{
	if ( Dec(lock) > 0 ) {
		tk_sig_sem(lock->id, 1);
	}
}
コード例 #15
0
ファイル: notifier.hpp プロジェクト: 0xec/server1
 void Inc(int cnt) {
   Dec(-1 * cnt);
 }
コード例 #16
0
ファイル: Missile.cpp プロジェクト: ukifuku/cloudphobia_cpp
void TSmoke::Move()
{
	s32 RR = Rdeg;
	s32 SmokeLife = 60;  
	s32 FadeSpeed = 4;
	switch( EffLevel ){
	case 0:{  SmokeLife = 6;  FadeSpeed = 40;  }	break;
	case 1:{  SmokeLife = 30;  FadeSpeed = 8;  }	break;
	case 2:{  SmokeLife = 70;  FadeSpeed = 4;  }	break;
	}

	X = (s32)(Sprite[0]->GetSpr()->FCX);
	Y = (s32)(Sprite[0]->GetSpr()->FCY);

	//寿命がきた&ミサイル本体が消滅したら死ぬ
	if( MotherIsDead && (Age >= SmokeLife) ) {
		Die();
		return;
	}

	//隣の煙との距離からスプライトの拡大率と回転角を計算
	if( (PrevSmoke != NULL) ) {
		s32 DX = X-PrevSmoke->X;
		s32 DY = Y-PrevSmoke->Y;
		distance = RoundOff(pow(DX*DX + DY*DY , 0.5f))+1;
		RR = RoundOff(atan2(DY, DX) / (f32)M_PI*2048.f) & 0xfff;
	}
	else {
		Sprite[0]->GetSpr()->FVisible = false;
		distance = 1;
	}

	if( (Age >7) && (Age % 2 == 0) ) {
		Sprite[0]->GetSpr()->SetColor(255-(Age-7)*FadeSpeed,ctAlpha);
	}

	if( Age == 0 ) Sprite[0]->GetSpr()->FVisible = true;

	Sprite[0]->GetSpr()->Rotate(PersonalR);
	Sprite[0]->GetSpr()->Zoom(1.f, 1.f);
	Inc(PersonalR, IncR);
	Sprite[0]->GetSpr()->Rotate(PersonalR);
	f32 tempZX = distance / 32.f * 2.f;
	if( (tempZX < ZoomRate*2.0f) ) tempZX = ZoomRate*2.0f;
	Sprite[0]->GetSpr()->Zoom(tempZX,ZoomRate);
	Sprite[0]->GetSpr()->Rotate(Rdeg);      //噴射方向に回転  }
	Sprite[0]->GetSpr()->SlideMoveR(Speed,0);
	Sprite[0]->GetSpr()->Rotate((PersonalR+RR) & 0x0fff);        //前の煙の方向に回転
	if( Age > 0 ) {
		switch( FOwner->NowStage ){
		case 0:
		case 99:Sprite[0]->GetSpr()->SetGradation(2500, 0xaa8800,1);	break;
		case 1:Sprite[0]->GetSpr()->SetGradation(2500, 0x88ff22,1);		break;
		case 2:
		case 3:Sprite[0]->GetSpr()->SetGradation(2500, 0xfffdbe,1);		break;
		case 4:Sprite[0]->GetSpr()->SetGradation(2500, 0x95d1d8,1);		break;
		}

		Sprite[0]->GetSpr()->MoveR(OriginalBGSpeed-5,0);
	}
	ZoomRate = ZoomRate+0.01f + (f32)random(10)*0.001f;

	if( Age % 3 == 0 ) Dec(Speed,1);
	if( Speed<2 ) Speed = 2;

	if( ((X > 710) || (X <-70) || (Y > 480+70) || (Y <0-70)) ) Sprite[0]->GetSpr()->FVisible = false;//画面外に消えたら消す

	//寿命がきたら非表示にする。
	//存在自体はミサイル本体が死ぬまでありつづける
	if( Age >= SmokeLife ) Sprite[0]->GetSpr()->FVisible = false;

	TOBJ::Move();

}
コード例 #17
0
ファイル: Missile.cpp プロジェクト: ukifuku/cloudphobia_cpp
void TMissile::Move()
{
	s32 RandomAngle[] = { 2,4,-2,6,-6,-8,0,8,5,-1,-3,1,7,-5,0,3 };
	Rdeg  =  Rdeg & 0x0fff;
	PrevR = Rdeg;

	s32 Steering;
	if( Age <= 20 ) Steering = 6;
	else Steering = 1;

	X = RoundOff(Sprite[0]->GetSpr()->FCX);
	Y = RoundOff(Sprite[0]->GetSpr()->FCY);

	if( (! FOwner->UnLock[Locknum]) && (! FOwner->BossDie) ) {
		s32 DX = FOwner->BeLocked[Locknum].X-X;             //自分と敵との距離を計算
		s32 DY = FOwner->BeLocked[Locknum].Y-Y;

		s32 EnemyDeg = RoundOff(atan2(DY,DX) / (f32)M_PI*2048.f);
		EnemyDeg  =  EnemyDeg & 0x0fff;

		if( abs(Rdeg-EnemyDeg)>=2048 ) Inc(Rdeg, Sign(Rdeg-EnemyDeg)*RoundOff((f32)(4095-abs(Rdeg-EnemyDeg))/(f32)Steering));
		else if( abs(Rdeg-EnemyDeg)<2048 ) Dec(Rdeg,RoundOff((f32)(Rdeg-EnemyDeg)/(f32)Steering));
	}

	Inc(Rdeg, 2*RandomAngle[Age % 16]);
	Sprite[0]->Rotate(Rdeg);

	Sprite[0]->SlideMoveR(Age,YMove);

	X = RoundOff(Sprite[0]->GetSpr()->FCX);
	Y = RoundOff(Sprite[0]->GetSpr()->FCY);

	if( Age == 0 ) {
		PrevSmoke =  new TSmoke(FOwner,X,Y,Rdeg,NULL);
		FOwner->Add(PrevSmoke);
	}

	//煙と煙の間を煙で埋める
	s32 trace = 1;
	Inc(PrevSmoke->Y, FOwner->BGSlide.Y);    //前の煙の座標に、背景スクロール移動量を考慮
	Inc(PrevSmoke->X, RoundOff(-8.f*cost[Rdeg & 0x0fff]));
	Inc(PrevSmoke->Y, RoundOff(-8.f*sint[Rdeg & 0x0fff]));
	switch( EffLevel )
	{
	case 0:
	case 1:trace = 1;
	case 2:
		{
			trace = RoundOff(pow(pow(X-PrevSmoke->X, 2)+pow(Y-PrevSmoke->Y, 2), 0.5f)/16.f);
			if( abs(GetDiffR(Rdeg,PrevR))>150 ) Inc(trace,1);
		}
	}
	if( trace > 0 ) {
		s32 divX = RoundOff((f32)(X-PrevSmoke->X)/(f32)trace);
		s32 divY = RoundOff((f32)(Y-PrevSmoke->Y)/(f32)trace);

		//煙
		for( s32 i = 0 ; i < trace; i++ ) {
			TSmoke* tmpObj  =  new TSmoke(FOwner,PrevSmoke->X+divX,
				PrevSmoke->Y+divY,
				PrevR+(GetDiffR(PrevR,Rdeg) / trace)*(i+1),
				PrevSmoke);

			PrevSmoke->NextSmoke  =  tmpObj;
			PrevSmoke =  tmpObj;
			FOwner->Add(tmpObj);
		}
	}

	if( (FOwner->UnLock[Locknum] || FOwner->BossDie) && ((X > 710) || (X <-70) || (Y > 480+70) || (Y <0-70)) ) Die();//弾が画面外に消えたら消す
	TOBJ::Move();

}
コード例 #18
0
CIMQualifierDecl::~CIMQualifierDecl()
{
    Dec(_rep);
}
コード例 #19
0
CIMConstQualifierDecl::~CIMConstQualifierDecl()
{
    Dec(_rep);
}
コード例 #20
0
ファイル: Float.cpp プロジェクト: macsux/XCSoar
ComboList *
DataFieldFloat::CreateComboListStepping()
{
  // for DataFieldInteger and DataFieldFloat
  // builds ComboPopupItemList[] by calling CreateItem for each item in list
  // sets ComboPopupItemSavedIndex (global)
  // returns ComboPopupItemCount
  const fixed ComboListInitValue(-99999);
  const fixed ComboFloatPrec(0.0001); //rounds float errors to this precision

  fixed fNext = ComboListInitValue;
  fixed fCurrent = ComboListInitValue;
  fixed fLast = ComboListInitValue;
  TCHAR sTemp[ComboPopupITEMMAX];

  int iListCount = 0;
  int iSelectedIndex = -1;
  int iStepDirection = 1; // for integer & float step may be negative
  fixed fBeforeDec = fixed_zero, fAfterDec = fixed_zero, fSavedValue = fixed_zero;

  fNext = ComboListInitValue;
  fCurrent = ComboListInitValue;
  fLast = ComboListInitValue;

  SetDisableSpeedUp(true);
  SetDetachGUI(true); // disable display of inc/dec/change values

  // get step direction for int & float so we can detect if we skipped the value while iterating later
  TCHAR PropertyValueSaved[ComboPopupITEMMAX];
  TCHAR PropertyValueSavedFormatted[ComboPopupITEMMAX];
  CopyString(PropertyValueSaved, false);
  CopyString(PropertyValueSavedFormatted, true);

  fSavedValue = GetAsFixed();
  Inc();
  fBeforeDec = GetAsFixed();
  Dec();
  fAfterDec = GetAsFixed();

  if (fAfterDec < fBeforeDec)
    iStepDirection = 1;
  else
    iStepDirection = -1;

  // reset datafield to top of list (or for large floats, away from selected
  // item so it will be in the middle)
  for (iListCount = 0; iListCount < ComboList::MAX_SIZE / 2; iListCount++) {
    // for floats, go half way down only
    Dec();
    fNext = GetAsFixed();

    if (fabs(fNext - fCurrent) < ComboFloatPrec) // we're at start of the list
      break;
    if (fabs(fNext - fLast) < ComboFloatPrec) // don't repeat Yes/No/etc  (is this needed w/out Bool?)
      break;

    fLast = fCurrent;
    fCurrent = fNext;
  }

  fNext = ComboListInitValue;
  fCurrent = ComboListInitValue;
  fLast = ComboListInitValue;

  fCurrent = GetAsFixed();

  ComboList *combo_list = new ComboList();

  // if we stopped before hitting start of list create <<Less>> value at top of list
  if (iListCount == ComboList::MAX_SIZE / 2) {
    // this data index item is checked on close of dialog
    combo_list->Append(ComboList::Item::PREVIOUS_PAGE, _T("<<More Items>>"));
  }

  // now we're at the beginning of the list, so load forward until end
  for (iListCount = 0; iListCount < ComboList::MAX_SIZE - 3; iListCount++) {
    // stop at LISTMAX-3 b/c it may make an additional item if it's "off step", and
    // potentially two more items for <<More>> and << Less>>

    // test if we've stepped over the selected value which was not a multiple of the "step"
    if (iSelectedIndex == -1) {
      // not found yet
      if (iStepDirection * GetAsFixed() >
          (fSavedValue + ComboFloatPrec * iStepDirection)) {
        // step was too large, we skipped the selected value, so add it now
        iSelectedIndex =
          combo_list->Append(0, PropertyValueSaved,
                             PropertyValueSavedFormatted);
      }
    }

    if (iSelectedIndex == -1 && fabs(fCurrent - fSavedValue) < ComboFloatPrec) {
      // selected item index
      iSelectedIndex = combo_list->size();
    }

    CopyString(sTemp, true); // can't call GetAsString & GetAsStringFormatted together (same output buffer)
    combo_list->Append(0, GetAsString(), sTemp);

    Inc();
    fNext = GetAsFixed();

    if (fabs(fNext - fCurrent) < ComboFloatPrec)
      // we're at start of the list
      break;

    if ((fabs(fNext - fLast) < ComboFloatPrec) && combo_list->size() > 0)
      //we're at the end of the range
      break;

    fLast = fCurrent;
    fCurrent = fNext;
  }

  // if we stopped before hitting end of list create <<More>> value at end of list
  if (iListCount == ComboList::MAX_SIZE - 3) {
    // this data index item is checked on close of dialog
    combo_list->Append(ComboList::Item::NEXT_PAGE, _T("<<More Items>>"));
  }

  SetDisableSpeedUp(false);
  SetDetachGUI(false); // disable dispaly of inc/dec/change values

  if (iSelectedIndex >= 0)
    SetAsFloat(fSavedValue);

  combo_list->ComboPopupItemSavedIndex = iSelectedIndex;

  return combo_list;
}
コード例 #21
0
ファイル: CIMInstance.cpp プロジェクト: ncultra/Pegasus-2.5
CIMConstInstance::~CIMConstInstance()
{
    Dec(_rep);
}
コード例 #22
0
ファイル: sf_obj.cpp プロジェクト: kuailexs/symbiandump-os1
/**
Closes this reference counting object.

The default behaviour decrements the reference count by one. If this becomes 
zero, then the function calls DoClose on this reference counting object.
 
Where a derived class implements its own version of this function, it can 
use the protected member functions Dec() & DoClose() or make a base call to 
this function.

@see CFsObject::DoClose
*/
EXPORT_C void CFsObject::Close()
	{
	__THRD_PRINT(_L("CFsObject::Close()"));
	if(Dec()==1)
		DoClose();
	}
コード例 #23
0
ファイル: CIMInstance.cpp プロジェクト: ncultra/Pegasus-2.5
CIMInstance::~CIMInstance()
{
    Dec(_rep);
}
コード例 #24
0
ファイル: CIMOMHandle.cpp プロジェクト: brunolauze/pegasus
CIMOMHandle::~CIMOMHandle()
{
    Dec(_rep);
}
コード例 #25
0
ファイル: main.c プロジェクト: SeriousCoder/SPBU
int main(int argc, char **argv) 
{
    FILE *input = NULL, *output = NULL;
    
    //char strOut[17] = "test*_student.txt";
    
    //strOut[4] = argv[1][4];
    
    stack = NULL;
    char ch;
    
    
    
/*
    if(argc == 3)
    {
*/
        input = freopen("test10.txt", "r", stdin);
        //output = freopen(strOut, "w", stdout);
        if(!input)
        {
            fprintf(stderr, "File IO error\n");
            return -1;
        }
/*
    }
    else
    {
        fprintf(stderr, "Don't enter input and output files\n");
        return -1;
    }
*/
    
    ch = getchar();
    
    while (ch != EOF)
    {
        if (ch == '*' || ch == '/' || ch == '+')
        {
            if(!stack)
            {
                fprintf(stdout, "Not enough arguments\n");
                memClear();
                return 1;
            }
            
            IntList* a = stack -> integer;
            stack = Remote(0);
            
            if(!stack)
            {
                fprintf(stdout, "Not enough arguments\n");
                stack = Add(a);
                memClear();
                return 1;
            }
            
            IntList* b = stack -> integer;
            stack = Remote(0);
            
            switch(ch)
            {
                case '*':
                    stack = Add(Mult(a, b));
                    break;
                case '/':
                    if(b -> length == 1 && !b->value)
                    {
                        fprintf(stdout, "Division by zero\n");
                        memClear();
                        return 1;
                    }
                    stack = Add(Div(a, b));
                    break;
                case '+':
                    stack = Add(Inc(a, b));
                    break;
            }
            
            if (!stack)
            {
                return 0;
            }
        }
        else if(ch == '-')
        {
            ch = getchar();
            
            if (ch == '\n' || ch == EOF)
            {
                if(!stack)
                {
                    fprintf(stdout, "Not enough arguments\n");
                    memClear();
                    return 1;
                }
                
                IntList* a = stack -> integer;
                stack = Remote(0);
                
                if(!stack)
                {
                    fprintf(stdout, "Not enough arguments\n");
                    stack = Add(a);
                    memClear();
                    return 1;
                }
            
                IntList* b = stack -> integer;
                stack = Remote(0);
            
                stack = Add(Dec(a, b));
            }
            else if (ch >= 48 && ch < 58)
            {
                stack = Add(Read(ch, 1));
            }
            
            if (!stack)
            {
                return 0;
            }
        }
        else if (ch >= 48 && ch < 58)
        {
            stack = Add(Read(ch, 0));
            
            if (!stack)
            {
                return 0;
            }
        }
        else if(ch == '=')
        {
            if(!stack)
            {
                fprintf(stdout, "Not enough arguments\n");
                memClear();
                return 1;
            }
            
            ShowInt(stack -> integer, stack -> integer -> sign, 0);
            printf("\n");
        }
        else if(ch != 13 && ch != '\n')
        {
            fprintf(stdout, "Unknown command\n");
            memClear();
            return 1;
        }

        ch = getchar();
    }
    
    //ShowInt(stack -> integer, stack -> integer -> sign);
    
    if(stack)
    {
        printf("[");
        while(stack)
        {
            stack = Remote(1);
        }
        printf("]");
    }

    return 0;
}