Пример #1
0
void AsyncRaceAnalyzerComm::RunFlashConfig(void){
	Run(ACTION_FLASH_CONFIG);
}
Пример #2
0
 UTest() { Run(); }
Пример #3
0
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	std::vector<SampleInfo> samples =
	{
		INFO(Basic_Empty, "Altseedの基本", "空のウィンドウを表示するサンプル。"),
		//INFO(Basic_FullScreen, "フルスクリーンモード", "アプリケーションをフルスクリーンで起動するサンプル。"),

		INFO(TextureObject2D_Basic, "画像の表示", "画像を表示する基本的なサンプルです。"),
		INFO(TextureObject2D_Turn, "画像の上下反転", "画像の上下を反転して描画するサンプルです。"),
		INFO(TextureObject2D_Src, "画像の切り抜き", "画像の一部を切り出して描画するサンプルです。"),
		INFO(TextureObject2D_Transform, "画像の変形", "画像を回転させたり、拡大縮小して描画するサンプルです。"),

		INFO(Mouse_Position, "マウス座標の取得", "マウスの座標を取得し、その位置を表示するサンプルです。"),
		INFO(Mouse_Click, "マウスのクリック検知", "マウスの左クリックを検知するサンプルです。"),
		INFO(Mouse_State, "マウスボタンの状態", "マウスの中ボタンの状態を調べ、状態を表示するサンプルです。"),
		INFO(Mouse_Wheel, "マウスホイール", "マウスホイールの回転の度合いを調べ、表示するサンプルです。"),

		INFO(Keyboard_Basic, "キーボード入力の基本", "Zキーを押しているかどうかを調べ、結果を表示するサンプルです。"),
		INFO(Keyboard_SingularKey, "キーボードの入力状態", "キーボードのキー入力状態を詳しく調べ、状態を表示するサンプルです。"),
		INFO(Keyboard_PuralKeys, "複数のキーの入力状態", "キーボードの複数のキーの入力状態を調べ、表示するサンプルです。"),

		INFO(Joystick_Basic, "ジョイスティックのボタン入力", "ジョイスティックのボタンの入力状態を調べ、表示するサンプルです。"),
		INFO(Joystick_Axis, "アナログスティック入力", "ジョイスティックのアナログスティックの入力状態を調べ、表示するサンプルです。"),
		INFO(Joystick_GamePad, "ゲームパッド入力", "一部のゲームパッドの入力状態を調べ、表示するサンプルです。"),

		INFO(Sound_SE, "効果音の再生", "効果音(Sound Effect)を再生するサンプルです。"),
		INFO(Sound_BGM, "BGMの再生", "BGMを再生するサンプルです。"),
		INFO(Sound_Loop, "BGMのループ再生", "BGMをループ再生するサンプルです。"),

		INFO(TextObject2D_Basic, "文字列の描画", "文字列を描画するサンプルです。"),
		INFO(TextObject2D_DynamicFont, "フォントの動的生成", "フォントをプログラム実行中にに準備して、そのフォントで文字列を描画するサンプルです。"),
		INFO(TextObject2D_Rotate, "文字列の回転", "文字列を回転させて描画するサンプルです。"),
		INFO(TextObject2D_Filtered, "回転した文字列の滑らかな描画", "文字列の回転をしたときにギザギザが発生するのを防ぐ機能を使ったサンプルです。"),
		INFO(TextObject2D_Centering, "文字列の中央揃え", "文字列を中央揃えで描画するサンプルです。"),

		INFO(CameraObject2D_Basic, "カメラの基本", "カメラを用いて描画空間の一部を切り取って描画するサンプルです。"),
		INFO(CameraObject2D_Magnify, "カメラによる拡大描画", "カメラを用いて描画空間の一部を虫眼鏡のように拡大して描画するサンプルです。"),
		INFO(CameraObject2D_Group, "", ""),
		INFO(CameraObject2D_Texture, "", ""),

		INFO(EffectObject2D_Basic, "", ""),

		INFO(GeometryObject2D_CircleShape, "", ""),
		INFO(GeometryObject2D_ArcShape, "", ""),
		INFO(GeometryObject2D_RectangleShape, "", ""),
		INFO(GeometryObject2D_PolygonShape, "", ""),
		INFO(GeometryObject2D_PolygonShape_Textured, "", ""),

		INFO(Object2DComponent_Custom, "", ""),

		INFO(Collision2D_Basic, "", ""),
		INFO(Collision2D_Geometries, "", ""),

		INFO(File_PackFile, "", ""),
		INFO(File_RootDirectory, "", ""),
		INFO(File_StaticFile, "", ""),
		INFO(File_StreamFile, "", ""),

		INFO(SceneAndLayer_Basic, "", ""),
		INFO(SceneAndLayer_CustomLayer, "", ""),
		INFO(SceneAndLayer_CustomScene, "", ""),

		INFO(Transition_Fade, "フェードイン・フェードアウト", "画像を回転させたり、拡大縮小して描画するサンプルです。"),

		INFO(Dispose_Object2D, "", ""),
		INFO(Dispose_Layer2D, "", ""),

		INFO(PostEffect_GrayScale, "", ""),
		INFO(PostEffect_Sepia, "", ""),
		INFO(PostEffect_GaussianBlur, "", ""),
		INFO(PostEffect_LightBloom, "", ""),

		INFO(EngineMisc_ShowFps, "", ""),

		INFO(Texture_Basic, "", ""),
		INFO(Texture_Edit, "", ""),

		INFO(Log_Basic, "ログ出力", "ログファイルにログを出力するサンプルです。"),
		INFO(Log_OutputLevel, "ログの出力レベルの指定", "ログファイルにログを出力するサンプルです。\n出力レベルを指定し、低レベルのログを無視します。"),
		INFO(Log_Table, "表組みされたログ出力", "ログファイルに表組みで表現されたログを出力するサンプルです。"),

		INFO(MediaPlayer_Basic, "", ""),

	};

	auto browser = SampleBrowser(samples);
	browser.Run();

	return 0;
}
Пример #4
0
void FPcamera::Update(double dt, float heightOffset)
{
	if(myKeys['w'])
	{
		if(myKeys['z'])
		{
			if (!m_bJumping)
			{
				Run(dt, heightOffset);
			}
			else
			{
				Walk(dt, heightOffset);
			}
			myKeys['z'] = false;
		}
		else
		{
			Walk(dt, heightOffset);
		}
		myKeys['w'] = false;
	}

	if(myKeys['s'])
	{
		if(myKeys['z'])
		{
			Run(-dt, heightOffset);
			myKeys['z'] = false;
		}
		else
		{
			Walk(-dt, heightOffset);
		}
		myKeys['s'] = false;
	}

	if(myKeys['a'])
	{
		Strafe(-dt, heightOffset);
		myKeys['a'] = false;
	}

	if(myKeys['d'])
	{
		Strafe(dt, heightOffset);
		myKeys['d'] = false;
	}

	if(myKeys['q'])
	{
		moveUp(dt, 5.f);
		myKeys['q'] = false;
	}

	if(myKeys['e'])
	{
		moveDown(dt, 5.f);
		myKeys['e'] = false;
	}

	if(myKeys[32])
	{
		Jump(dt);
		myKeys[32] = false;
	}

	if(myKeys['c'])
	{
		m_bCrouching = true;
		Crouch(dt, heightOffset);
		myKeys['c'] = false;
	}

	else
	{
		m_bCrouching = false;
		Crouch(-dt, heightOffset);
	}

	if(m_bRecoil)
	{
		static float timer = 0.f;

		lookUp(dt, 20.f);
		timer += (float)dt;

		if (timer >= 0.1f)
		{
			m_bRecoil = false;
			timer = 0.f;
		}
	}

	else if (!m_bRecoil && recoil > 0.f)
	{
		lookDown(dt, 20.f);
	}

	UpdateJump(dt, heightOffset);

	if(Application::camera_pitch != 0)
	{
		Pitch(dt);
	}
	if(Application::camera_yaw != 0)
	{
		Yaw(dt);
	}

	if(myKeys['r'])
	{
		Reset();
		myKeys['r'] = false;
	}
}
Пример #5
0
	void TcpServerTest()
	{
        Run();
	}
