• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BIND函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BIND函数的典型用法代码示例。如果您正苦于以下问题:C++ BIND函数的具体用法?C++ BIND怎么用?C++ BIND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BIND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AutoGL_SetUp

void AutoGL_SetUp (int argc, char *argv[])
{
  AutoGL_SetViewRedrawCallback (BIND(autogl_redraw));
  AutoGL_SetIdleEventCallback (BIND(autogl_idle));

  BIND(autogl_setup) ();
}
开发者ID:kuvo1017,项目名称:advmates,代码行数:7,代码来源:autogl_fortran.c


示例2: loading_

COMA_USING_NS

ResourceManager::ResourceManager() : loading_(false)
{
	SetEventListener(ResourceManagerEvent::LOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
	SetEventListener(ResourceManagerEvent::UNLOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
}
开发者ID:letepyu,项目名称:Coma2D,代码行数:7,代码来源:ResourceManager.cpp


示例3: BIND

Weapon::Weapon(const WeaponConfig * pConfig) {
    m_pConfig = pConfig;
    m_bullet_level = BULLET_LEVEL_1;
    
    BIND(BUND_ID_WEAPON_FIRE, this, Weapon::OnCmdFire);
    BIND(BUND_ID_BULLET_LEVEL_UP, this, Weapon::OnCmdBulletUp);
}
开发者ID:joyfish,项目名称:PlaneWar,代码行数:7,代码来源:Weapon.cpp


示例4: EMPLACE

 vexcl_steppers::vexcl_steppers(tensor_factory& f, cse& cw, lambda_manager& lm, translator_data& p, language_printer& prn)
   : ::macro_packages::replacement_rule_package(f, cw, lm, p, prn)
   {
     EMPLACE(pre_package, BIND(replace_backg_stepper, "MAKE_BACKG_STEPPER"));
     EMPLACE(pre_package, BIND(replace_pert_stepper, "MAKE_PERT_STEPPER"));
     EMPLACE(pre_package, BIND(stepper_name, "BACKG_STEPPER"));
     EMPLACE(pre_package, BIND(stepper_name, "PERT_STEPPER"));
   }
开发者ID:ds283,项目名称:CppTransport,代码行数:8,代码来源:vexcl_steppers.cpp


示例5: GetAPI

void clGLVertexArray::AfterConstruction()
{
	iVertexArray::AfterConstruction();

	GetAPI( Env );

	Env->Connect( L_EVENT_SURFACE_ATTACHED, BIND( &clGLVertexArray::Event_SURFACE_ATTACHED ) );
	Env->Connect( L_EVENT_SURFACE_DETACHED, BIND( &clGLVertexArray::Event_SURFACE_DETACHED ) );
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:9,代码来源:GLVertexArray.cpp


示例6: RegisterCommand

void clConsole::AfterConstruction()
{
	RegisterCommand( "Quit",             Utils::Bind( &clConsole::QuitC,          this ) );
	RegisterCommand( "Exit",             Utils::Bind( &clConsole::QuitC,          this ) );
	RegisterCommand( "Exec",             Utils::Bind( &clConsole::ExecC,          this ) );
	RegisterCommand( "Bind",             Utils::Bind( &clConsole::BindC,          this ) );
	RegisterCommand( "Alias",            Utils::Bind( &clConsole::AliasC,         this ) );
	RegisterCommand( "ToggleConsole",    Utils::Bind( &clConsole::ToggleConsoleC, this ) );
	RegisterCommand( "Mount",            Utils::Bind( &clConsole::MountC,         this ) );
	RegisterCommand( "Clear",            Utils::Bind( &clConsole::ClearC,         this ) );
	RegisterCommand( "Version",          Utils::Bind( &clConsole::VersionC,       this ) );
	RegisterCommand( "Help",             Utils::Bind( &clConsole::HelpC,          this ) );
	RegisterCommand( "CmdList",          Utils::Bind( &clConsole::HelpC,          this ) );
	RegisterCommand( "TogglePause",      Utils::Bind( &clConsole::TogglePauseC,   this ) );
	RegisterCommand( "Toggle",           Utils::Bind( &clConsole::ToggleC,        this ) );
	RegisterCommand( "Set",              Utils::Bind( &clConsole::SetC,           this ) );
	RegisterCommand( "SetProperty",      Utils::Bind( &clConsole::SetPropertyC,   this ) );
	RegisterCommand( "Show",             Utils::Bind( &clConsole::ShowC,          this ) );
	RegisterCommand( "Menu",             Utils::Bind( &clConsole::MenuC,          this ) );
	RegisterCommand( "SaveVars",         Utils::Bind( &clConsole::SaveVarsC,      this ) );
	RegisterCommand( "RefreshScreen",    Utils::Bind( &clConsole::RefreshScreenC, this ) );
	RegisterCommand( "Sleep",            Utils::Bind( &clConsole::SleepC,         this ) );
	RegisterCommand( "SetLogLevel",      Utils::Bind( &clConsole::SetLogLevelC,   this ) );
	RegisterCommand( "PrintLogLevel",    Utils::Bind( &clConsole::PrintLogLevelC, this ) );

	RegisterCommand( "AddDirWatch",      Utils::Bind( &clFileSystem::AddDirWatchC,     Env->FileSystem ) );
	RegisterCommand( "AddFileWatch",     Utils::Bind( &clFileSystem::AddFileWatchC,    Env->FileSystem ) );
	RegisterCommand( "RemoveDirWatch",   Utils::Bind( &clFileSystem::RemoveDirWatchC,  Env->FileSystem ) );
	RegisterCommand( "RemoveFileWatch",  Utils::Bind( &clFileSystem::RemoveFileWatchC, Env->FileSystem ) );

	Env->Logger->Connect( L_EVENT_ERROR,       BIND( &clConsole::Event_ERROR ) );
	Env->Connect( L_EVENT_TIMER,       BIND( &clConsole::Event_TIMER ) );
	Env->ConnectWithPriority( L_EVENT_KEY,         BIND( &clConsole::Event_KEY         ),  -1 );

	FConsoleHUDFileName = GetVar( "GUI.ConsoleHUD" );
	FConsoleHUDFileName->SetString( "Interface/Console.gui" );

	FShouldSaveHistory = GetVar ( "Console.SaveHistory" );
	FShouldSaveHistory->SetBool( true );

	GetVarDefault( "Core.EngineVersion", ENGINE_VERSION );

	if ( Env->FileSystem->FileExists( HistoryFileName ) )
	{
		iIStream* Input = Env->FileSystem->CreateFileReader( HistoryFileName );

		FCommandsHistory->LoadFromStream( Input );

		delete( Input );
	}

	// instantiate script compiler
	// its initialization is delayed until some script is actually compiled
	FScriptCompiler = Env->Linker->Instantiate( "clScriptCompiler" );
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:55,代码来源:Console.cpp


示例7: BIND

bool InputBinder::try_bind_scene_entity_to_input(
    const Scene&                    scene,
    const SymbolTable&              scene_symbols,
    const char*                     entity_type,
    const char*                     entity_name,
    const char*                     param_value,
    InputArray::iterator&           input)
{
    if (input.format() == InputFormatEntity)
    {
        #define BIND(symbol, collection)                        \
            case symbol:                                        \
              input.bind(collection.get_by_name(param_value));  \
              return true

        switch (scene_symbols.lookup(param_value))
        {
          BIND(SymbolTable::SymbolColor, scene.colors());
          BIND(SymbolTable::SymbolTexture, scene.textures());
          BIND(SymbolTable::SymbolTextureInstance, scene.texture_instances());
          BIND(SymbolTable::SymbolEnvironmentEDF, scene.environment_edfs());
          BIND(SymbolTable::SymbolEnvironmentShader, scene.environment_shaders());
        }

        #undef BIND
    }
    else
    {
        switch (scene_symbols.lookup(param_value))
        {
          case SymbolTable::SymbolColor:
            bind_color_to_input(
                scene.colors(),
                param_value,
                input);
            return true;

          case SymbolTable::SymbolTextureInstance:
            bind_texture_instance_to_input(
                scene.texture_instances(),
                ~0,                 // the parent is the scene, not an assembly
                entity_type,
                entity_name,
                param_value,
                input);
            return true;
        }
    }

    return false;
}
开发者ID:marius-avram,项目名称:appleseed,代码行数:51,代码来源:inputbinder.cpp


示例8: main

int main()
{
    typedef void(*Callfp)();

    Callfp u;
    BIND( u, Base::f );
    u();
    Callfp v;
    BIND( v, Base::g );
    v();
    Callfp w;
    BIND( w, Base::h );
    w();
}
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp


示例9: CCASSERT

void Battle::onEnter() {
    PublicUI::onEnter();
    CCASSERT(s_mission_name != ""
             && NULL != (m_pConfig = g_pGameConfig->getMissionConfig(s_mission_name)),
             "set mission first");
    
    schedule(schedule_selector(Battle::collidtion), 1/60.0f);
    
    m_pBoss = NULL;
    
    mask();
    ArmatureDataManager::getInstance()->addArmatureFileInfo("Animation/UI/readygo.ExportJson");
    m_pReadygo = Armature::create("readygo");
    m_pReadygo->setAnchorPoint(Vec2(.5f, .5f));
    this->addChild(m_pReadygo, GRADE_UI);
    m_pReadygo->setPosition(g_pGameConfig->screenCenterPoint);
    m_pReadygo->getAnimation()->play("readygo");
    m_pReadygo->setScale(g_pGameConfig->scaleEleMin * 1.5f);
    m_pReadygo->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(Battle::playActionOver));
    
    s_enemy_count = 0;
    s_itor = m_pConfig->events.begin();
    if (s_itor != m_pConfig->events.end()) {
        CTimer * timer = CTimer::create(&(*s_itor), BUND_ID_BATTLE_EVENT, 0, 0, s_itor->delay);
        addChild(timer);
    }
    
    BIND(BUND_ID_BULLET_FIRED, this, Battle::bulletFired);
    BIND(BUND_ID_BULLET_DISAPPEARED, this, Battle::bulletDisappear);
    BIND(BUND_ID_BATTLE_EVENT, this, Battle::event_exec);
    BIND(BUND_ID_ENEMY_EVENT, this, Battle::enemy_event);
    BIND(BUND_ID_ENEMY_DISAPPEAR, this, Battle::enemydisappear);
    BIND(BUND_ID_PLANE_DISAPPEAR, this, Battle::planedisappear);
    BIND(BUND_ID_PLANE_INJURED, this, Battle::planeinjured);
    BIND(BUND_ID_GLOBAL_TOUCH_BEGAN, this, Battle::globalTouchBegan);
    BIND(BUND_ID_BOSS_DISAPPEAR, this, Battle::bossdisappear);
    
    SEquip equip;
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_PLANE, equip);
    m_pPlane = Plane::create(equip);
    m_pPlane->setScale(g_pGameConfig->scaleEleMin * .75f);
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_WEAPON, equip);
    m_pPlane->addWeapon(equip);
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_WINGMAN, equip);
    m_pPlane->addWingman(equip);
    
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_ARMOR, equip);
    m_pPlane->addArmor(equip);
    
    m_pPlane->setPosition(Vec2(g_pGameConfig->screenCenterPoint.x, 0));
    addChild(m_pPlane, GRADE_PLAYER);
    ActionInterval * action = EaseExponentialOut::create(MoveBy::create(2, Vec2(0, 500 * g_pGameConfig->scaleEleY)));
    m_pPlane->runAction(action);
}
开发者ID:joyfish,项目名称:PlaneWar,代码行数:54,代码来源:BattleScene.cpp


