Exemplo n.º 1
0
CCity::CCity() 
{
	PROFILE("CCity::CCity()");
	m_nImageID = -1;
	m_nGoldTribute = 0;
	m_nCurrentOwner = -1;
	m_dwColor = 0;
	m_bIsAttackable = false;
	m_ptAttackPoint.x = 0;
	m_ptAttackPoint.y = 0;
	STOP("CCity::CCity()");
}
Exemplo n.º 2
0
/*创建一个对象,传入该对象对应的原型的ID,并传入构造函数所需的参数(如果有的话)*/
Var  struct_Create(int id,Var init_arg[],int args)
{
    Var result;
    result.content.type=VAR_TYPE_OBJ;
    result.content.var_value.struct_obj.handle_value=create_instance(id);
    var_SetObjId (&result,id);
    /*若存在初始化函数,则调用它*/
    if(struct_list[id].initializer_index>=0)
    {
        if(struct_list[id].initializer_acc==STRUCT_PRIVATE && env_index!=id)
        {
            STOP("private initializer only can be assigned inside\n");
        }
        int old_env =env_index;
        env_index=id;/*环境索引改变为类内部*/
        /*函数栈压入*/
        vm_RTstackPush();
        /*获取构造函数*/
        Function  *f=func_get_by_index(struct_list[id].initializer_index);
        if(f->arg_counts!=args)
        {
            STOP("struct constructor not matched!");
        }
        self_ptr=result;
        /*传入参数*/
        int i;
        for(i=0; i<f->arg_counts; i++)
        {
            vm_rt_stack_var_cast_set ( i,init_arg[i]);
        }
        IL_list * old_list=current_list;
        func_PlainInvoke ( struct_list[id].initializer_index);/*执行构造函数*/
        current_list=old_list;
        /*函数的栈弹出*/
        vm_RTstackPop();
        self_ptr.content.type=VAR_TYPE_NILL;
        env_index=old_env;/*维持环境*/
    }
    return result;
}
Exemplo n.º 3
0
/* LT 20-3-1998 */
void astinvad_sh_port_4_w(int offset, int data)
{
	static int port4State;

	int bitsChanged;
	int bitsGoneHigh;
	int bitsGoneLow;


	bitsChanged  = port4State ^ data;
	bitsGoneHigh = bitsChanged & data;
	bitsGoneLow  = bitsChanged & ~data;

	port4State = data;


	if ( bitsGoneHigh & OUT_PORT_4_UFO )  PLAY( SND_UFO, 1 );
	if ( bitsGoneLow  & OUT_PORT_4_UFO )  STOP( SND_UFO );

	if ( bitsGoneHigh & OUT_PORT_4_SHOT )  PLAY( SND_SHOT, 0 );
	if ( bitsGoneLow  & OUT_PORT_4_SHOT )  STOP( SND_SHOT );

	if ( bitsGoneHigh & OUT_PORT_4_BASEHIT )
	{
		PLAY( SND_BASEHIT, 0 );
    	/* turn all colours red here */
    	invaders_screen_red_w(1);
    }
	if ( bitsGoneLow & OUT_PORT_4_BASEHIT )
	{
		STOP( SND_BASEHIT );
    	/* restore colours here */
    	invaders_screen_red_w(0);
    }

	if ( bitsGoneHigh & OUT_PORT_4_INVADERHIT )  PLAY( SND_INVADERHIT, 0 );
	if ( bitsGoneLow  & OUT_PORT_4_INVADERHIT )  STOP( SND_INVADERHIT );

	if ((bitsChanged & OUT_PORT_4_UNUSED) && errorlog)  fprintf(errorlog, "Snd Port 4 = %02X\n", data & OUT_PORT_4_UNUSED);
}
Exemplo n.º 4
0
void 
namei_init(void) {
  START(namei,init);
  nc = name_cache_init(4096,64);
  name_cache_removefunc(namei_cache_remove_func);
#ifdef CACHEDLOOKUP
//  kprintf("Namei with cached lookups\n");
#endif
  assert(nc);

  //atexit(pr_namei_stat);
  STOP(namei,init);
}
Exemplo n.º 5
0
// 电机停止
int fnMotoST(void)
{
	STOP(x)
	statusL |= 0x20; 	// 清正调状态
	statusL |= 0x10; 	// 清反调状态
	statusH |= 0x04;	// 清开臂标志
	statusH |= 0x08;	// 清收臂标志
	zbFlag = ModeNull;
	STOP(x)
	if(Task[0] == ModeST)
		TaskCreate(ModeNull);
	return ModeST;
}
Exemplo n.º 6
0
//----------------------------------------------------------------------
long MC_TextureManager::saveTexture (DWORD textureIndex, const char *textureFullPathName)
{
	if ((MC_MAXTEXTURES <= textureIndex) || (NULL == masterTextureNodes[textureIndex].textureData))
	{
		return (~NO_ERR);
	}
	File textureFile;
	long textureFileOpenResult = textureFile.create(textureFullPathName);
	if (NO_ERR != textureFileOpenResult)
	{
		textureFile.close();
		return textureFileOpenResult;
	}

	{
		if (masterTextureNodes[textureIndex].width == 0)
		{
			textureFile.close();
			return (~NO_ERR);		//These faces have no texture!!
		}

		{
			//------------------------------------------
			// Badboys are now LZ Compressed in texture cache.
			long origSize = LZDecomp(MC_TextureManager::lzBuffer2,(MemoryPtr)masterTextureNodes[textureIndex].textureData,masterTextureNodes[textureIndex].lzCompSize);
			if (origSize != (long)(masterTextureNodes[textureIndex].width & 0x0fffffff))
				STOP(("Decompressed to different size from original!  Txm:%s  Width:%d  DecompSize:%d",masterTextureNodes[textureIndex].nodeName,(masterTextureNodes[textureIndex].width & 0x0fffffff),origSize));

			if (origSize >= MAX_LZ_BUFFER_SIZE)
				STOP(("Texture TOO large: %s",masterTextureNodes[textureIndex].nodeName));

			textureFile.write(MC_TextureManager::lzBuffer2, origSize);
		}
		textureFile.close();
	}

	return NO_ERR;
}
Exemplo n.º 7
0
void GPSDATA::PASER_GPS::startGPS() {
    if(conf.GPS_ENABLE == 0){
        return;
    }
    bool error;
    bool m_ReadingStarted = false;
    // repeating reconnection if problems arise
    do {
        error = false;
        try {
            // create the serial device, note it takes the io service and the port name
            m_Port = new serial_port(m_IO, conf.GPS_SERIAL_PORT);
//            m_Port = new serial_port(m_IO, "/dev/ttyS2");
        } catch (...) {
            error = true;
            PASER_LOG_WRITE_LOG(PASER_LOG_ERROR, "Problem wile trying to access port %s\n", conf.GPS_SERIAL_PORT.c_str());
            boost::xtime xt;
            boost::xtime_get(&xt, boost::TIME_UTC);

            xt.nsec += 1000000000;
            boost::thread::sleep(xt);
            // after some time try to reconnect;
        }
    } while (error);

    // prepare settings
    serial_port_base::baud_rate BAUD(conf.GPS_SERIAL_SPEED); // what baud rate do we communicate at
//    serial_port_base::baud_rate BAUD(4800); // what baud rate do we communicate at
    serial_port_base::character_size CSIZE2(8); // how big is each "packet" of data (default is 8 bits)
    serial_port_base::flow_control FLOW(serial_port_base::flow_control::none); // what flow control is used (default is none)
    serial_port_base::parity PARITY(serial_port_base::parity::none); // what parity is used (default is none)
    serial_port_base::stop_bits STOP(serial_port_base::stop_bits::one); // how many stop bits are used (default is one)

    // go through and set all the options as we need them
    // all of them are listed, but the default values work for most cases
    m_Port->set_option(BAUD);
    m_Port->set_option(CSIZE2);
    m_Port->set_option(FLOW);
    m_Port->set_option(PARITY);
    m_Port->set_option(STOP);

    if (!m_ReadingStarted) {
        boost::thread t(boost::bind(&boost::asio::io_service::run, &m_IO));
        boost::asio::async_read_until(*m_Port, b, '\n',
                boost::bind(&GPSDATA::PASER_GPS::Handler, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
        m_ReadingStarted = true;
    }

}
Exemplo n.º 8
0
int 
namei_lookup(struct file *old_filp, char *name, struct file *new_filp) {
  struct file *filp = NULL;
  static int malloc_count = 0;
  static int mesg = 1;
  int error;

  START(namei,lookup);
  namei_lookup_count++;

  if (namei_cache_lookup(old_filp,name,&filp)) {
    *new_filp = *filp;
  } else {
    /* miss */
    error = DOOP(old_filp,lookup,(old_filp,name,new_filp));
    if (error) {
//      NAMEI_RELEASE(old_filp,&release);
#ifdef NAMEIDEBUG
      printf("LOOKUP old_filp %s failed errno: %s\n",next,strerror(errno));
#endif
      STOP(namei,lookup);
      return -1;
    }
    if (mesg) filp = (struct file *)__malloc(sizeof (struct file));
    if (filp == 0 && mesg) {
      kprintf("malloc failed (on try: %d\n",malloc_count);
      mesg = 0;
    } else {
      malloc_count++;
      *filp = *new_filp;
      namei_cache_add(old_filp,name,filp);
    }
  }
  STOP(namei,lookup);
  return 0;
}
Exemplo n.º 9
0
  //
  // Unsweep for a sight map
  //
  static void Unsweep(Map *map)
  {
    START(unSweepTime);

    PREFETCH(&__prefetch);

    // Last sweep position
    S32 tileX = map->lastX;
    S32 tileZ = map->lastZ;

    // Last sweep radius
    S32 r = map->lastR;

    // Get viewing mask for lower layer
    U8 *mapLo = map->GetByteMap(Map::LV_LO);
    U8 maskLo = map->GetBitMask(Map::LV_LO);

    // Dirty cells that line of sight has changed in
    DirtyCells(tileX - r, tileZ - r, tileX + r, tileZ + r, map->lastTeam);

    // iterate over all tiles within last scan radius
    S32 first = XZToSeemap(-r, -r);

    for (S32 y = -r; y <= r; y++, first += MAPSIDE)
    {
      PREFETCH(&mapLo[first+MAPSIDE]);

      for (S32 x = -r, index = first; x <= r; x++, index++)
      {
        // Unsweep tile on ground level if was swept
        if (mapLo[index] & maskLo)
        {
          // Unsweep for all teams last swept
          CantSee(tileX + x, tileZ + y, x, y, map->lastTeam, Map::LV_LO);

          // Clear seen bit
          mapLo[index] &= ~maskLo;
        }
      }
    }

    // Reset last radius and team mask
    map->lastR = 0;
    map->lastTeam = 0;
    map->lastAlt = F32_MAX;

    STOP(unSweepTime);
  }
Exemplo n.º 10
0
DWORD MC_TextureManager::copyTexture( DWORD texNodeID )
{
	gosASSERT( texNodeID < MC_MAXTEXTURES );
	if ( masterTextureNodes[texNodeID].gosTextureHandle != -1 )
	{
		masterTextureNodes[texNodeID].numUsers++;
		return texNodeID;
	}
	else
	{
		STOP(( "tried to copy an invalid texture" ));
	}

	return -1;

}
Exemplo n.º 11
0
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//
	BitTrace::BitTrace(const char* name):
		Trace(name, BitType)
	{
		activeLine = NextActiveLine++;
		bitFlag = (NextBit < 32) ? 1 << NextBit++ : 0;
		#if defined(USE_ACTIVE_PROFILE)
			DEBUG_STREAM << name << " used trace line "
			 << static_cast<int>(activeLine) << "!\n";
			if (!IsLineValidImplementation(activeLine))
			{
				STOP(("Invalid active trace line!"));
			}
		#endif

		BitTrace::ResetTrace();
	}
Exemplo n.º 12
0
void Apu0F()
{
   // BRK

#if 0
   STOP("BRK");
#else
   PushW((IAPU.PC + 1 - IAPU.RAM));
   S9xAPUPackStatus();
   Push(IAPU.P);
   APUSetBreak();
   APUClearInterrupt();
   // XXX:Where is the BRK vector ???
   IAPU.PC = IAPU.RAM + APU.ExtraRAM[0x20] + (APU.ExtraRAM[0x21] << 8);
#endif
}
Exemplo n.º 13
0
//
//#############################################################################
//#############################################################################
//
void
	UnitQuaternion::TestInstance() const
{

	Scalar diff = x*x + y*y + z*z + w*w - 1.0f;
	if (!Small_Enough(diff))
	{
		UnitQuaternion q2 = *this;
		q2.Normalize();
		diff = q2.x*q2.x + q2.y*q2.y + q2.z*q2.z + q2.w*q2.w - 1.0f;
		if (Small_Enough(diff))
			STOP(("UnitQuaternion needs normalizing"));
	}
	Verify(Small_Enough(diff));

}
Exemplo n.º 14
0
void Master::checkOK(){
	ok = false;
	distanceInform(vel.linear.x, vel.angular.z); 
	checkDistance(vel.linear.x, vel.angular.z);
	if (!ok){
		//if ((vel.linear.x != 0.2) || (vel.angular.x != 0.2) || ((vel.linear.x != 0.0) && (vel.angular.x != 0.0)) ){	
			//reAdjustSpeed();
		//}
		STOP();
	}
	else if(ok){	
		vel_pub_.publish(vel);
	}
	ok = false;

}
Exemplo n.º 15
0
/* Handle bus errors, illegal instruction, etc. */
void
fatal_error_signal (int sig)
{
#ifdef BSD
  int tpgrp;
#endif /* BSD */

  fatal_error_code = sig;
  signal (sig, SIG_DFL);

  /* If fatal error occurs in code below, avoid infinite recursion.  */
  if (fatal_error_in_progress)
    kill (getpid (), fatal_error_code);

  fatal_error_in_progress = 1;

  /* If we are controlling the terminal, reset terminal modes */
#ifdef BSD
  if (ioctl(0, TIOCGPGRP, &tpgrp) == 0
      && tpgrp == getpgrp ())
#endif /* BSD */
    {
      reset_sys_modes ();
      if (sig != SIGTERM)
	fprintf (stderr, "Fatal error (%d).", sig);
    }

  /* Clean up */
#ifdef subprocesses
  kill_buffer_processes (Qnil);
#endif
  Fdo_auto_save (Qt);

#ifdef CLASH_DETECTION
  unlock_all_files ();
#endif /* CLASH_DETECTION */

#ifdef VMS
  kill_vms_processes ();
  LIB$STOP (SS$_ABORT);
#else
  /* Signal the same code; this time it will really be fatal.  */
  kill (getpid (), fatal_error_code);
#endif /* not VMS */
}
Exemplo n.º 16
0
//---------------------------------------------------------------------------
int32_t CSVFile::afterOpen(void)
{
	//-------------------------------------------------------
	// Check if we opened this with CREATE and write the
	// FITini Header and position to Write Start.
	if(fileMode == CREATE && parent == nullptr)
	{
		STOP(("Cannot write CSV files at present."));
	}
	else
	{
		//------------------------------------------------------
		// Find out how many Rows and cols we have
		totalRows = countRows();
		totalCols = countCols();
	}
	return(NO_ERROR);
}
Exemplo n.º 17
0
// 开臂动作
int fnKB(void)
{
	unsigned char xdata n = 0;
	if(FK)
	{
//		afk:
		statusH &= ~0x04; 
		TURN_P(x)
			n = 0;
//		while(FK&&(Task[0] != ModeST))
		while(Task[0] != ModeST)
		{
			if(!FK)
				if(n++ > 6)
					break;
			(*pFunc[ModeMTc])();
			WatchDogFeet();
			(*pFunc[ModeCable])();
			ReadZhibi(x)
		}
		STOP(x)	
//		while(n ++ < 250)
//			WatchDogFeet();
//		if(FK&&(Task[0] != ModeST))
//		{
//			n = 0;
//			goto afk;
//		}
		statusH |= 0x04;	// 清开臂标志
	}
	ReadZhibi(x)
	if(Task[0] == ModeKb)
		TaskCreate(ModeNull);
	return ModeKb;
//	if(FK)
//	{
//		statusH &= ~0x04;
//		STOP(x)
//		TURN_N(x)
//		zbFlag = ModeKb;
//	}
//	TaskCreate(ModeNull);
//	return ModeKb;
}
Exemplo n.º 18
0
void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) {
  Label L;
  BLOCK_COMMENT("verify_ref_kind {");
  __ movl(temp, Address(member_reg, NONZERO(java_lang_invoke_MemberName::flags_offset_in_bytes())));
  __ shrl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
  __ andl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
  __ cmpl(temp, ref_kind);
  __ jcc(Assembler::equal, L);
  { char* buf = NEW_C_HEAP_ARRAY(char, 100, mtInternal);
    jio_snprintf(buf, 100, "verify_ref_kind expected %x", ref_kind);
    if (ref_kind == JVM_REF_invokeVirtual ||
        ref_kind == JVM_REF_invokeSpecial)
      // could do this for all ref_kinds, but would explode assembly code size
      trace_method_handle(_masm, buf);
    __ STOP(buf);
  }
  BLOCK_COMMENT("} verify_ref_kind");
  __ bind(L);
}
inline void Periodic_function<T>::copy_to_global_ptr(T* f_mt__, T* f_it__)
{
    STOP();

    //comm_.allgather(f_it_local_.template at<CPU>(), f_it__, (int)spl_fft_size_.global_offset(), (int)spl_fft_size_.local_size());

    //if (parameters_.full_potential()) 
    //{
    //    mdarray<T, 3> f_mt(f_mt__, angular_domain_size_, unit_cell_.max_num_mt_points(), unit_cell_.num_atoms());
    //    for (int ialoc = 0; ialoc < (int)unit_cell_.spl_num_atoms().local_size(); ialoc++)
    //    {
    //        int ia = unit_cell_.spl_num_atoms(ialoc);
    //        memcpy(&f_mt(0, 0, ia), &f_mt_local_(ialoc)(0, 0), f_mt_local_(ialoc).size() * sizeof(T));
    //    }
    //    int ld = angular_domain_size_ * unit_cell_.max_num_mt_points();
    //    comm_.allgather(f_mt__, static_cast<int>(ld * unit_cell_.spl_num_atoms().global_offset()),
    //                    static_cast<int>(ld * unit_cell_.spl_num_atoms().local_size()));
    //}
}
Exemplo n.º 20
0
// 收臂动作
int fnSL(void)
{
	unsigned int xdata n = 0;
	if(SL)
	{
//		asl:
		statusH &= ~0x08;
		TURN_N(x)
		while(Task[0] != ModeST)
		{
			if(!SL)
				if(n++ > 6)
					break;			
			(*pFunc[ModeMTc])();
			WatchDogFeet();
			(*pFunc[ModeCable])();
			ReadZhibi(x)
		}
		STOP(x)
//		while(n ++ < 250)
//			WatchDogFeet();
//		if(SL && (Task[0] != ModeST))
//		{
//			n = 0;
//			goto asl;
//		}
		statusH |= 0x08;	// 清开臂标志
	}
	ReadZhibi(x)
	if(Task[0] == ModeSl)
		TaskCreate(ModeNull);
	return ModeSl;
//	if(SL)
//	{
//		statusH &=  ~0x08;
//		STOP(x)
//		TURN_N(x)
//		zbFlag = ModeSl;
//	}
//	TaskCreate(ModeNull);
//	return ModeSl;
}
Exemplo n.º 21
0
bool LogisticsSaveDialog::isCorrectVersionSaveGame(PSTR fileName)
{
	FullPathFileName path;
	path.init(savePath, fileName, ".fit");
	FitIniFile file;
	if (NO_ERROR != file.open((PSTR)(PCSTR)path))
	{
		char errorStr[256];
		sprintf(errorStr, "couldn't open file %s", path);
		STOP((errorStr));
	}
	int32_t result = file.seekBlock("Version");
	if (result != NO_ERROR)
		return false;
	int32_t testVersionNum = 0;
	result				   = file.readIdLong("VersionNumber", testVersionNum);
	if ((result == NO_ERROR) && (testVersionNum == SaveGameVersionNumber))
		return true;
	return false;
}
Exemplo n.º 22
0
void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
                                        Register recv, Register method_temp,
                                        Register temp2,
                                        bool for_compiler_entry) {
  BLOCK_COMMENT("jump_to_lambda_form {");
  // This is the initial entry point of a lazy method handle.
  // After type checking, it picks up the invoker from the LambdaForm.
  assert_different_registers(recv, method_temp, temp2);
  assert(recv != noreg, "required register");
  assert(method_temp == rbx, "required register for loading method");

  //NOT_PRODUCT({ FlagSetting fs(TraceMethodHandles, true); trace_method_handle(_masm, "LZMH"); });

  // Load the invoker, as MH -> MH.form -> LF.vmentry
  __ verify_oop(recv);
  __ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())));
  __ verify_oop(method_temp);
  __ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())));
  __ verify_oop(method_temp);
  // the following assumes that a Method* is normally compressed in the vmtarget field:
  __ movptr(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::vmtarget_offset_in_bytes())));

  if (VerifyMethodHandles && !for_compiler_entry) {
    // make sure recv is already on stack
    __ movptr(temp2, Address(method_temp, Method::const_offset()));
    __ load_sized_value(temp2,
                        Address(temp2, ConstMethod::size_of_parameters_offset()),
                        sizeof(u2), /*is_signed*/ false);
    // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
    Label L;
    __ cmpptr(recv, __ argument_address(temp2, -1));
    __ jcc(Assembler::equal, L);
    __ movptr(rax, __ argument_address(temp2, -1));
    __ STOP("receiver not on stack");
    __ BIND(L);
  }

  jump_from_method_handle(_masm, method_temp, temp2, for_compiler_entry);
  BLOCK_COMMENT("} jump_to_lambda_form");
}
Exemplo n.º 23
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
NotationFile::NotationFile(
	const char *file_name,
	Type type
):
	m_pages(NULL)
{
	Check_Pointer(this);
	Check_Pointer(file_name);

	//
	//-----------------------------------------
	// See if we need to read stuff from a file
	//-----------------------------------------
	//
	FileStream file_stream;
	if (gos_DoesFileExist(file_name))
	{
		file_stream.Open(file_name);
		m_fileName = file_stream.GetFileName();
		m_fileDependencies.AddDependency(&file_stream);
	}
	else
		m_fileName = file_name;

	//
	//---------------------------------------------------------------
	// Set up the file dependencies, and finish constructing the file
	//---------------------------------------------------------------
	//
	m_type = type;
	CommonConstruction(&file_stream, NULL);

	//
	//-----------------------------------------------------------
	// Make sure that we don't allow a non-empty file to be empty
	//-----------------------------------------------------------
	//
	if (m_type==NonEmpty && IsEmpty())
		STOP(("%s cannot be empty!", file_name));
}
Exemplo n.º 24
0
Arquivo: il.c Projeto: tangziwen/tina
/*像中间代码添加带列表函数调用代码*/
void IL_ListInsertCall(int type,int tmp_index,int args,int function_index)
{
    IL_node * node=IL_CreateNode (tmp_index);
     node->call=IL_CreateCallListNode (function_index,args);
     switch(type)
     {
     case FUNC_NORMAL:
         node->type=IL_NODE_CALL_LIST;
         break;
    case FUNC_API:
         node->type=IL_NODE_CALL_API;
         break;
    case FUNC_DYNAMIC:
         node->type=IL_NODE_CALL_DYNAMIC;
         break;
    case FUNC_METHOD:
         node->type=IL_NODE_CALL_METHOD;
         break;
        default:
         STOP("IL_ListInsertCall error!");
         break;
     }
    if ( func_get_current()->list.head==NULL )
    {
        func_get_current()->list.head=node;
        func_get_current()->list.head->next=NULL;
    }
    else
    {
        IL_node *tmp=func_get_current()->list.head;
        while ( tmp->next!=NULL )
        {
            tmp=tmp->next;
        }
        tmp->next= node;
        node->pre=tmp;
        node->next=NULL;
    }
}
Exemplo n.º 25
0
void CCity::SetDefaultColor(int nCityID)
{
	PROFILE("CCity::SetDefaultColor(int)");
	switch(nCityID)
		{
		case PCITY:
			m_dwColor = D3DCOLOR_ARGB(255, 0, 255, 255); 
			break;
		case KCITY1:
			m_dwColor = D3DCOLOR_ARGB(255, 120, 255, 120); 
			break;
		case KCITY2:
			m_dwColor = D3DCOLOR_ARGB(255, 0, 255, 0); 
			break;
		case KCITY3:
			m_dwColor = D3DCOLOR_ARGB(255, 0, 170, 0); 
			break;
		case XCITY1:
			m_dwColor = D3DCOLOR_ARGB(255, 255, 180, 0); 
			break;
		case XCITY2:
			m_dwColor = D3DCOLOR_ARGB(255, 255, 128, 0); 
			break;
		case XCITY3:
			m_dwColor = D3DCOLOR_ARGB(255, 255, 90, 0); 
			break;
		case JCITY1:
			m_dwColor = D3DCOLOR_ARGB(255, 209, 147, 255); 
			break;
		case JCITY2:
			m_dwColor = D3DCOLOR_ARGB(255, 178, 0, 255); 
			break;
		case JCITY3:
			m_dwColor = D3DCOLOR_ARGB(255, 132, 0, 140); 
			break;
		}
	STOP("CCity::SetDefaultColor(int)");
}
Exemplo n.º 26
0
uchar twi_read(uchar W_ADDRESS)
{
  	uchar temp;
	START();	   			  	   //TWI启动
	WAIT();
    if (SATUS()!=_START) 
	return TRUE;      
    
    TWI_WRITE(W_MPU6050_ADDR); //写 MPU6050地址和写方式
    WAIT(); 
    if (SATUS()!=MT_SLA_ACK) 
	return TRUE;    
    
   	TWI_WRITE(W_ADDRESS);      //写 MPU6050相应寄存器地址
    WAIT();
    if (SATUS()!=MT_DATA_ACK) 
	return TRUE;
    
    START();            	       //TWI重新启动
    WAIT();
    if (SATUS()!=RE_START)  
	return TRUE;
    
    TWI_WRITE(R_MPU6050_ADDR); //写 MPU6050地址和读方式
    WAIT();
    if(SATUS()!=MR_SLA_ACK)  
	return TRUE;      
    
    TWI_READ();          	   //启动主TWI读方式
    WAIT();
    if(SATUS()!=MR_DATA_NOACK)//读完一个数停止接收数据 ,主机接收到不再接收应答信号 ,如果继续接收到应答信号
	return TRUE;			  //说明主机继续接收数据则为错误	 													 																		 
     
    
    temp=TWDR;        		   //读取 TWI接收数据
    STOP();         		   //TWI停止
    return temp;
}
Exemplo n.º 27
0
void Richardson(double * b, double a, double * x, unsigned int n) {
/*	double tau_opt = 2 / ( lambda_min + mlabda_max ) */
	double tau = ( ( 1.0 ) / (a) );
	double px, tx;
	int i, iterations = 0;
	bzero(x, sizeof(double)*n);
	
	tic();

	while ( ++iterations ) {
		px = x[0];
		x[0] = x[0] - tau*(a*x[0] - x[1] - b[0]);
		for ( i = 1; i < n - 1; ++i ) {
			tx = x[i];
			x[i] = tx - tau*(a*tx - x[i+1] - px - b[i]);
			px = tx;
		}
		x[n-1] = x[n-1] - tau*(a*x[n-1] - px - b[n-1]);
		
		if ( STOP(a, x, b, n, iterations, toc(), 0) )
			break;
	}
}
Exemplo n.º 28
0
int 
namei_release(struct file *filp,int force) {
  START(ftable,namei_rel);
#ifdef NAMEIDEBUG
  PRSHORTFILP("NAMEI_RELEASE:",filp,"");
  printf(" fr:%d\n",force);
#endif
#if 0
  if (filp == __current->root) {
    printf("Trying to release root filp\n");
    goto done;
  }
#endif
  /* ignore do not release for now */
  if (1 || !(filp->f_flags & O_DONOTRELEASE) || force) {
    if (CHECKOP(filp,release)) {
      DOOP(filp,release,(filp));
    }
  }
done:
  STOP(ftable,namei_rel);
  return 0;
}
Exemplo n.º 29
0
Arquivo: var.c Projeto: tangziwen/tina
/*通过名字查找当前被扫描函数的局部变量的索引*/
int var_get_local_index(const char *var_name,int layer)
{
	/*让索引指向当前层的最后一个变量*/
	int index=0;
	for(index=0; func_get_current()->var_list[index].layer!=(layer+1)&&func_get_current()->var_list[index].layer!=-1; index++)
	{

	}
	index --;
	/*然后根据索引值从后往前找,这样的话.会先找到最近层次的变量,从而屏蔽外部层次的变量名*/
	int i=0;
	for(i=index; i>=0; i--)
	{
		if(strcmp(var_name,func_get_current()->var_list[i].name)==0)
		{
			return i;
		}
	}
    char error_str[128];
    sprintf(error_str,"%s is an undefined symbol\n",var_name);
    STOP("%s\n",error_str);
	return -3;
}
Exemplo n.º 30
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	SortData::DrawQuads()
{
	Start_Timer(GOS_Draw_Time);

#ifdef LAB_ONLY
	if(dontSeeMe == true)
#endif
	{
		if(texture2==0)
		{
//			gos_DrawTriangles( (GOSVertex *)vertices, numVertices);
			gos_DrawQuads( (GOSVertex *)vertices, numVertices);
		}
		else
		{
			STOP(("GOS doesnt suppert gos_DrawQuads for gos_VERTEX_2UV yet."));
//			gos_DrawQuads( (GOSVertex2UV *)vertices, numVertices);
		}

	}
	Stop_Timer(GOS_Draw_Time);
}