Пример #6
0
std::unique_ptr<Layout> create(RenderBlockFlow& flow)
{
    RenderText& textRenderer = toRenderText(*flow.firstChild());
    ASSERT(!textRenderer.firstTextBox());

    const RenderStyle& style = flow.style();
    const unsigned textLength = textRenderer.textLength();

    ETextAlign textAlign = style.textAlign();
    float wordTrailingSpaceWidth = style.font().width(TextRun(&space, 1));

    LazyLineBreakIterator lineBreakIterator(textRenderer.text(), style.locale());
    int nextBreakable = -1;

    Layout::RunVector runs;
    unsigned lineCount = 0;

    unsigned lineEndOffset = 0;
    while (lineEndOffset < textLength) {
        lineEndOffset = skipWhitespaces(textRenderer, lineEndOffset, textLength);
        unsigned lineStartOffset = lineEndOffset;
        unsigned wordEndOffset = lineEndOffset;
        LineWidth lineWidth(flow, false, DoNotIndentText);

        Vector<Run, 4> lineRuns;
        lineRuns.uncheckedAppend(Run(lineStartOffset, 0));

        while (wordEndOffset < textLength) {
            ASSERT(!isWhitespace(textRenderer.characterAt(wordEndOffset)));

            bool previousWasSpaceBetweenWords = wordEndOffset > lineStartOffset && isWhitespace(textRenderer.characterAt(wordEndOffset - 1));
            unsigned wordStartOffset = previousWasSpaceBetweenWords ? wordEndOffset - 1 : wordEndOffset;

            ++wordEndOffset;
            while (wordEndOffset < textLength) {
                if (wordEndOffset > lineStartOffset && isBreakable(lineBreakIterator, wordEndOffset, nextBreakable, false))
                    break;
                ++wordEndOffset;
            }

            unsigned wordLength = wordEndOffset - wordStartOffset;
            bool includeEndSpace = wordEndOffset < textLength && textRenderer.characterAt(wordEndOffset) == ' ';
            float wordWidth;
            if (includeEndSpace)
                wordWidth = textWidth(textRenderer, wordStartOffset, wordLength + 1, lineWidth.committedWidth(), style) - wordTrailingSpaceWidth;
            else
                wordWidth = textWidth(textRenderer, wordStartOffset, wordLength, lineWidth.committedWidth(), style);

            lineWidth.addUncommittedWidth(wordWidth);

            // Move to the next line if the current one is full and we have something on it.
            if (!lineWidth.fitsOnLine() && lineWidth.committedWidth())
                break;

            if (wordStartOffset > lineEndOffset) {
                // There were more than one consecutive whitespace.
                ASSERT(previousWasSpaceBetweenWords);
                // Include space to the end of the previous run.
                lineRuns.last().textLength++;
                lineRuns.last().right += wordTrailingSpaceWidth;
                // Start a new run on the same line.
                lineRuns.append(Run(wordStartOffset + 1, lineRuns.last().right));
            }

            lineWidth.commit();

            lineRuns.last().right = lineWidth.committedWidth();
            lineRuns.last().textLength = wordEndOffset - lineRuns.last().textOffset;

            lineEndOffset = wordEndOffset;
            wordEndOffset = skipWhitespaces(textRenderer, wordEndOffset, textLength);

            if (!lineWidth.fitsOnLine()) {
                // The first run on the line overflows.
                ASSERT(lineRuns.size() == 1);
                break;
            }
        }
        if (lineStartOffset == lineEndOffset)
            continue;

        adjustRunOffsets(lineRuns, textAlign, lineWidth.committedWidth(), lineWidth.availableWidth());

        for (unsigned i = 0; i < lineRuns.size(); ++i)
            runs.append(lineRuns[i]);

        runs.last().isEndOfLine = true;
        ++lineCount;
    }

    textRenderer.clearNeedsLayout();

    return Layout::create(runs, lineCount);
}
TEST_F(EntityFixture, PlayerTest) {
    GetInput().assignKey(sf::Keyboard::W, Input::Up);
    GetInput().assignKey(sf::Keyboard::A, Input::Left);
    GetInput().assignKey(sf::Keyboard::S, Input::Down);
    GetInput().assignKey(sf::Keyboard::D, Input::Right);
    GetInput().assignMouseButton(sf::Mouse::Left, Input::Shoot);
    GetInput().setMouseLock(true);
    GetWindow().setMouseCursorVisible(false);

    dot.setFillColor(sf::Color::Red);

    // Add behaviors
    playerUpdater = da::BehaviorPtr(new PlayerUpdater(GetView(), GetInput()));
    GetManager().addBehavior(playerUpdater);
    GetManager().addBehavior(velocitiesUpdater);
    GetManager().addBehavior(walker);
    GetManager().addBehavior(poseUpdater);
    GetManager().addBehavior(xformHistorian);

    // Add spatial
    GetRenderer().registerSpatial<SpriteSpatial>();

    // Create entity
    entity = GetManager().create();
    entity->addAttribute(new da::Transform);
    entity->addAttribute(new da::Depth);

    da::TexturePtr texture = GetContent().load<sf::Texture>("mans.png");
    entity->addAttribute(new Sprite(texture));
    entity->addAttribute(new TransformHistory);
    entity->addAttribute(new Collider);
    entity->addAttribute(new Velocities);

    Poses *poses = new Poses;

    Pose pose(6);
    for (unsigned int j = 0; j < DirectionCount; j++) {
        for (unsigned int i = 0; i < pose.getFrameCount(); i++) {
            Pose::Frame frame = {
                sf::IntRect(i * 16, j * 24, 16, 24),
                sf::Vector2f(8, 20)
            };

            pose.setFrame((CardinalDirection)j, i, frame);
        }
    }
    poses->addPose("walk", pose);

    poses->isLoop = true;
    poses->timePerFrame = sf::seconds(0.25f);
    poses->setPose("walk", 0);
    entity->addAttribute(poses);

    Player *player = new Player;
    player->walkSpeed = 100.f;
    player->viewDistance = 40.f;
    entity->addAttribute(player);

    GetManager().refresh(entity);

    Run(update, emptyHandler, draw);
}
Пример #8
0
void main(void)
#endif
{
  Init();
  Run();
}
MRESULT _System MainWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 
{
    switch (msg)
    {
        case WM_INITDLG:
            InitDlg( hwnd);
            break;

        case WM_COMMAND:
            if ((USHORT)mp1 == IDC_OK)
                Run( hwnd);
            else
            if ((USHORT)mp1 == IDC_CLEAR)
                ClearDlg( hwnd);
            break;

        case WM_CONTROL:
            if (SHORT2FROMMP( mp1) != CBN_LBSELECT)
                break;

            switch (SHORT1FROMMP( mp1))
            {
                case IDC_PROCTYPE:
                    SwitchTypeLists( hwnd, (HWND)mp2);
                    break;

                case IDC_ARG1TYPE:
                case IDC_ARG2TYPE:
                case IDC_ARG3TYPE:
                case IDC_ARG4TYPE:
                case IDC_ARG5TYPE:
                case IDC_ARG6TYPE:
                    SetXDS( hwnd, (HWND)mp2, SHORT1FROMMP( mp1));
                    break;
            }
            break;

        case WM_CHAR:
        // defeat default button action
            if (((CHARMSG(&msg)->fs & (USHORT)KC_VIRTUALKEY) &&
                   CHARMSG(&msg)->vkey == VK_ENTER) ||
                ((CHARMSG(&msg)->fs & (USHORT)KC_CHAR) &&
                   CHARMSG(&msg)->chr == '\r'))
                break;

            return (WinDefDlgProc( hwnd, msg, mp1, mp2));

        case WM_CLOSE:
            WinPostMsg( hwnd, WM_QUIT, NULL, NULL);
            break;

        case WM_DESTROY:
            if (RwsClientTerminate())
                printf( "\r\nRwsClientTerminate failed\r\n");
            return (WinDefDlgProc( hwnd, msg, mp1, mp2));

        default:
            return (WinDefDlgProc( hwnd, msg, mp1, mp2));

    } //end switch (msg)

    return (0);
}
Пример #10
0
BefungeMainWindow::BefungeMainWindow(QWidget *parent) :
    QMainWindow(parent)
{   
    interpreter = new BefungeInterpreter(this);

    setCentralWidget(new QFrame(this));

    QHBoxLayout *layout_central = new QHBoxLayout();

    QVBoxLayout *layout_main = new QVBoxLayout();
    QVBoxLayout *layout_buttons = new QVBoxLayout();

    centralWidget()->setLayout(layout_central);

    QGridLayout *layout_befunge_editor = new QGridLayout();
    QHBoxLayout *layout_input_output = new QHBoxLayout();
    QHBoxLayout *layout_aux_widgets = new QHBoxLayout();

    QVBoxLayout *layout_input = new QVBoxLayout();
    QVBoxLayout *layout_output = new QVBoxLayout();

    QVBoxLayout *layout_stack = new QVBoxLayout();
    QVBoxLayout *layout_help = new QVBoxLayout();

    befunge_editor = new QTextEdit(this);
    befunge_editor->setFont(QFont("Verdana", 12));
    befunge_editor->ensureCursorVisible();
    befunge_editor->setLineWrapMode(QTextEdit::NoWrap);
    befunge_editor->setMinimumHeight(400);
    layout_befunge_editor->addWidget(befunge_editor);

    befunge_input = new QTextEdit(this);
    befunge_input->setFont(QFont("Verdana", 12));
    befunge_input->ensureCursorVisible();
    befunge_input->setLineWrapMode(QTextEdit::NoWrap);
    layout_input->addWidget(new QLabel("Input", this));
    layout_input->addWidget(befunge_input);

    befunge_output = new QTextEdit(this);
    befunge_output->setFont(QFont("Verdana", 12));
    befunge_output->ensureCursorVisible();
    befunge_output->setLineWrapMode(QTextEdit::NoWrap);
    befunge_output->setReadOnly(true);
    layout_output->addWidget(new QLabel("Output", this));
    layout_output->addWidget(befunge_output);

    stack_view = new QTableView(this);
    layout_stack->addWidget(new QLabel("Stack", this));
    layout_stack->addWidget(stack_view);

    befunge_help = new QTextEdit(this);
    befunge_help->setFont(QFont("Verdana", 12));
    befunge_help->setMinimumWidth(550);
    befunge_help->setHtml(QString("<table border=\"1\"> <tr> <th>COMMAND</th> <th>INITIAL STACK (bot->top)</th> <th>RESULT STACK</th> </tr>") %
                          QString("<tr> <td>+ (add)</td>         <td>'value1' 'value2'</td>       <td>'value1 + value2'</td> </tr>") %
                          QString("<tr> <td>- (subtract)</td>    <td>'value1' 'value2'</td>       <td>'value1 - value2'</td> </tr>") %
                          QString("<tr> <td>* (multiply)</td>    <td>'value1' 'value2'</td>       <td>'value1 * value2'</td> </tr>") %
                          QString("<tr> <td>/ (divide)</td>      <td>'value1' 'value2'</td>       <td>'value1 / value2' (nb. integer)</td> </tr>") %
                          QString("<tr> <td>% (modulo)</td>      <td>'value1' 'value2'</td>       <td>'value1 mod value2'</td> </tr>") %
                          QString("<tr> <td>! (not)</td>         <td>'value'</td>                 <td>'0' if value non-zero, '1' otherwise</td> </tr>") %
                          QString("<tr> <td>` (greater)</td>     <td>'value1' 'value2'</td>       <td>'1' if value1 > value2, '0' otherwise</td> </tr>") %
                          QString("<tr> <td>&gt; (right)</td>    <td> </td>                       <td>PC -> right</td> </tr>") %
                          QString("<tr> <td>&lt; (left)</td>     <td> </td>                       <td>PC -> left</td> </tr>") %
                          QString("<tr> <td>^ (up)</td>          <td> </td>                       <td>PC -> up</td> </tr>") %
                          QString("<tr> <td>v (down)</td>        <td> </td>                       <td>PC -> down</td> </tr>") %
                          QString("<tr> <td>? (random)</td>      <td> </td>                       <td>PC -> random direction</td> </tr>") %
                          QString("<tr> <td>_ (horizontal if)</td> <td>'boolean value'</td>       <td>PC -> left if 'value', else PC -> right</td> </tr>") %
                          QString("<tr> <td>| (vertical if)</td>   <td>'boolean value'</td>       <td>PC -> up if 'value', else PC -> down</td> </tr>") %
                          QString("<tr> <td>\" (stringmode)</td>   <td> </td>                     <td>toggles 'stringmode'</td> </tr>") %
                          QString("<tr> <td>: (dup)</td>         <td>'value'</td>                 <td>'value' 'value'</td> </tr>") %
                          QString("<tr> <td>\\ (swap)</td>       <td>'value1' 'value2'</td>       <td>'value2' 'value1'</td> </tr>") %
                          QString("<tr> <td>$ (pop)</td>         <td>'value'</td>                 <td>just pops 'value'</td> </tr>") %
                          QString("<tr> <td>. (pop)</td>         <td>'value'</td>                 <td>pops 'value' and outputs as integer</td> </tr>") %
                          QString("<tr> <td>, (pop)</td>         <td>'value'</td>                 <td>pops 'value' and outputs as ASCII</td> </tr>") %
                          QString("<tr> <td># (bridge)</td>      <td> </td>                       <td>PC jumps over next cell</td> </tr>") %
                          QString("<tr> <td>g (get)</td>         <td>'x' 'y'</td>                 <td>'value at (x, y)'</td> </tr>") %
                          QString("<tr> <td>p (put)</td>         <td>'value' 'x' 'y'</td>         <td>puts 'value' at (x, y)</td> </tr>") %
                          QString("<tr> <td>& (input value)</td> <td> </td>                       <td>value user entered</td> </tr>") %
                          QString("<tr> <td>~ (input char)</td>  <td> </td>                       <td>character user entered</td> </tr>") %
                          QString("<tr> <td>@ (end)</td>         <td> </td>                       <td>ends program</td> </tr> </table>"));
    befunge_help->setReadOnly(true);
    layout_help->addWidget(new QLabel("Befunge command summary", this));
    layout_help->addWidget(befunge_help);

    btn_run = new QPushButton("Run", this);
    btn_step = new QPushButton("Step", this);
    btn_stop = new QPushButton("Stop", this);
    btn_exit = new QPushButton("Exit", this);
    layout_buttons->addWidget(btn_run);
    layout_buttons->addSpacing(5);
    layout_buttons->addWidget(btn_step);
    layout_buttons->addSpacing(5);
    layout_buttons->addWidget(btn_stop);
    layout_buttons->addStretch();
    layout_buttons->addWidget(btn_exit);

    layout_aux_widgets->addItem(layout_stack);
    layout_aux_widgets->addItem(layout_help);

    layout_input_output->addItem(layout_input);
    layout_input_output->addItem(layout_output);

    layout_main->addItem(layout_befunge_editor);
    layout_main->addItem(layout_input_output);
    layout_main->addItem(layout_aux_widgets);

    layout_central->addItem(layout_main);
    layout_central->addItem(layout_buttons);

    connect(btn_exit, SIGNAL(clicked()), this, SLOT(close()));
    connect(btn_run, SIGNAL(clicked()), interpreter, SLOT(Run()));
    connect(btn_step, SIGNAL(clicked()), interpreter, SLOT(Step()));
}
Пример #11
0
PrefWindow::PrefWindow():BWindow(BRect(100,100,600,450),
                                     Language.get("PREFS"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
    AddChild(new PrefView(Bounds()));
    Run();
}
Пример #12
0
helper::CThreadPool &helper::CThreadPool::RunMultiAndFinish(size_t cnt, tThreadFunc threadfunc)
{
    for(size_t i=0; i!=cnt; ++i)
        Run(threadfunc, true);
    return *this;
}
Пример #13
0
helper::CThreadPool &helper::CThreadPool::RunMulti(size_t cnt, tThreadFunc threadfunc)
{
    for(size_t i=0; i!=cnt; ++i)
        Run(threadfunc, false);
    return *this;
}
Пример #14
0
helper::CThreadPool &helper::CThreadPool::RunAndFinish(tThreadFunc threadfunc)
{
    Run(threadfunc, true);
    return *this;
}
Пример #15
0
// Called at software interrupt time
void
AppleUSBUHCI::HandleInterrupt(void)
{
	UInt16					status;
	UInt32					intrStatus;
	bool					needReset = false;
		
	status = ioRead16(kUHCI_STS);

	USBTrace_Start( kUSBTUHCIInterrupts, kTPUHCIInterruptsHandleInterrupt,  (uintptr_t)this, 0, 0, 0);

	if (_hostControllerProcessInterrupt & kUHCI_STS_HCPE)
	{
		_hostControllerProcessInterrupt = 0;
		USBLog(1, "AppleUSBUHCI[%p]::HandleInterrupt - Host controller process error", this);
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, 0, 0, 1 );
		needReset = true;
	}
	if (_hostSystemErrorInterrupt & kUHCI_STS_HSE)
	{
		_hostSystemErrorInterrupt = 0;
		USBLog(1, "AppleUSBUHCI[%p]::HandleInterrupt - Host controller system error(CMD:%p STS:%p INTR:%p PORTSC1:%p PORTSC2:%p FRBASEADDR:%p ConfigCMD:%p)", this,(void*)ioRead16(kUHCI_CMD), (void*)ioRead16(kUHCI_STS), (void*)ioRead16(kUHCI_INTR), (void*)ioRead16(kUHCI_PORTSC1), (void*)ioRead16(kUHCI_PORTSC2), (void*)ioRead32(kUHCI_FRBASEADDR), (void*)_device->configRead16(kIOPCIConfigCommand));
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, ioRead16(kUHCI_CMD), 0, 2  );
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, ioRead16(kUHCI_STS), ioRead16(kUHCI_INTR), ioRead16(kUHCI_PORTSC1), 3  );
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, ioRead16(kUHCI_PORTSC2), ioRead32(kUHCI_FRBASEADDR), _device->configRead16(kIOPCIConfigCommand), 4 );
		needReset = true;
	}
	if (_resumeDetectInterrupt & kUHCI_STS_RD) 
	{
		_resumeDetectInterrupt = 0;
		USBLog(2, "AppleUSBUHCI[%p]::HandleInterrupt - Host controller resume detected - calling EnsureUsability", this);
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, 0, 0, 6);
		EnsureUsability();		
	}
	if (_usbErrorInterrupt & kUHCI_STS_EI) 
	{
		_usbErrorInterrupt = 0;
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, 0, 0, 7);
		USBLog(6, "AppleUSBUHCI[%p]::HandleInterrupt - Host controller error interrupt", this);
	}
	if (_usbCompletionInterrupt & kUHCI_STS_INT)
	{
		_usbCompletionInterrupt = 0;
		
		// USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, 0, 0, 8);
		// updates hardware interrupt time from shadow vars that are se in the real irq handler
		UpdateFrameNumberWithTime();

		USBLog(7, "AppleUSBUHCI[%p]::HandleInterrupt - Normal interrupt", this);
		if (_consumerCount != _producerCount)
		{	
			USBLog(7, "AppleUSBUHCI[%p]::HandleInterrupt - Isoch was handled", this);
		}
	}
	
	// this code probably doesn't work
	if (needReset) 
	{
		IOSleep(1000);
		USBLog(1, "AppleUSBUHCI[%p]::HandleInterrupt - Resetting controller due to errors detected at interrupt time (0x%x)", this, status);
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, status, needReset, 5 );
		Reset(true);
		Run(true);
	}

	if (_myPowerState == kUSBPowerStateOn)
	{
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, status, 0, 9);
		ProcessCompletedTransactions();
	
		// Check for root hub status change
		RHCheckStatus();
	}
	else
	{
		USBLog(2, "AppleUSBUHCI[%p]::HandleInterrupt - deferring further processing until we are running again", this);
		USBTrace( kUSBTUHCIInterrupts,  kTPUHCIInterruptsHandleInterrupt, (uintptr_t)this, 0, 0, 10);
	}
	USBTrace_End( kUSBTUHCIInterrupts, kTPUHCIInterruptsHandleInterrupt,  (uintptr_t)this, 0, 0, 0);
}
Пример #16
0
void FGTurbine::Calculate(void)
{
  double thrust;

  RunPreFunctions();

  ThrottlePos = in.ThrottlePos[EngineNumber];

  if (ThrottlePos > 1.0) {
    AugmentCmd = ThrottlePos - 1.0;
    ThrottlePos -= AugmentCmd;
  } else {
    AugmentCmd = 0.0;
  }

  // When trimming is finished check if user wants engine OFF or RUNNING
  if ((phase == tpTrim) && (in.TotalDeltaT > 0)) {
    if (Running && !Starved) {
      phase = tpRun;
      N1_factor = MaxN1 - IdleN1;
      N2_factor = MaxN2 - IdleN2;      
      N2 = IdleN2 + ThrottlePos * N2_factor;
      N1 = IdleN1 + ThrottlePos * N1_factor;
      OilTemp_degK = 366.0;
      Cutoff = false;
    } else {
      phase = tpOff;
      Cutoff = true;
      EGT_degC = in.TAT_c;
    }
  }

  if (!Running && Cutoff && Starter) {
     if (phase == tpOff) phase = tpSpinUp;
  }

  // start
  if ((Starter == true) || (in.qbar > 30.0)) {
    if (!Running && !Cutoff && (N2 > 15.0)) phase = tpStart;
  }

  if (Cutoff && (phase != tpSpinUp)) phase = tpOff;
  if (in.TotalDeltaT == 0) phase = tpTrim;
  if (Starved) phase = tpOff;
  if (Stalled) phase = tpStall;
  if (Seized) phase = tpSeize;

  switch (phase) {
    case tpOff:    thrust = Off(); break;
    case tpRun:    thrust = Run(); break;
    case tpSpinUp: thrust = SpinUp(); break;
    case tpStart:  thrust = Start(); break;
    case tpStall:  thrust = Stall(); break;
    case tpSeize:  thrust = Seize(); break;
    case tpTrim:   thrust = Trim(); break;
    default: thrust = Off();
  }

  Thruster->Calculate(thrust); // allow thruster to modify thrust (i.e. reversing)

  RunPostFunctions();
}
Пример #17
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
    g_RunningUnderWine = running_under_wine();