示例10: AlphaBeta

	int AlphaBeta  (const uint64_t P, const uint64_t O, uint64_t& NodeCounter, int alpha, int beta)
	{
		const uint64_t empties = Empties(P, O);
		if (empties == 4)
			return AlphaBeta_4(P, O, NodeCounter, alpha, beta);

		uint64_t flipped;
		uint64_t BitBoardPossible = PossibleMoves(P, O);
		unsigned long Move;
		int score = -64;
		NodeCounter++;

		if (!BitBoardPossible){
			if (HasMoves(O, P))
				return -AlphaBeta(O, P, NodeCounter, -beta, -alpha);
			else //Game is over
				return BIND(EvalGameOver(P, empties), alpha, beta);
		}

		while (BitBoardPossible)
		{
			Move = BitScanLSB(BitBoardPossible);
			RemoveLSB(BitBoardPossible);
			flipped = flip(P, O, Move);
			score = -AlphaBeta(O ^ flipped, P ^ (1ULL << Move) ^ flipped, NodeCounter, -beta, -alpha);
			if (score >= beta) return beta;
			if (score > alpha) alpha = score;
		}

		return alpha;
	}
开发者ID:PanicSheep,项目名称:Cassandra,代码行数:31,代码来源:endgame_negamax.cpp


示例11: assert

