您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ startup函数代码示例

51自学网 2021-06-03 08:22:25
  C++
这篇教程C++ startup函数代码示例写得很实用,希望能帮到您。

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

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

示例1: initializeGlobalShardingState

Status initializeGlobalShardingState(OperationContext* txn,                                     const ConnectionString& configCS,                                     bool allowNetworking) {    if (configCS.type() == ConnectionString::SYNC) {        return {ErrorCodes::UnsupportedFormat,                "SYNC config server connection string is not allowed."};    }    SyncClusterConnection::setConnectionValidationHook(        [](const HostAndPort& target, const executor::RemoteCommandResponse& isMasterReply) {            return ShardingNetworkConnectionHook::validateHostImpl(target, isMasterReply);        });    auto network =        executor::makeNetworkInterface("NetworkInterfaceASIO-ShardRegistry",                                       stdx::make_unique<ShardingNetworkConnectionHook>(),                                       stdx::make_unique<ShardingEgressMetadataHook>());    auto networkPtr = network.get();    auto shardRegistry(        stdx::make_unique<ShardRegistry>(stdx::make_unique<RemoteCommandTargeterFactoryImpl>(),                                         makeTaskExecutorPool(std::move(network)),                                         networkPtr,                                         makeTaskExecutor(executor::makeNetworkInterface(                                             "NetworkInterfaceASIO-ShardRegistry-TaskExecutor")),                                         configCS));    auto catalogManager = makeCatalogManager(getGlobalServiceContext(),                                             shardRegistry.get(),                                             HostAndPort(getHostName(), serverGlobalParams.port));    shardRegistry->startup();    grid.init(std::move(catalogManager),              std::move(shardRegistry),              stdx::make_unique<ClusterCursorManager>(getGlobalServiceContext()->getClockSource()));    while (!inShutdown()) {        try {            Status status = grid.catalogManager(txn)->startup(txn, allowNetworking);            uassertStatusOK(status);            if (serverGlobalParams.configsvrMode == CatalogManager::ConfigServerMode::NONE) {                grid.shardRegistry()->reload(txn);            }            return Status::OK();        } catch (const DBException& ex) {            Status status = ex.toStatus();            if (status == ErrorCodes::ReplicaSetNotFound) {                // ReplicaSetNotFound most likely means we've been waiting for the config replica                // set to come up for so long that the ReplicaSetMonitor stopped monitoring the set.                // Rebuild the config shard to force the monitor to resume monitoring the config                // servers.                grid.shardRegistry()->rebuildConfigShard();            }            log() << "Error initializing sharding state, sleeping for 2 seconds and trying again"                  << causedBy(status);            sleepmillis(2000);            continue;        }    }    return Status::OK();}
开发者ID:brianleepzx,项目名称:mongo,代码行数:61,


示例2: Exception

//.........这里部分代码省略.........        if (lit->value.getType() != Field::Types::String)            throw Exception(description + String(" must be string literal (in single quotes)."), ErrorCodes::BAD_ARGUMENTS);        return safeGet<const String &>(lit->value);    };    if (is_cluster_function)    {        ASTPtr ast_name = evaluateConstantExpressionOrIdentifierAsLiteral(args[arg_num], context);        cluster_name = static_cast<const ASTLiteral &>(*ast_name).value.safeGet<const String &>();    }    else    {        if (auto ast_cluster = typeid_cast<const ASTIdentifier *>(args[arg_num].get()))            cluster_name = ast_cluster->name;        else            cluster_description = getStringLiteral(*args[arg_num], "Hosts pattern");    }    ++arg_num;    args[arg_num] = evaluateConstantExpressionOrIdentifierAsLiteral(args[arg_num], context);    remote_database = static_cast<const ASTLiteral &>(*args[arg_num]).value.safeGet<String>();    ++arg_num;    size_t dot = remote_database.find('.');    if (dot != String::npos)    {        /// NOTE Bad - do not support identifiers in backquotes.        remote_table = remote_database.substr(dot + 1);        remote_database = remote_database.substr(0, dot);    }    else    {        if (arg_num >= args.size())            throw Exception(help_message, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);        args[arg_num] = evaluateConstantExpressionOrIdentifierAsLiteral(args[arg_num], context);        remote_table = static_cast<const ASTLiteral &>(*args[arg_num]).value.safeGet<String>();        ++arg_num;    }    /// Username and password parameters are prohibited in cluster version of the function    if (!is_cluster_function)    {        if (arg_num < args.size())        {            username = getStringLiteral(*args[arg_num], "Username");            ++arg_num;        }        else            username = "default";        if (arg_num < args.size())        {            password = getStringLiteral(*args[arg_num], "Password");            ++arg_num;        }    }    if (arg_num < args.size())        throw Exception(help_message, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);    /// ExpressionAnalyzer will be created in InterpreterSelectQuery that will meet these `Identifier` when processing the request.    /// We need to mark them as the name of the database or table, because the default value is column.    for (auto & arg : args)        if (ASTIdentifier * id = typeid_cast<ASTIdentifier *>(arg.get()))            id->kind = ASTIdentifier::Table;    ClusterPtr cluster;    if (!cluster_name.empty())    {        /// Use an existing cluster from the main config        cluster = context.getCluster(cluster_name);    }    else    {        /// Create new cluster from the scratch        size_t max_addresses = context.getSettingsRef().table_function_remote_max_addresses;        std::vector<String> shards = parseDescription(cluster_description, 0, cluster_description.size(), ',', max_addresses);        std::vector<std::vector<String>> names;        for (size_t i = 0; i < shards.size(); ++i)            names.push_back(parseDescription(shards[i], 0, shards[i].size(), '|', max_addresses));        if (names.empty())            throw Exception("Shard list is empty after parsing first argument", ErrorCodes::BAD_ARGUMENTS);        cluster = std::make_shared<Cluster>(context.getSettings(), names, username, password, context.getTCPPort(), false);    }    auto res = StorageDistributed::createWithOwnCluster(        getName(),        getStructureOfRemoteTable(*cluster, remote_database, remote_table, context),        remote_database,        remote_table,        cluster,        context);    res->startup();    return res;}
开发者ID:kellylg,项目名称:ClickHouse,代码行数:101,


示例3: CoastalMain

//.........这里部分代码省略.........    QWidget *toolbar = extendToolbar(ui.toolBar);    tb.setupUi(toolbar);    QSettings settings;    resize(settings.value("size", QSize(760, 540)).toSize());#ifdef Q_OS_WIN    const char *separator = ";";    QString manpath = settings.value("manpath").toString();    if(manpath.isEmpty())        manpath = "C://tools//man";#else    const char *separator = ":";    QString manpath = getenv("MANPATH");    if(manpath.isEmpty())        manpath = settings.value("manpath").toString();    if(manpath.isEmpty())        manpath = "/usr/share/man:/usr/local/share/man";#endif    manpaths = manpath.split(separator, QString::SkipEmptyParts);    sections[0] = ui.actionSection1;    sections[1] = ui.actionSection2;    sections[2] = ui.actionSection3;    sections[3] = ui.actionSection4;    sections[4] = ui.actionSection5;    sections[5] = ui.actionSection6;    sections[6] = ui.actionSection7;    sections[7] = ui.actionSection8;    sections[8] = ui.actionSectionl;    sections[9] = ui.actionSectionn;    settings.beginGroup("Sections");    ui.actionSection1->setChecked(settings.value("1", ui.actionSection1->isChecked()).toBool());    ui.actionSection2->setChecked(settings.value("2", ui.actionSection2->isChecked()).toBool());    ui.actionSection3->setChecked(settings.value("3", ui.actionSection3->isChecked()).toBool());    ui.actionSection4->setChecked(settings.value("4", ui.actionSection4->isChecked()).toBool());    ui.actionSection5->setChecked(settings.value("5", ui.actionSection5->isChecked()).toBool());    ui.actionSection6->setChecked(settings.value("6", ui.actionSection6->isChecked()).toBool());    ui.actionSection7->setChecked(settings.value("7", ui.actionSection7->isChecked()).toBool());    ui.actionSection8->setChecked(settings.value("8", ui.actionSection8->isChecked()).toBool());    ui.actionSectionl->setChecked(settings.value("l", ui.actionSectionl->isChecked()).toBool());    ui.actionSectionn->setChecked(settings.value("n", ui.actionSectionn->isChecked()).toBool());    settings.endGroup();    searchGroup = new QActionGroup(this);    ui.actionIndex->setActionGroup(searchGroup);    ui.actionKeywords->setActionGroup(searchGroup);    ui.indexView->setEnabled(false);    ui.indexView->setShowGrid(false);    ui.indexView->setSortingEnabled(false);    ui.indexView->setSelectionBehavior(QAbstractItemView::SelectRows);    ui.indexView->setEditTriggers(QAbstractItemView::NoEditTriggers);    ui.indexView->setSelectionMode(QAbstractItemView::SingleSelection);    ui.indexView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);    ui.indexView->setContextMenuPolicy(Qt::CustomContextMenu);    connect(ui.indexView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(open(const QPoint&)));    // menu action signals    connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT(options()));    connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about()));    connect(ui.actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));    connect(ui.actionReload, SIGNAL(triggered()), this, SLOT(reload()));    connect(ui.actionSupport, SIGNAL(triggered()), this, SLOT(support()));    connect(ui.actionAll, SIGNAL(triggered()), this, SLOT(all()));    connect(ui.actionClear, SIGNAL(triggered()), this, SLOT(clear()));    for(unsigned pos = 0; pos < 10; ++pos)        connect(sections[pos], SIGNAL(triggered()), this, SLOT(reload()));    // input validation    tb.searchBox->setValidator(index_validator);    // forms, tabs, and view signals    connect(tb.searchBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(search(const QString&)));    connect(tb.searchBox, SIGNAL(activated(const QString&)), this, SLOT(load(const QString&)));    connect(ui.tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(close(int)));    connect(ui.indexView, SIGNAL(activated(const QModelIndex&)), this, SLOT(load(const QModelIndex&)));    connect(ui.actionView, SIGNAL(triggered()), this, SLOT(view()));    connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(open()));    // application signals    connect(this, SIGNAL(resized()), this, SLOT(columns()));    connect(this, SIGNAL(startup()), this, SLOT(reload()), Qt::QueuedConnection);    setContextMenuPolicy(Qt::CustomContextMenu);    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(menu(const QPoint&)));    emit startup();}
开发者ID:dyfet,项目名称:coastal-qt,代码行数:101,


示例4: startup

 //! Startup with given logger. void startup(logger_ptr logger) {   startup(std::thread::hardware_concurrency(), logger, 0, true); }
开发者ID:nousxiong,项目名称:actorx,代码行数:5,


示例5: main

int main(int argc, char **argv) {	int return_status = 1;	#define MAIN_SDL_CHECK(expression, error_prefix) { /		if (!(expression)) { /			log_error(error_prefix, SDL_GetError()); /			goto exit; /		} /	}	MAIN_SDL_CHECK(SDL_Init(SDL_INIT_VIDEO) == 0, "SDL_Init");	if (IMG_Init(IMG_INIT_PNG) != IMG_INIT_PNG) {		log_error("IMG_Init", IMG_GetError());		goto exit;	}	MAIN_SDL_CHECK(SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2"), "SDL_SetHint SDL_HINT_RENDER_SCALE_QUALITY");	startup_info_t info = startup(argc, argv);	if (!info.success)		goto exit;	net_mode_t net_mode = info.net_mode;	network = info.network;	char wtitle[256];	if (net_mode == NET_SERVER) {		snprintf(wtitle, sizeof(wtitle), "NetCheckers - server (%s)", info.port);	} else {		snprintf(wtitle, sizeof(wtitle), "NetCheckers - client (%s:%s)", info.host, info.port);	}	window = SDL_CreateWindow(		wtitle,#if 1		SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,#else		(net_mode == NET_SERVER ? 10 : window_width + 20), SDL_WINDOWPOS_CENTERED,#endif		window_width, window_height,		SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI	);	MAIN_SDL_CHECK(window, "SDL_CreateWindow");	renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);	MAIN_SDL_CHECK(renderer, "SDL_CreateRenderer");	MAIN_SDL_CHECK(SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND) == 0, "SDL_SetRenderDrawBlendMode SDL_BLENDMODE_BLEND");	char *error = 0;	char path[1024];	#define LOAD_TEXTURE_CHECKED(var, file) { /		sprintf(path, "%s/" file, info.assets_path); /		var = load_png_texture(path, &error); /		if (error) { /			log_error("load_png_texture " file, error); /			goto exit; /		} /	}	LOAD_TEXTURE_CHECKED(tex.textures.board, "board.png");	LOAD_TEXTURE_CHECKED(tex.textures.red_piece, "piece_red.png");	LOAD_TEXTURE_CHECKED(tex.textures.red_piece_king, "piece_red_king.png");	LOAD_TEXTURE_CHECKED(tex.textures.white_piece, "piece_white.png");	LOAD_TEXTURE_CHECKED(tex.textures.white_piece_king, "piece_white_king.png");	LOAD_TEXTURE_CHECKED(tex.textures.highlight, "highlight.png");	LOAD_TEXTURE_CHECKED(tex.textures.player_turn, "player_turn.png");	LOAD_TEXTURE_CHECKED(tex.textures.opponent_turn, "opponent_turn.png");	LOAD_TEXTURE_CHECKED(tex.textures.victory, "victory.png");	LOAD_TEXTURE_CHECKED(tex.textures.defeat, "defeat.png");	window_resized(window_width, window_height);// Put the pieces on the board#if 0	// Game over testing	for (int i = 0; i < 24; i++) {		piece_t *piece = pieces + i;		piece->color = (i >= 12) ? PIECE_BLACK : PIECE_WHITE;		piece->captured = true;	}	pieces[0].captured = false;	pieces[0].king = true;	pieces[0].pos = cell_pos(1, 3);	board[1][3] = &pieces[0];	pieces[12].captured = false;	pieces[12].king = true;	pieces[12].pos = cell_pos(5, 3);	board[5][3] = &pieces[12];#else	int fill_row = 0;	int fill_col = 0;	for (int i = 0; i < 12; i++) {		piece_t *piece = pieces + i;		piece->color = PIECE_WHITE;		piece->pos = cell_pos(fill_row, fill_col);		board[fill_row][fill_col] = piece;		advance_board_row_col(&fill_row, &fill_col);	}	fill_row = 5;//.........这里部分代码省略.........
开发者ID:germanogmn1,项目名称:netcheckers,代码行数:101,


示例6: main

//.........这里部分代码省略.........	if (g.replay && !SINGLETHREADED)		printf("Warning: replaying a threaded run/n");	/*	 * Single-threaded runs historically exited after a single replay, which	 * makes sense when you're debugging, leave that semantic in place.	 */	if (g.replay && SINGLETHREADED)		g.c_runs = 1;	/* Use line buffering on stdout so status updates aren't buffered. */	(void)setvbuf(stdout, NULL, _IOLBF, 0);	/*	 * Initialize locks to single-thread named checkpoints and hot backups	 * and to single-thread last-record updates.	 */	if ((ret = pthread_rwlock_init(&g.append_lock, NULL)) != 0)		die(ret, "pthread_rwlock_init: append lock");	if ((ret = pthread_rwlock_init(&g.backup_lock, NULL)) != 0)		die(ret, "pthread_rwlock_init: hot-backup lock");	/* Clean up on signal. */	(void)signal(SIGINT, onint);	/* Seed the random number generator. */	srand((u_int)(0xdeadbeef ^ (u_int)time(NULL)));	/* Set up paths. */	path_setup(home);	printf("%s: process %" PRIdMAX "/n", g.progname, (intmax_t)getpid());	while (++g.run_cnt <= g.c_runs || g.c_runs == 0 ) {		startup();			/* Start a run */		config_setup();			/* Run configuration */		config_print(0);		/* Dump run configuration */		key_len_setup();		/* Setup keys */		track("starting up", 0ULL, NULL);		if (SINGLETHREADED)			bdb_open();		/* Initial file config */		wts_open(g.home, 1, &g.wts_conn);		wts_create();		wts_load();			/* Load initial records */		wts_verify("post-bulk verify");	/* Verify */						/* Loop reading & operations */		for (reps = 0; reps < 3; ++reps) {			wts_read_scan();	/* Read scan */			if (g.c_ops != 0)	/* Random operations */				wts_ops();			/*			 * Statistics.			 *			 * XXX			 * Verify closes the underlying handle and discards the			 * statistics, read them first.			 */			if (g.c_ops == 0 || reps == 2)				wts_stats();						/* Verify */
开发者ID:RolfAndreassen,项目名称:wiredtiger,代码行数:67,


示例7: main

intmain(int argc, char *argv[]){    // define usage    const char *usage = "Usage: sudoku n00b|l33t [#]/n";    // ensure that number of arguments is as expected    if (argc != 2 && argc != 3)    {        fprintf(stderr, usage);        return 1;    }    // ensure that level is valid    if (strcmp(argv[1], "debug") == 0)        g.level = "debug";    else if (strcmp(argv[1], "n00b") == 0)        g.level = "n00b";    else if (strcmp(argv[1], "l33t") == 0)        g.level = "l33t";    else    {        fprintf(stderr, usage);        return 2;    }    // n00b and l33t levels have 1024 boards; debug level has 9    int max = (strcmp(g.level, "debug") == 0) ? 9 : 1024;    // ensure that #, if provided, is in [1, max]    if (argc == 3)    {        // ensure n is integral        char c;        if (sscanf(argv[2], " %d %c", &g.number, &c) != 1)        {            fprintf(stderr, usage);            return 3;        }        // ensure n is in [1, max]        if (g.number < 1 || g.number > max)        {            fprintf(stderr, "That board # does not exist!/n");            return 4;        }        // seed PRNG with # so that we get same sequence of boards        srand(g.number);    }    else    {        // seed PRNG with current time so that we get any sequence of boards        srand(time(NULL));        // choose a random n in [1, max]        g.number = rand() % max + 1;    }    // start up ncurses    if (!startup())    {        fprintf(stderr, "Error starting up ncurses!/n");        return 5;    }    // register handler for SIGWINCH (SIGnal WINdow CHanged)    signal(SIGWINCH, (void (*)(int)) handle_signal);    // start the first game    if (!restart_game())    {        shutdown();        fprintf(stderr, "Could not load board from disk!/n");        return 6;    }    redraw_all();        // initialize legal variable    g.legal = true;        // initialize won variable    g.won = false;    // let the user play!    int ch;    do    {        // refresh the screen        refresh();        // get user's input        ch = getch();        // capitalize input to simplify cases        ch = toupper(ch);        // process user's input        switch (ch)        {//.........这里部分代码省略.........
开发者ID:phpminu,项目名称:danieleugenewilliams,代码行数:101,


示例8: main

int main(int argc, char **argv){   startup(argc,argv);  /* setup configurations */   old_main();          /* LATER: exit(daemon()); */   return 0;            /* if we didn't exit before, just give back success */}
开发者ID:Distrotech,项目名称:gpm,代码行数:6,


示例9: CRenderGUI

void CHostGameSettingsState::Enter(){    prevMouse = POINT{ 0, 0 };    guiInterface = new CRenderGUI(CGame::GetInstance()->GetRenderer());    float width = (float)GlobalDef::windowWidth;    float height = (float)GlobalDef::windowHeight;    guiInterface->LoadTexture("backGround", L"Assets/Textures/HostSettings.dds");    guiInterface->LoadTexture("Map", L"Assets/Textures/Map.dds");    mBackGroundImg = new CGUIElement(guiInterface->GetTextureSRV("backGround"), .99f, 0, 0, 1920, 1080);    mMapImg = new CGUIElement(guiInterface->GetTextureSRV("Map"), Layer(1), 0, 0, 275, 275);    RECT rect;    rect.top = 0;    rect.left = 0;    rect.right = (LONG)width;    rect.bottom = (LONG)height;    mBackGroundImg->SetScreenDisplayRect(rect);    mBackGroundImg->SetScreenPos(0, 0.f);    guiInterface->AddGUIElement(mBackGroundImg);    guiInterface->AddGUIElement(mMapImg);    mMapImg->SetScreenPos(0.4156f * width, 0.2648f * height);    LeftMapArrow = new CButton(guiInterface, L"Assets/Textures/LeftArrow.dds", Layer(2), 65, 65);    LeftMapArrow->SetPosition(0.385f * width, 0.36204f * height);    LeftMapArrow->SetScale(0.5f);    RightMapArrow = new CButton(guiInterface, L"Assets/Textures/RightArrow.dds", Layer(2), 65, 65);    RightMapArrow->SetPosition(0.565f * width, 0.36204f * height);    RightMapArrow->SetScale(0.5f);    LeftPlayerArrow = new CButton(guiInterface, L"Assets/Textures/LeftArrow.dds", Layer(2), 65, 65);    LeftPlayerArrow->SetPosition(0.495f * width, 0.555f * height);    LeftPlayerArrow->SetScale(0.3f);    RightPlayerArrow = new CButton(guiInterface, L"Assets/Textures/RightArrow.dds", Layer(2), 65, 65);    RightPlayerArrow->SetPosition(0.585f * width, 0.555f * height);    RightPlayerArrow->SetScale(0.3f);    LeftStartArrow = new CButton(guiInterface, L"Assets/Textures/LeftArrow.dds", Layer(2), 65, 65);    LeftStartArrow->SetPosition(0.495f * width, 0.625f * height);    LeftStartArrow->SetScale(0.3f);    RightStartArrow = new CButton(guiInterface, L"Assets/Textures/RightArrow.dds", Layer(2), 65, 65);    RightStartArrow->SetPosition(0.585f * width, 0.625f * height);    RightStartArrow->SetScale(0.3f);    LeftEndArrow = new CButton(guiInterface, L"Assets/Textures/LeftArrow.dds", Layer(2), 65, 65);    LeftEndArrow->SetPosition(0.495f * width, 0.695f * height);    LeftEndArrow->SetScale(0.3f);    RightEndArrow = new CButton(guiInterface, L"Assets/Textures/RightArrow.dds", Layer(2), 65, 65);    RightEndArrow->SetPosition(0.585f * width, 0.695f * height);    RightEndArrow->SetScale(0.3f);    ContinueButton = new CButton(guiInterface, L"Assets/Textures/ContinueButton.dds", Layer(2), 250, 74);    ContinueButton->SetPosition(0.425f * width, 0.75f * height);    ContinueButton->SetScale(0.8f);    mPlayerText = new CGUIElement(to_wstring(MaxPlayers), .96f, (int)(0.54f * width), (int)(0.545f * height), (int)(0.58f * width), (int)(0.585f * height), false, XMFLOAT2(0.75f, 0.75f), DirectX::Colors::Black);    guiInterface->AddGUIElement(mPlayerText);    mStartText = new CGUIElement(to_wstring(StartWave), .96f, (int)(0.54f * width), (int)(0.615f * height), (int)(0.58f * width), (int)(0.655f * height), false, XMFLOAT2(0.75f, 0.75f), DirectX::Colors::Black);    guiInterface->AddGUIElement(mStartText);    mEndText = new CGUIElement(to_wstring(EndWave), .96f, (int)(0.54f * width), (int)(0.685f * height), (int)(0.58f * width), (int)(0.725f * height), false, XMFLOAT2(0.75f, 0.75f), DirectX::Colors::Black);    guiInterface->AddGUIElement(mEndText);    guiInterface->LoadTexture("Cursor", L"Assets/Textures/Cursor.dds");    Cursor = new CGUIElement(guiInterface->GetTextureSRV("Cursor"), Layer(0), 0, 0, 124, 224, false);    Cursor->SetScale(0.25f);    Cursor->SetRotation(-0.5f);    guiInterface->AddGUIElement(Cursor);    startup("../SirCuddlesServer/SirCuddlesServer.exe");    closing = false;    CGame::GetInstance()->GetEventSystem()->Subscribe(EventID::Keypress, this);    guiInterface->FadeIn();    LeftPlayerArrow->Fading(false);    RightPlayerArrow->Fading(false);    LeftMapArrow->Fading(false);    RightMapArrow->Fading(false);    LeftStartArrow->Fading(false);    RightStartArrow->Fading(false);    LeftEndArrow->Fading(false);    RightEndArrow->Fading(false);    ContinueButton->Fading(false);}
开发者ID:GrantAviex,项目名称:Draconomy,代码行数:85,


示例10: startup

/* * JNI methods */JNIEXPORT jint JNICALL Java_com_mangrajalkin_synth_Synth_startup   (JNIEnv *env, jobject obj){	return startup();}
开发者ID:mangrajalkin,项目名称:Synth,代码行数:7,


示例11: createRGB555

Common::Error BladeRunnerEngine::run() {	Graphics::PixelFormat format = createRGB555();	initGraphics(640, 480, &format);	_system->showMouse(true);	bool hasSavegames = !SaveFileManager::list(_targetName).empty();	if (!startup(hasSavegames)) {		shutdown();		return Common::Error(Common::kUnknownError, "Failed to initialize resources");	}#if BLADERUNNER_DEBUG_GAME	{#else	if (warnUserAboutUnsupportedGame()) {#endif		if (hasSavegames) {			_kia->_forceOpen = true;			_kia->open(kKIASectionLoad);		}		// TODO: why is game starting new game here when everything is done in startup?		//  else {		// 	newGame(1);		// }		gameLoop();		_mouse->disable();		if (_gameOver) {			// autoSaveGame(4, 1); // TODO			_endCredits->show();		}	}	shutdown();	return Common::kNoError;}bool BladeRunnerEngine::startup(bool hasSavegames) {	// These are static objects in original game	_screenEffects = new ScreenEffects(this, 0x8000);	_endCredits = new EndCredits(this);	_actorDialogueQueue = new ActorDialogueQueue(this);	_settings = new Settings(this);	_itemPickup = new ItemPickup(this);	_lights = new Lights(this);	// TODO: outtake player - but this is done bit differently	_policeMaze = new PoliceMaze(this);	_obstacles = new Obstacles(this);	_sceneScript = new SceneScript(this);	_debugger = new Debugger(this);	// This is the original startup in the game	bool r;	_surfaceFront.create(640, 480, createRGB555());	_surfaceBack.create(640, 480, createRGB555());	_surface4.create(640, 480, createRGB555());	_gameTime = new Time(this);	r = openArchive("STARTUP.MIX");	if (!r)		return false;	_gameInfo = new GameInfo(this);	if (!_gameInfo)		return false;	r = _gameInfo->open("GAMEINFO.DAT");	if (!r) {		return false;	}	// TODO: Create datetime - not used	// TODO: Create graphics surfaces 1-4	// TODO: Allocate audio cache	if (hasSavegames) {//.........这里部分代码省略.........
开发者ID:BenCastricum,项目名称:scummvm,代码行数:101,


示例12: mover

/*   Movers move the unprocessed updated tokens from the update queue table to   the main memory task queue. They also wake up the doers whenever they move   any new tokens to the task queue. */DWORD WINAPI mover(LPVOID ptr){    int result;    int i;#if !defined _MIDDLE    MI_CONNECTION *conn = NULL;    conn = startup();#endif    while (!g_fTerminate)    {        // The mover dispatcher can wake up the movers when a data source is updated        WaitForSingleObject(wakeup_mover_by_mover_dispatcher_sem, INFINITE);        if (g_fTerminate)            break;        // Increment the number of active movers        EnterCriticalSection(&mover_num_mutex);        num_mover++;        LeaveCriticalSection(&mover_num_mutex );        EnterCriticalSection(&suspend_mutex);        // Lock the mutex so that the cleaners and the movers are not        // active at the same time        EnterCriticalSection(&mover_cleaner_mutex);#ifdef _MIDDLE        // Movers perform till the task queue is full or when all the tokens from the updated        // data sources have been moved.        // A ceiling is imposed on the task queue to apply back pressure on the movers        // to stop after the task queue is full. This will prevent the doers from lagging behind        // and movers from moving too many tolens at the same time.        result = TASK_QUEUE_NOT_FULL;        while (result == TASK_QUEUE_NOT_FULL)        {            result = vl_move_tasks();            if ((result == TASK_QUEUE_FULL) || (result == TASK_QUEUE_NOT_FULL))                // Wake up all the doers            {                for (i = 0; i < MAXDOER; i++)                    ReleaseSemaphore(wakeup_doer_by_mover_sem, 1, NULL);            }        }#else        result = execUDR(conn,"execute function vl_move_tasks();");#endif        LeaveCriticalSection(&mover_cleaner_mutex);        LeaveCriticalSection(&suspend_mutex);        // Decrement the number of active movers        EnterCriticalSection(&mover_num_mutex);        num_mover--;        LeaveCriticalSection(&mover_num_mutex );    }    // Release the doers.    for (i = 0; i < MAXDOER; i++)    {        ReleaseSemaphore(wakeup_doer_by_mover_sem, 1, NULL);    }#if !defined _MIDDLE    mi_close(conn);#endif    return 1;}
开发者ID:aevernon,项目名称:triggerman,代码行数:73,


示例13: main

int main(int argc,char* argv[]){    if(argc != 3)    {        usage(argv[0]);        exit(1);    }    signal(SIGCHLD,wait_child);    char* ip = argv[1];    int port =atoi( argv[2]);    struct sockaddr_in client_info;//out    socklen_t client_len = 0;//out    int listen_sock = startup(ip,port);    printf("blind and listen success,please wait accept data!/n");    while(1)    {       int new_client = accept(listen_sock,(struct sockaddr*)&client_info,&client_len);       if(new_client < 0)       {           perror("accept");           continue;       }       printf("get a new connect.../n");#ifdef _FUN1_       char buf[1024];       memset(buf,'/0',sizeof(buf));       printf("usage fun1.../n");       while(1)       {           ssize_t _size = read(new_client,buf,sizeof(buf)-1);           if(_size < 0)           {               perror("read");               break;           }else if(_size == 0)           {               printf("client is release/n");               break;           }else           {               buf[_size] = '/0';               printf("client:->%s/n",buf);           }       }#endif#ifdef _FUN2_        printf("many procs,use fun2......./n");       pid_t id = fork();       if(id < 0)       {           perror("fork");           exit(1);       }else if(id == 0){          // close(listen_sock);           char buf[1024];           while(1)           {                memset(buf,'/0',sizeof(buf));                ssize_t _size = read(new_client,buf,sizeof(buf)-1);               if(_size < 0)               {                   perror("read");                   exit(1);               }               else if(_size == 0){                   printf("client is release/n");                   exit(1);               }else{                   printf("client->%s/n",buf);                   continue;               }           }           //close(new_client);           //exit(1);           continue;       }#endif#ifdef _FUN3_       printf("thread,use fun3........../n");       pthread_t t_id;       pthread _create(&t_id,NULL,thread_run,(void*)new_client);       pthread_detach(t_id);#endif    }    return 0;}
开发者ID:hbbproc,项目名称:tcp,代码行数:90,


示例14: startup

/* * mpool_t *mpool_open * * DESCRIPTION: * * Open/allocate a new memory pool. * * RETURNS: * * Success - Pool pointer which must be passed to mpool_close to * deallocate. * * Failure - NULL * * ARGUMENTS: * * flags -> Flags to set attributes of the memory pool.  See the top * of mpool.h. * * page_size -> Set the internal memory page-size.  This must be a * multiple of the getpagesize() value.  Set to 0 for the default. * * start_addr -> Starting address to try and allocate memory pools. * This is ignored if the MPOOL_FLAG_USE_SBRK is enabled. * * error_p <- Pointer to integer which, if not NULL, will be set with * a mpool error code. */mpool_t	*mpool_open(const unsigned int flags, const unsigned int page_size,                    void *start_addr, int *error_p){    mpool_block_t	*block_p;    int		page_n, ret;    mpool_t	mp, *mp_p;    void		*free_addr;    if (! enabled_b) {        startup();    }    /* zero our temp struct */    memset(&mp, 0, sizeof(mp));    mp.mp_magic = MPOOL_MAGIC;    mp.mp_flags = flags;    mp.mp_alloc_c = 0;    mp.mp_user_alloc = 0;    mp.mp_max_alloc = 0;    mp.mp_page_c = 0;    /* mp.mp_page_size set below */    /* mp.mp_blocks_bit_n set below */    /* mp.mp_fd set below */    /* mp.mp_top set below */    /* mp.mp_addr set below */    mp.mp_log_func = NULL;    mp.mp_min_p = NULL;    mp.mp_bounds_p = NULL;    mp.mp_first_p = NULL;    mp.mp_last_p = NULL;    mp.mp_magic2 = MPOOL_MAGIC;    /* get and sanity check our page size */    if (page_size > 0) {        mp.mp_page_size = page_size;        if (mp.mp_page_size % getpagesize() != 0) {            SET_POINTER(error_p, MPOOL_ERROR_ARG_INVALID);            return NULL;        }    }    else {        mp.mp_page_size = getpagesize() * DEFAULT_PAGE_MULT;        if (mp.mp_page_size % 1024 != 0) {            SET_POINTER(error_p, MPOOL_ERROR_PAGE_SIZE);            return NULL;        }    }    if (BIT_IS_SET(flags, MPOOL_FLAG_USE_SBRK)) {        mp.mp_fd = -1;        mp.mp_addr = NULL;        mp.mp_top = 0;    }    else if (BIT_IS_SET(flags, MPOOL_FLAG_USE_MAP_ANON)) {        mp.mp_fd = -1;        mp.mp_addr = start_addr;        mp.mp_top = 0;    }    else {        /* open dev-zero for our mmaping */        mp.mp_fd = open("/dev/zero", O_RDWR, 0);        if (mp.mp_fd < 0) {            SET_POINTER(error_p, MPOOL_ERROR_OPEN_ZERO);            return NULL;        }        mp.mp_addr = start_addr;        /* we start at the front of the file */        mp.mp_top = 0;    }    /*//.........这里部分代码省略.........
开发者ID:adam-26,项目名称:node-orm-performance,代码行数:101,


示例15: memset

/*  Lempel-Ziv-Tyr ;-)*/long CcffLoader::cff_unpacker::unpack(unsigned char *ibuf, unsigned char *obuf){  if (memcmp(ibuf,"YsComp""/x07""CUD1997""/x1A/x04",16))    return 0;  input = ibuf + 16;  output = obuf;  output_length = 0;  heap = (unsigned char *)malloc(0x10000);  dictionary = (unsigned char **)malloc(sizeof(unsigned char *)*0x8000);  memset(heap,0,0x10000);  memset(dictionary,0,0x8000);  cleanup();  if(!startup())    goto out;  // LZW  while (1)    {      new_code = get_code();      // 0x00: end of data      if (new_code == 0)	break;      // 0x01: end of block      if (new_code == 1)	{	  cleanup();	  if(!startup())	    goto out;	  continue;	}      // 0x02: expand code length      if (new_code == 2)	{	  code_length++;	  continue;	}      // 0x03: RLE      if (new_code == 3)	{	  unsigned char old_code_length = code_length;	  code_length = 2;	  unsigned char repeat_length = get_code() + 1;	  code_length = 4 << get_code();	  unsigned long repeat_counter = get_code();	  if(output_length + repeat_counter * repeat_length > 0x10000) {	    output_length = 0;	    goto out;	  }	  for (unsigned int i=0;i<repeat_counter*repeat_length;i++)	    output[output_length++] = output[output_length - repeat_length];	  code_length = old_code_length;	  if(!startup())	    goto out;	  continue;	}      if (new_code >= (0x104 + dictionary_length))	{	  // dictionary <- old.code.string + old.code.char	  the_string[++the_string[0]] = the_string[1];	}      else	{	  // dictionary <- old.code.string + new.code.char	  unsigned char temp_string[256];	  translate_code(new_code,temp_string);	  the_string[++the_string[0]] = temp_string[1];	}      expand_dictionary(the_string);      // output <- new.code.string      translate_code(new_code,the_string);      if(output_length + the_string[0] > 0x10000) {//.........这里部分代码省略.........
开发者ID:EQ4,项目名称:adplug,代码行数:101,


示例16: start_event

static void start_event(int unused_event, char *context){    SESSION *session = (SESSION *) context;    startup(session);}
开发者ID:KKcorps,项目名称:postfix,代码行数:6,


示例17: main

intmain(int argc, char *argv[]){    int     i;    int     rval, ll;    struct text *kk;    init();		/* Initialize everything */    signal(SIGINT, trapdel);    if (argc > 1) {	/* Restore file specified */        /* Restart is label 8305 (Fortran) */        i = restore(argv[1]);	/* See what we've got */        switch (i) {        case 0:			/* The restore worked fine */            yea = Start();            k = null;            unlink(argv[1]);/* Don't re-use the save */            goto l8;	/* Get where we're going */        case 1:		/* Couldn't open it */            errx(1, "can't open file");	/* So give up */        case 2:		/* Oops -- file was altered */            rspeak(202);	/* You dissolve */            exit(2);	/* File could be non-adventure */        }			/* So don't unlink it. */    }    startup();		/* prepare for a user		*/    for (;;) {		/* main command loop (label 2)	*/        if (newloc < 9 && newloc != 0 && closng) {            rspeak(130);	/* if closing leave only by	*/            newloc = loc;	/*	main office		*/            if (!panic)                clock2 = 15;            panic = TRUE;        }        rval = fdwarf();		/* dwarf stuff			*/        if (rval == 99)            die(99);l2000:        if (loc == 0)            die(99);	/* label 2000			*/        kk = &stext[loc];        if ((abb[loc] % abbnum) ==0 || kk->seekadr == 0)            kk = &ltext[loc];        if (!forced(loc) && dark()) {            if (wzdark && pct(35)) {                die(90);                goto l2000;            }            kk = &rtext[16];        }l2001:        if (toting(bear))            rspeak(141);	/* 2001			*/        speak(kk);        k = 1;        if (forced(loc))            goto l8;        if (loc == 33 && pct(25) && !closng)            rspeak(8);        if (!dark()) {            abb[loc]++;            for (i = atloc[loc]; i != 0; i = linkx[i]) {	/*2004*/                obj = i;                if (obj > 100)                    obj -= 100;                if (obj == steps && toting(nugget))                    continue;                if (prop[obj] < 0) {                    if (closed)                        continue;                    prop[obj] = 0;                    if (obj == rug || obj == chain)                        prop[obj] = 1;                    tally--;                    if (tally == tally2 && tally != 0)                        if (limit > 35)                            limit = 35;                }                ll = prop[obj];	/* 2006	*/                if (obj == steps && loc == fixed[steps])                    ll = 1;                pspeak(obj, ll);            }		/* 2008 */            goto l2012;l2009:            k = 54;			/* 2009			*/l2010:            spk = k;l2011:            rspeak(spk);        }l2012:        verb = 0;		/* 2012			*/        obj = 0;l2600://.........这里部分代码省略.........
开发者ID:syuu1228,项目名称:openbsd-src,代码行数:101,


示例18: main

//.........这里部分代码省略.........            msg_fatal("read %s: %m", message_file);        vstream_fclose(fp);        vstring_free(buf);        message_length = VSTRING_LEN(msg);        message_data = vstring_export(msg);        send_headers = 0;    } else if (message_length > 0) {        message_data = mymalloc(message_length);        memset(message_data, 'X', message_length);        for (i = 80; i < message_length; i += 80) {            message_data[i - 80] = "0123456789"[(i / 80) % 10];            message_data[i - 2] = '/r';            message_data[i - 1] = '/n';        }    }    /*     * Translate endpoint address to internal form.     */    proto_info = inet_proto_init("protocols", protocols);    if (strncmp(argv[optind], "unix:", 5) == 0) {        path = argv[optind] + 5;        path_len = strlen(path);        if (path_len >= (int) sizeof(sun.sun_path))            msg_fatal("unix-domain name too long: %s", path);        memset((char *) &sun, 0, sizeof(sun));        sun.sun_family = AF_UNIX;#ifdef HAS_SUN_LEN        sun.sun_len = path_len + 1;#endif        memcpy(sun.sun_path, path, path_len);        sa = (struct sockaddr *) & sun;        sa_length = sizeof(sun);    } else {        if (strncmp(argv[optind], "inet:", 5) == 0)            argv[optind] += 5;        buf = mystrdup(argv[optind]);        if ((parse_err = host_port(buf, &host, (char *) 0, &port, "smtp")) != 0)            msg_fatal("%s: %s", argv[optind], parse_err);        if ((aierr = hostname_to_sockaddr(host, port, SOCK_STREAM, &res)) != 0)            msg_fatal("%s: %s", argv[optind], MAI_STRERROR(aierr));        myfree(buf);        sa = (struct sockaddr *) & ss;        if (res->ai_addrlen > sizeof(ss))            msg_fatal("address length %d > buffer length %d",                      (int) res->ai_addrlen, (int) sizeof(ss));        memcpy((char *) sa, res->ai_addr, res->ai_addrlen);        sa_length = res->ai_addrlen;#ifdef HAS_SA_LEN        sa->sa_len = sa_length;#endif        freeaddrinfo(res);    }    /*     * Make sure the SMTP server cannot run us out of memory by sending     * never-ending lines of text.     */    if (buffer == 0) {        buffer = vstring_alloc(100);        vstring_ctl(buffer, VSTRING_CTL_MAXLEN, (ssize_t) var_line_limit, 0);    }    /*     * Make sure we have sender and recipient addresses.     */    if (var_myhostname == 0)        var_myhostname = get_hostname();    if (sender == 0 || recipient == 0) {        vstring_sprintf(buffer, "[email
C++ startvichange函数代码示例
C++ startswith函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。