#ifdef PPA_INCLUDE_CHECK_UPDATE
    if (_tcsstr(lpstrCmdLine, _T(PEERS_OPTION_NO_UPDATE)) == NULL) {
        string updatePath = Text::fromT(AutoUpdate::getUpdateTargetPath());
        //TODO нужно еще exists(wstring), чтобы строку не преобразовывать
        if (File::exists(updatePath) && File::getSize(updatePath) > 0) {
            if (AutoUpdate::execute()) {
                return AutoUpdate::EXIT_TO_UPDATE;
            }
        }
    }

    //TODO else вывести сообщение если архив обновления еще есть.
#endif
#ifndef _DEBUG
    SingleInstance dcapp(_T("{DOMODC-AEE8350A-B49A-4753-AB4B-E55479A48351}"));
#else
    SingleInstance dcapp(_T("{DOMODC-AEE8350A-B49A-4753-AB4B-E55479A48350}"));
#endif
    // !SMT!-UI  displaying abort message will disable generating exceptioninfo.txt
    signal(SIGABRT, AbortSignalHandler);
#ifndef SMT_CUSTOM
    _set_abort_behavior(0, _WRITE_ABORT_MSG);
#endif

    bool multipleInstances = false;
    bool magnet = false;
    bool delay = false;

#ifdef _DEBUG
    g_DisableSplash = true;