void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                            bool for_compiler_entry) {
  assert(method == rmethod, "interpreter calling convention");
  Label L_no_such_method;
  __ cbz(rmethod, L_no_such_method);
  __ verify_method_ptr(method);

  if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
    Label run_compiled_code;
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
    // compiled code in threads for which the event is enabled.  Check here for
    // interp_only_mode if these events CAN be enabled.

    __ ldrb(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
    __ cbnz(rscratch1, run_compiled_code);
    __ ldr(rscratch1, Address(method, Method::interpreter_entry_offset()));
    __ br(rscratch1);
    __ BIND(run_compiled_code);
  }

  const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                     Method::from_interpreted_offset();
  __ ldr(rscratch1,Address(method, entry_offset));
  __ br(rscratch1);
  __ bind(L_no_such_method);
  __ far_jump(RuntimeAddress(StubRoutines::throw_AbstractMethodError_entry()));
}
开发者ID:campolake,项目名称:openjdk9,代码行数:27,代码来源:methodHandles_aarch64.cpp


示例12: LP64_ONLY

void MethodHandles::verify_klass(MacroAssembler* _masm,
                                 Register obj, SystemDictionary::WKID klass_id,
                                 const char* error_message) {
  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  Register temp = rdi;
  Register temp2 = noreg;
  LP64_ONLY(temp2 = rscratch1);  // used by MacroAssembler::cmpptr
  Label L_ok, L_bad;
  BLOCK_COMMENT("verify_klass {");
  __ verify_oop(obj);
  __ testptr(obj, obj);
  __ jcc(Assembler::zero, L_bad);
  __ push(temp); if (temp2 != noreg)  __ push(temp2);
#define UNPUSH { if (temp2 != noreg)  __ pop(temp2);  __ pop(temp); }
  __ load_klass(temp, obj);
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ jcc(Assembler::equal, L_ok);
  intptr_t super_check_offset = klass->super_check_offset();
  __ movptr(temp, Address(temp, super_check_offset));
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ jcc(Assembler::equal, L_ok);
  UNPUSH;
  __ bind(L_bad);
  __ STOP(error_message);
  __ BIND(L_ok);
  UNPUSH;
  BLOCK_COMMENT("} verify_klass");
}
开发者ID:pombreda,项目名称:graal,代码行数:29,代码来源:methodHandles_x86.cpp


示例13: main

int main(int argc,char *argv[]){
	int sock,newsock;
	int portNum,pid;
	socklen_t clientLen;
	struct sockaddr_in server_addr;
	struct sockaddr_in client_addr;
	char buffer[1000];

	if(argc != 2){
		printf("ERROR, wrong number of arguments!\n");
		printf("./ftps portNumber");
		exit(0);
	}
	sock = SOCKET(AF_INET,SOCK_STREAM,0);
	if(sock < 0){
		printf("ERROR OPENING SOCKET!");
		exit(0);
	}
	/*Sets up connection for the server */
	//portNum = atoi(argv[1]);
	server_addr.sin_family = AF_INET;
	server_addr.sin_addr.s_addr = 0;
	server_addr.sin_port = htons(SERVERPORT);
	
	if(BIND(sock,(struct sockaddr *)&server_addr,sizeof(server_addr)) < 0){
		perror("ERROR binding to socket!");
		exit(0);
	}
	
	receiveFile(sock);
		
	return 0;	
}
开发者ID:Roman32,项目名称:CSE5462Lab3,代码行数:33,代码来源:ftps.c


示例14: assert

void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                            bool for_compiler_entry) {
  assert(method == rbx, "interpreter calling convention");
  __ verify_method_ptr(method);

  if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
    Label run_compiled_code;
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
    // compiled code in threads for which the event is enabled.  Check here for
    // interp_only_mode if these events CAN be enabled.
#ifdef _LP64
    Register rthread = r15_thread;
#else
    Register rthread = temp;
    __ get_thread(rthread);
#endif
    // interp_only is an int, on little endian it is sufficient to test the byte only
    // Is a cmpl faster?
    __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0);
    __ jccb(Assembler::zero, run_compiled_code);
    __ jmp(Address(method, Method::interpreter_entry_offset()));
    __ BIND(run_compiled_code);
  }

  const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                     Method::from_interpreted_offset();
  __ jmp(Address(method, entry_offset));
}
开发者ID:pombreda,项目名称:graal,代码行数:28,代码来源:methodHandles_x86.cpp