#endif
    if(_tcsstr(lpstrCmdLine, _T("/nologo"))!=NULL || _tcsstr(lpstrCmdLine, _T("/startup"))!=NULL) {
        g_DisableSplash = true;
        nCmdShow = SW_SHOWMINIMIZED;
    }
    if(_tcsstr(lpstrCmdLine, _T("/wine"))!=NULL)
        g_RunningUnderWine = true;
    if(_tcsstr(lpstrCmdLine, _T("/q"))!=NULL)
        multipleInstances = true;
    if(_tcsstr(lpstrCmdLine, _T("/magnet"))!=NULL)
        magnet = true;
    if(_tcsstr(lpstrCmdLine, _T("/c")) != NULL) {
        multipleInstances = true;
        delay = true;
    }

    if(dcapp.IsAnotherInstanceRunning()) {
        // Allow for more than one instance...
        bool multiple = false;
        if (multipleInstances == false && magnet == false) {
            if (::MessageBox(NULL, _T(APPNAME) _T(" уже запущена, или еще не закончила операцию закрытия...\nВы уверены, что хотите загрузить еще одну копию программы?"),
                             _T(APPNAME) _T(" ") _T(VERSIONSTRING), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) {
                multiple = true;
            }
        } else {
            multiple = true;
        }

        if(delay == true) {
            Thread::sleep(2500);		// let's put this one out for a break
        }

        if(multiple == false || magnet == true) {
            HWND hOther = NULL;
            EnumWindows(searchOtherInstance, (LPARAM)&hOther);

            if (hOther != NULL) {
                // pop up
                ::SetForegroundWindow(hOther);
                //if (IsIconic(hOther)) {
                // ::ShowWindow(hOther, SW_RESTORE); // !SMT!-f - disable, it unlocks password-protected instance
                //}
                sendCmdLine(hOther, lpstrCmdLine);
            }
            return FALSE;
        }
    }

    srand((unsigned) time(NULL));
    // For SHBrowseForFolder, UPnP
    HRESULT hRes = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    // before next function call
    Util::initialize();
#ifdef _DEBUG
    InitSymInfo(Text::toT(Util::getDataPath()).c_str());
#endif
    LPTOP_LEVEL_EXCEPTION_FILTER pOldSEHFilter = NULL;
    pOldSEHFilter = SetUnhandledExceptionFilter(&DCUnhandledExceptionFilter);

    WSADATA wsaData;
    WSAStartup(MAKEWORD(2, 2), &wsaData);

    AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES | ICC_PROGRESS_CLASS | ICC_STANDARD_CLASSES |
                          ICC_TAB_CLASSES | ICC_UPDOWN_CLASS | ICC_USEREX_CLASSES);	// add flags to support other controls

    hRes = _Module.Init(NULL, hInstance);
    ATLASSERT(SUCCEEDED(hRes));

    /* !PPA!
    try {
            File f(WinUtil::getAppName(), File::READ, File::OPEN);
            TigerTree tth(TigerTree::calcBlockSize(f.getSize(), 1));
            size_t n = 0;
            size_t n2 = DEBUG_BUFSIZE;
            while( (n = f.read(buf, n2)) > 0) {
                    tth.update(buf, n);
                    n2 = DEBUG_BUFSIZE;
            }
            tth.finalize();
            strcpy(::tth, tth.getRoot().toBase32().c_str());
            WinUtil::tth = Text::toT(::tth);
    } catch(const FileException&) {
            dcdebug("Failed reading exe\n");
    }
    */

    HINSTANCE hInstRich = ::LoadLibrary(_T("RICHED20.DLL"));

    int nRet = Run(lpstrCmdLine, nCmdShow);

    if ( hInstRich ) {
        ::FreeLibrary(hInstRich);
    }

    // Return back old VS SEH handler
    if (pOldSEHFilter != NULL) {
        SetUnhandledExceptionFilter(pOldSEHFilter);
    }

    _Module.Term();
    ::CoUninitialize();
    ::WSACleanup();
#ifdef _DEBUG
    UninitSymInfo();
#endif
    return nRet;
}
Пример #18
0
ActiveExecutor::ActiveExecutor() :
	m_end(false),
	m_thread([this] { Run(); })
{
	SetExecutorThread(m_thread.get_id());
}
Пример #19
0
/* $ 06.07.2001
   + Используем filemasks вместо GetCommaWord, этим самым добиваемся того, что
     можно использовать маски исключения
   - Убрал непонятный мне запрет на использование маски файлов типа "*.*"
     (был когда-то, вроде, такой баг-репорт)
*/
bool ProcessLocalFileTypes(const string& Name, const string& ShortName, FILETYPE_MODE Mode, bool AlwaysWaitFinish)
{
	string strCommand, strDescription, strMask;
	{
		const auto TypesMenu = VMenu2::create(MSG(MSelectAssocTitle), nullptr, 0, ScrY - 4);
		TypesMenu->SetHelp(L"FileAssoc");
		TypesMenu->SetMenuFlags(VMENU_WRAPMODE);
		TypesMenu->SetId(SelectAssocMenuId);

		int ActualCmdCount=0; // отображаемых ассоциаций в меню
		filemasks FMask; // для работы с масками файлов

		int CommandCount=0;
		DWORD Index=0;
		unsigned __int64 id;
		string FileName = PointToName(Name);

		while (ConfigProvider().AssocConfig()->EnumMasksForType(Mode,Index++,&id,strMask))
		{
			strCommand.clear();

			if (FMask.Set(strMask,FMF_SILENT))
			{
				if (FMask.Compare(FileName))
				{
					ConfigProvider().AssocConfig()->GetCommand(id,Mode,strCommand);

					if (!strCommand.empty())
					{
						ConfigProvider().AssocConfig()->GetDescription(id,strDescription);
						CommandCount++;
					}
				}

				if (strCommand.empty())
					continue;
			}

			string strCommandText = strCommand;
			SubstFileName(nullptr,strCommandText,Name, ShortName,nullptr,nullptr,nullptr,nullptr,TRUE);

			// все "подставлено", теперь проверим условия "if exist"
			if (!ExtractIfExistCommand(strCommandText))
				continue;

			ActualCmdCount++;

			if (!strDescription.empty())
				SubstFileName(nullptr,strDescription, Name, ShortName, nullptr, nullptr, nullptr, nullptr, TRUE);
			else
				strDescription = strCommandText;

			MenuItemEx TypesMenuItem(strDescription);
			TypesMenuItem.SetSelect(Index==1);
			TypesMenuItem.UserData = strCommand;
			TypesMenu->AddItem(TypesMenuItem);
		}

		if (!CommandCount)
			return false;

		if (!ActualCmdCount)
			return true;

		int ExitCode=0;

		if (ActualCmdCount>1)
		{
			ExitCode=TypesMenu->Run();

			if (ExitCode<0)
				return true;
		}

		strCommand = *TypesMenu->GetUserDataPtr<string>(ExitCode);
	}

	string strListName, strAnotherListName, strShortListName, strAnotherShortListName;

	const string* ListNames[] =
	{
		&strListName,
		&strAnotherListName,
		&strShortListName,
		&strAnotherShortListName
	};

	int PreserveLFN=SubstFileName(nullptr,strCommand, Name, ShortName, &strListName, &strAnotherListName, &strShortListName, &strAnotherShortListName);
	const auto ListFileUsed = !std::all_of(ALL_CONST_RANGE(ListNames), std::mem_fn(&string::empty));

	// Снова все "подставлено", теперь проверим условия "if exist"
	if (ExtractIfExistCommand(strCommand))
	{
		SCOPED_ACTION(PreserveLongName)(ShortName, PreserveLFN);
		RemoveExternalSpaces(strCommand);

		if (!strCommand.empty())
		{
			Global->CtrlObject->CmdLine()->ExecString(strCommand,AlwaysWaitFinish, false, false, ListFileUsed, false,
				Mode == FILETYPE_VIEW || Mode == FILETYPE_ALTVIEW || Mode == FILETYPE_EDIT || Mode == FILETYPE_ALTEDIT);
			if (!(Global->Opt->ExcludeCmdHistory&EXCLUDECMDHISTORY_NOTFARASS) && !AlwaysWaitFinish) //AN
			{
				const auto curDir = Global->CtrlObject->CmdLine()->GetCurDir();
				Global->CtrlObject->CmdHistory->AddToHistory(strCommand, HR_DEFAULT, nullptr, nullptr, curDir.data());
			}
		}
	}

	std::for_each(CONST_RANGE(ListNames, i)
	{
		if (!i->empty())
			os::DeleteFile(*i);
	});
Пример #20
0
void Rekd2D::Core::Game::Run(char* title, unsigned int width, unsigned int height)
{
	Run(title, width, height, width, height);
}
void KeyControlledAnimatedCharacter_cl::ProcessKeyboardEvents()
{

  bool bLeft = m_pInputMap->GetTrigger(CHARACTER_MOVE_LEFT)!=0;
  bool bRight = m_pInputMap->GetTrigger(CHARACTER_MOVE_RIGHT)!=0;
  bool bUp = m_pInputMap->GetTrigger(CHARACTER_MOVE_FORWARD)!=0;
  bool bDown = m_pInputMap->GetTrigger(CHARACTER_MOVE_BACKWARD)!=0;
  bool bShift = m_pInputMap->GetTrigger(CHARACTER_RUN)!=0;
  bool bRaiseLowerWeapon = m_pInputMap->GetTrigger(CHARACTER_TOGGLE_WEAPON)!=0;
  bool bAttack = m_pInputMap->GetTrigger(CHARACTER_ATTACK)!=0;
  
  if (bUp)
  {
    // trigger the run/walk actions when CURSOR UP is pressed.
    // allow rotating the entity while walking/running
    if ( bShift )
      Run();
    else
      Walk();

    if (bLeft)
      RotateLeft();
    else if (bRight)
      RotateRight();
  }
  else if(bDown)
  {
    // trigger the walk backward action when CURSOR DOWN is pressed.
    // allow rotating the entity while walking backwards
    WalkBackwards();

    if(bLeft)
      RotateLeft();
    else if(bRight)
      RotateRight();
  }
  else
  {
    // switch to stand action if character is not rotating ???????????
    if ( !IsInRotateState() && !IsInRotateArmedState() )
      Stand();

    // trigger rotate actions if CURSOR LEFT/RIGHT is pressed, otherwise trigger stand action
    if(bLeft)
      RotateLeft();
    else if(bRight)
      RotateRight();
    else
      Stand();
  }


  // raise or lower weapon on SPACE key
  if(bRaiseLowerWeapon)
  {
    if(IsInUpperBodyIdleState()||IsInUpperBodyLowerWeaponState())
      Arm();
    else if(IsInUpperBodyIdleArmedState()||IsInUpperBodyDrawWeaponState())
      DisArm();
  }

  // attack on ENTER key
  if ( bAttack )
    GetUpperBodyState()->Attack();
}
Пример #22
0
// Create a tap device
int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address)
{
	int fd;
	struct ifreq ifr;
	char eth_name[MAX_SIZE];
	char instance_name_lower[MAX_SIZE];
	struct sockaddr sa;
	char *tap_name = TAP_FILENAME_1;
	int s;
#ifdef	UNIX_MACOS
	char tap_macos_name[256] = TAP_MACOS_DIR TAP_MACOS_FILENAME;
#endif
	// Validate arguments
	if (name == NULL)
	{
		return -1;
	}

	// Generate the device name
	StrCpy(instance_name_lower, sizeof(instance_name_lower), name);
	Trim(instance_name_lower);
	StrLower(instance_name_lower);
	Format(eth_name, sizeof(eth_name), "%s_%s", prefix, instance_name_lower);

	eth_name[15] = 0;

	// Open the tun / tap
#ifndef	UNIX_MACOS
	if (GetOsInfo()->OsType == OSTYPE_LINUX)
	{
		// Linux
		if (IsFile(TAP_FILENAME_1) == false)
		{
			char tmp[MAX_SIZE];

			Format(tmp, sizeof(tmp), "%s c 10 200", TAP_FILENAME_1);
			Run("mknod", tmp, true, true);

			Format(tmp, sizeof(tmp), "600 %s", TAP_FILENAME_1);
			Run("chmod", tmp, true, true);
		}
	}
	// Other than MacOS X
	fd = open(TAP_FILENAME_1, O_RDWR);
	if (fd == -1)
	{
		// Failure
		fd = open(TAP_FILENAME_2, O_RDWR);
		if (fd == -1)
		{
			return -1;
		}
		tap_name = TAP_FILENAME_2;
	}
#else	// UNIX_MACOS
	{
		int i;
		fd = -1;
		for (i = 0; i < TAP_MACOS_NUMBER; i++) {
			sprintf(tap_macos_name + strlen(TAP_MACOS_DIR TAP_MACOS_FILENAME), "%d", i);
			fd = open(tap_macos_name, O_RDWR);
			if (fd != -1)
			{
				tap_name = tap_macos_name;
				break;
			}
		}
		if (fd == -1)
		{
			return -1;
		}
	}
#endif	// UNIX_MACOS

#ifdef	UNIX_LINUX
	// Create a tap for Linux

	// Set the device name
	Zero(&ifr, sizeof(ifr));

	ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
	StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);

	if (ioctl(fd, TUNSETIFF, &ifr) == -1)
	{
		// Failure
		close(fd);
		return -1;
	}

	// MAC address setting
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s != -1)
	{
		if (mac_address != NULL)
		{
			Zero(&ifr, sizeof(ifr));
			StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);
			ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
			Copy(&ifr.ifr_addr.sa_data, mac_address, 6);
			ioctl(s, SIOCSIFHWADDR, &ifr);
		}

		Zero(&ifr, sizeof(ifr));
		StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);
		ioctl(s, SIOCGIFFLAGS, &ifr);

		ifr.ifr_flags |= IFF_UP;
		ioctl(s, SIOCSIFFLAGS, &ifr);

		close(s);
	}

#else	// UNIX_LINUX
#ifdef	UNIX_MACOS
	// MAC address setting
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s != -1)
	{
		char *macos_eth_name;
		macos_eth_name = tap_macos_name + strlen(TAP_MACOS_DIR);

		if (mac_address != NULL)
		{
			Zero(&ifr, sizeof(ifr));
			StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), macos_eth_name);
			ifr.ifr_addr.sa_len = ETHER_ADDR_LEN;
			ifr.ifr_addr.sa_family = AF_LINK;
			Copy(&ifr.ifr_addr.sa_data, mac_address, ETHER_ADDR_LEN);
			ioctl(s, SIOCSIFLLADDR, &ifr);
		}

		Zero(&ifr, sizeof(ifr));
		StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), macos_eth_name);
		ioctl(s, SIOCGIFFLAGS, &ifr);

		ifr.ifr_flags |= IFF_UP;
		ioctl(s, SIOCSIFFLAGS, &ifr);

		close(s);
	}
#endif	// UNIX_MACOS
#ifdef	UNIX_SOLARIS
	// Create a tap for Solaris
	{
		int ip_fd;
		int tun_fd;
		int ppa;

		tun_fd = open(tap_name, O_RDWR);
		if (tun_fd == -1)
		{
			// Failure
			close(fd);
			return -1;
		}

		ip_fd = open("/dev/ip", O_RDWR);
		if (ip_fd == -1)
		{
			// Failure
			close(tun_fd);
			close(fd);
			return -1;
		}

		ppa = -1;
		ppa = ioctl(tun_fd, TUNNEWPPA, ppa);
		if (ppa == -1)
		{
			// Failure
			close(tun_fd);
			close(fd);
			close(ip_fd);
			return -1;
		}

		if (ioctl(fd, I_PUSH, "ip") < 0)
		{
			// Failure
			close(tun_fd);
			close(fd);
			close(ip_fd);
			return -1;
		}

		if (ioctl(fd, IF_UNITSEL, (char *)&ppa) < 0)
		{
			// Failure
			close(tun_fd);
			close(fd);
			close(ip_fd);
			return -1;
		}

		if (ioctl(ip_fd, I_LINK, fd) < 0)
		{
			// Failure
			close(tun_fd);
			close(fd);
			close(ip_fd);
			return -1;
		}

		close(tun_fd);
		close(ip_fd);
	}

#endif	// UNIX_SOLARIS
#endif	// UNIX_LINUX

	return fd;
}
Пример #23
0
Process::Process(const std::wstring& pathName, const std::wstring& args)
{
	Run(pathName, args);
}
Пример #24
0
bool MainConfigDlg::Perform(const String& startwith) {
	list.SetCursor(0);
	list.FindSetCursor(startwith);
	return Run() == IDOK;
}
Пример #25
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));
  
  // Install crash reporting
#ifdef TEST_DEPRECATED_FUNCS

  g_pCrashRptState = Install(
    CrashCallback, 
    _T("*****@*****.**"), 
    _T("Crash"));

#else

  CR_INSTALL_INFO info;
  memset(&info, 0, sizeof(CR_INSTALL_INFO));
  info.cb = sizeof(CR_INSTALL_INFO);  
  info.pszAppName = _T("CrashRpt Tests");
  info.pszAppVersion = _T("1.2.2");
  info.pszEmailSubject = _T("Error from CrashRptTests");
  info.pszEmailTo = _T("*****@*****.**");  
  info.pszUrl = _T("http://myappcom.com/crashrpt.php");
  info.pfnCrashCallback = CrashCallback; // Define crash callback function   
  // Define sending priorities
  info.uPriorities[CR_HTTP] = 3;         // Use HTTP the first
  info.uPriorities[CR_SMTP] = 2;         // Use SMTP the second
  info.uPriorities[CR_SMAPI] = 1;        // Use Simple MAPI the last   
  info.dwFlags = 0;
  info.dwFlags |= CR_INST_ALL_EXCEPTION_HANDLERS; // Install all available exception handlers
  info.dwFlags |= CR_INST_HTTP_BINARY_ENCODING;   // Use binary encoding for HTTP uploads (recommended).  
  info.pszDebugHelpDLL = NULL;           // Search for dbghelp.dll using default search sequence
  info.uMiniDumpType = MiniDumpNormal;   // Define minidump size
  info.pszPrivacyPolicyURL = _T("http://code.google.com/p/crashrpt/wiki/PrivacyPolicyTemplate");
  info.pszErrorReportSaveDir = NULL;    // Save error reports to the default location
    
  CrAutoInstallHelper cr_install_helper(&info);
  ATLASSERT(cr_install_helper.m_nInstallStatus==0); 

  if(cr_install_helper.m_nInstallStatus!=0)
  {
    TCHAR buff[256];
    crGetLastErrorMsg(buff, 256);
    MessageBox(NULL, buff, _T("crInstall error"), MB_OK);
    return FALSE;
  }

#endif //TEST_DEPRECATED_FUNCS

  /* Create another thread */
  g_CrashThreadInfo.m_pCrashRptState = g_pCrashRptState;
  g_CrashThreadInfo.m_bStop = false;
  g_CrashThreadInfo.m_hWakeUpEvent = CreateEvent(NULL, FALSE, FALSE, _T("WakeUpEvent"));
  ATLASSERT(g_CrashThreadInfo.m_hWakeUpEvent!=NULL);

  DWORD dwThreadId = 0;
  g_hWorkingThread = CreateThread(NULL, 0, CrashThread, (LPVOID)&g_CrashThreadInfo, 0, &dwThreadId);
  ATLASSERT(g_hWorkingThread!=NULL);

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();

  // Close another thread
  g_CrashThreadInfo.m_bStop = true;
  SetEvent(g_CrashThreadInfo.m_hWakeUpEvent);
  // Wait until thread terminates
  WaitForSingleObject(g_hWorkingThread, INFINITE);

  
#ifdef TEST_DEPRECATED_FUNCS
  // Uninstall crash reporting
  Uninstall(g_pCrashRptState);

#endif //TEST_DEPRECATED_FUNCS

	::CoUninitialize();

	return nRet;
}
Пример #26
0
void ContextTrampoLine() {
    void** argPtr = (void**)((char*)AlignUp(&argPtr + 1, STACK_ALIGN) + STACK_ALIGN);
    YASSERT(*(argPtr - 1) == *(argPtr - 2));

    Run(*(argPtr - 1));
}
Пример #27
0
CygwinDlg::CygwinInstallThread::CygwinInstallThread(cxCygwinInstallMode mode, const wxString& appPath)
: m_mode(mode), m_appPath(appPath) {
	Create();
    Run();
}
Пример #28
0
void ContextTrampoLine(void* arg) {
    Run(arg);
}
Пример #29
0
int main( int argc, char *argv[ ], char *envp[ ] ) /* envp only on linux/bsd */
#endif
{
	return Run (argc,argv);
}
Пример #30
0
void AsyncRaceAnalyzerComm::RunWriteConfig(void){
	Run(ACTION_WRITE_CONFIG);
}