示例15: SOCKET

bool TcpServer::init(int port_num)
{
  int rc;
  bool rtn;
  const int reuse_addr = 1;
  //int err;
  SOCKLEN_T addrSize = 0;

  rc = SOCKET(AF_INET, SOCK_STREAM, 0);
  if (this->SOCKET_FAIL != rc)
  {
    this->setSrvrHandle(rc);
    LOG_DEBUG("Socket created, rc: %d", rc);
    LOG_DEBUG("Socket handle: %d", this->getSrvrHandle());

    
    SET_REUSE_ADDR(this->getSrvrHandle(), reuse_addr);

    // Initialize address data structure
    memset(&this->sockaddr_, 0, sizeof(this->sockaddr_));
    this->sockaddr_.sin_family = AF_INET;
    this->sockaddr_.sin_addr.s_addr = INADDR_ANY;
    this->sockaddr_.sin_port = HTONS(port_num);

    addrSize = sizeof(this->sockaddr_);
    rc = BIND(this->getSrvrHandle(), (sockaddr *)&(this->sockaddr_), addrSize);

    if (this->SOCKET_FAIL != rc)
    {
      LOG_INFO("Server socket successfully initialized");

      rc = LISTEN(this->getSrvrHandle(), 1);

      if (this->SOCKET_FAIL != rc)
      {
        LOG_INFO("Socket in listen mode");
        rtn = true;
      }
      else
      {
        LOG_ERROR("Failed to set socket to listen");
        rtn = false;
      }
    }
    else
    {
      LOG_ERROR("Failed to bind socket, rc: %d", rc);
      CLOSE(this->getSrvrHandle());
      rtn = false;
    }

  }
  else
  {
    LOG_ERROR("Failed to create socket, rc: %d", rc);
    rtn = false;
  }

  return rtn;
}
开发者ID:ZahraZahra,项目名称:swri-ros-pkg,代码行数:60,代码来源:tcp_server.cpp


示例16: BLOCK_COMMENT

void MethodHandles::verify_klass(MacroAssembler* _masm,
                                 Register obj, SystemDictionary::WKID klass_id,
                                 const char* error_message) {
  InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  Register temp = rscratch2;
  Register temp2 = rscratch1; // used by MacroAssembler::cmpptr
  Label L_ok, L_bad;
  BLOCK_COMMENT("verify_klass {");
  __ verify_oop(obj);
  __ cbz(obj, L_bad);
  __ push(RegSet::of(temp, temp2), sp);
  __ load_klass(temp, obj);
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ br(Assembler::EQ, L_ok);
  intptr_t super_check_offset = klass->super_check_offset();
  __ ldr(temp, Address(temp, super_check_offset));
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ br(Assembler::EQ, L_ok);
  __ pop(RegSet::of(temp, temp2), sp);
  __ bind(L_bad);
  __ stop(error_message);
  __ BIND(L_ok);
  __ pop(RegSet::of(temp, temp2), sp);
  BLOCK_COMMENT("} verify_klass");
}
开发者ID:campolake,项目名称:openjdk9,代码行数:26,代码来源:methodHandles_aarch64.cpp


示例17: pc

address AbstractInterpreterGenerator::generate_result_handler_for(BasicType type) {
  //
  // Registers alive
  //   R3_RET
  //   LR
  //
  // Registers updated
  //   R3_RET
  //

  Label done;
  address entry = __ pc();

  switch (type) {
  case T_BOOLEAN:
    // convert !=0 to 1
    __ neg(R0, R3_RET);
    __ orr(R0, R3_RET, R0);
    __ srwi(R3_RET, R0, 31);
    break;
  case T_BYTE:
     // sign extend 8 bits
     __ extsb(R3_RET, R3_RET);
     break;
  case T_CHAR:
     // zero extend 16 bits
     __ clrldi(R3_RET, R3_RET, 48);
     break;
  case T_SHORT:
     // sign extend 16 bits
     __ extsh(R3_RET, R3_RET);
     break;
  case T_INT:
     // sign extend 32 bits
     __ extsw(R3_RET, R3_RET);
     break;
  case T_LONG:
     break;
  case T_OBJECT:
    // unbox result if not null
    __ cmpdi(CCR0, R3_RET, 0);
    __ beq(CCR0, done);
    __ ld(R3_RET, 0, R3_RET);
    __ verify_oop(R3_RET);
    break;
  case T_FLOAT:
     break;
  case T_DOUBLE:
     break;
  case T_VOID:
     break;
  default: ShouldNotReachHere();
  }

  __ BIND(done);
  __ blr();

  return entry;
}
开发者ID:lizhekang,项目名称:TCJDK,代码行数:59,代码来源:interpreter_ppc.cpp


示例18: BIND

void clLocalizer::AfterConstruction()
{
	iObject::AfterConstruction();

	FLocalePath = "Localizer";

	Env->Connect( L_EVENT_LOCALE_CHANGED, BIND( &clLocalizer::Event_LOCALE_CHANGED ) );
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:8,代码来源:Localizer.cpp


示例19: main

int main(int argc, char *argv[]) {
    int sockfd;
    struct addrinfo hints, *servinfo;
    int status;
    
    if (argc != 2) {
        printf("Usage: %s <port>\n", argv[0]);
        return 1;
    }
    printf("ftps: Starting server on port %s...\n", argv[1]);
    
    // Create output folder
    if (mkdir(OUTPUT_DIR, S_IRWXU) == -1) {
        int err = errno;
        if (err != EEXIST) {
            fprintf(stderr, "ftps: Error creating output directory: %s\n",
                    strerror(err));
            exit(1);
        }
    }
    
    // Setup structures
    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_PASSIVE;
    if ((status = getaddrinfo(NULL, argv[1], &hints, &servinfo)) != 0) {
        fprintf(stderr, "ftps: getaddrinfo: %s\n", gai_strerror(status));
        return 1;
    }
    
    // Get socket
    if ((sockfd = SOCKET(servinfo->ai_family, servinfo->ai_socktype,
                         servinfo->ai_protocol)) == -1) {
        perror("ftps: socket");
        exit(1);
    }
    // Bind
    if (BIND(sockfd, servinfo->ai_addr, servinfo->ai_addrlen) == -1) {
        perror("ftps: bind");
        CLOSE(sockfd);
        exit(1);
    }
    
    // Accept - Block until connection
    while (ACCEPT(sockfd, servinfo->ai_addr, &(servinfo->ai_addrlen)) != 0);
    
    // Clean up
    freeaddrinfo(servinfo);
    
    // Wait for file then exit
    receiveFile(sockfd);
    CLOSE(sockfd);
    exit(0);
    
    return 0;
}
开发者ID:mmiikkeea,项目名称:network-programming,代码行数:57,代码来源:ftps.c


示例20: BIND

void BIND(autogl_set_idle_event_callback) 
(int *flag)
{
  if (*flag) {
    AutoGL_SetIdleEventCallback (BIND(autogl_idle));
  } else {
    AutoGL_SetIdleEventCallback (NULL);
  }
}
开发者ID:kuvo1017,项目名称:advmates,代码行数:9,代码来源:autogl_fortran.c



注:本文中的BIND函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BIND_ENUM_CONSTANT函数代码示例发布时间:2022-05-30
下一篇:
C++ BIF_RET函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap