Пример #1
0
void _display(struct rb_node *temp, int (*a)[10], int *row, int *col)
{
	if(temp == 0)
		return;
	(*row)++;
	_display(temp->rb_left, a, row,col);
	a[*row][(*col)++] = rb_entry(temp, SAWON,tree)->sid;
	_display(temp->rb_right, a, row, col);
	(*row)--;
}
Пример #2
0
void _display ( NODE *temp, int (*a)[10], int *row, int *col )
{
  if (temp == 0)
    return;
  (*row)++;
  _display(temp->left, a, row, col);
  a[*row][(*col)++] = temp->data;
  _display(temp->right, a, row, col);
  (*row)--;
}
Пример #3
0
    void* consoleDaemon(void* unused)
    {
        // Detach and register daemon with shutdown path.
        task_detach();
        INITSERVICE::registerShutdownEvent(g_msgq, SYNC,
                                           INITSERVICE::CONSOLE_PRIORITY);

        // Create a default output UART device if there isn't already one.
        //    - Some devices are registered via the CONSOLE_UART_DEFINE_DEVICE
        //      macro and therefore don't need this.
        if (NULL == Uart::g_device)
        {
            Uart::g_device = new Uart();
            Uart::g_device->initialize();
        }

        while(1)
        {
            msg_t* msg = msg_wait(g_msgq);

            switch (msg->type)
            {
                case DISPLAY:
                {
                    if (NULL != msg->extra_data)
                    {
                        char timestamp[11];
                        sprintf(timestamp, "%3d.%05d|",
                                msg->data[0],
                                    // 5 Digits worth of ns.
                                (msg->data[1]*100000)/NS_PER_SEC);
                        _display(timestamp);

                        _display(
                            static_cast<const char*>(msg->extra_data));
                        free(msg->extra_data);
                    }
                    msg_free(msg);
                    break;
                }

                case SYNC:
                {
                    msg_respond(g_msgq, msg);
                    break;
                }
            }

        }

        return NULL;
    }
Пример #4
0
void print (NODE *temp)
{
  int i,j;
  int array[10][10] = {{0, }, };
  int row = -1;
  int col = 0;

  system("clear");
  printf("\n");
  _display(root, array, &row, &col);

  for (i=0; i<5; i++)
    {
      for (j=0; j<10; j++)
        {
          if (array[i][j] == 0)
            {
              printf("%2c", ' ');
            }
          else {
            printf("%2d", array[i][j]);
          }
        }
      printf("\n");
    }
  getchar();
}
Пример #5
0
void display(struct rb_root * root)
{
	int i, j;
	INFO a[10][10] = {{0,},};
	int row = -1;
	int col = 0;
	system("clear");
	_display(root->rb_node, a, &row, &col);

	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
		{
			if(a[i][j].sid == 0)
				printf("%4c", ' ');
			else
			{
				if(a[i][j].color == 1)
					printf("[%4d]", a[i][j].sid);
				else
					printf("<%4d>", a[i][j].sid);
			}
		}
		printf("\n\n");
	}
	getchar();
}
Пример #6
0
void
display (trieNode *root)
{
	char word[MAX_WORD_SIZE];
	
	memset(word, 0, MAX_WORD_SIZE);
	_display(root, word, 0);
}
Пример #7
0
unsigned char* static_selfindex::display(unsigned int start, unsigned int end) {
    if(end >= this->tlen-1) { //we don't want to extract the trailing '\0'
        end = this->tlen-2;
    }
    if(start>end)return NULL;
    unsigned char* sstr = _display(start,end);
    if(sstr!=NULL) {
        //std::cout<<sstr<<std::endl;
        if(sigma_mapper->unmap(sstr,end-start+1)!=0) {
            delete [] sstr;
            return NULL;
        }
    }
    return sstr;
}
Пример #8
0
static void keyboard(unsigned char key, int x, int y)
{
    switch (key) {
        case 'q':
        case 'Q':
        case '\033':
            /* ESC か q か Q をタイプしたら終了 */
            exit(0);
        case 'r':
        case 'R':
            Program::ClearAll();
            Shader::ClearAll();
            _display();
            break;
        default:
            break;
    }
}
Пример #9
0
void display(struct rb_root * root)
{
	int i, j;
	int a[10][10] = {{0,},};
	int row = -1;
	int col = 0;
	system("clear");
	_display(root->rb_node, a, &row, &col);
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
		{
			if(a[i][j] == 0)
				printf("%4c", ' ');
			else
				printf("%4d", a[i][j]);
		}
		printf("\n\n");
	}
	getchar();
}
Пример #10
0
int APIENTRY wWinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPTSTR    lpCmdLine,
                       int       nCmdShow)
{
	// load config
	utils::params::instance().load (win_utils::cwd<std::string>()+std::string("config")); 
	

	// get logger
	static const char* LOG_FILE = "log.txt";
	utils::logger logger (LOG_FILE);
	logger << "Starting" << std::endl;


	try
	{
		// pdf lib init & work
		_pdf_lib _lib(0, NULL);
			if (!_lib._ok)
				return 1;


		GlobalParams::initGlobalParams(NULL)->setEnableT1lib("no");
		GlobalParams::initGlobalParams(NULL)->setEnableFreeType("yes");
		GlobalParams::initGlobalParams(NULL)->setErrQuiet(gFalse);
		GlobalParams::initGlobalParams(NULL)->setAntialias("yes");
		GlobalParams::initGlobalParams(NULL)->setupBaseFonts(win_utils::cwd<std::string>().c_str());

		// file
		std::wstring file (utils::convert(utils::params::instance().value("file",std::string("g:\\test.pdf"))));

		// create ui
		ui::test_widget<_display> ui (
				hInstance,
				ui::position(
					utils::params::instance().value("x",0),
					utils::params::instance().value("y",0),
					utils::params::instance().value("width",900),
					utils::params::instance().value("height",530)),
					_display (pdfobjects::CPdf::getInstance (utils::convert(file).c_str(), pdfobjects::CPdf::ReadOnly)),
				file
			);
		ui.show();

		BOOL ret = 0;
		MSG msg = {0};

		while ((ret=::GetMessage(&msg,NULL,0,0)) != 0)
		{ 
				if (-1 == ret)
					break;
			::TranslateMessage(&msg); 
			switch (msg.message)
			{
				case WM_CHAR:
				{
					ui.page (static_cast<char>(msg.wParam)-'0');
					::InvalidateRect (ui, NULL, true);
					::UpdateWindow (ui);
					break;
				}
				case WM_CANCELMODE:
				case WM_QUIT:
					::PostQuitMessage (0);
					break;
			}
			::DispatchMessage(&msg); 
		}

		logger << "Ending..." << std::endl;

	}catch (std::exception& e)
	{
		logger << "Exception: " << e.what() << std::endl;
	}

	return 0;
}
Пример #11
0
//bool           Affine2Vector::is_subset(const Affine2Vector& x) const           { return _is_subset(*this,x); }
//bool           Affine2Vector::is_subset(const IntervalVector& x) const          { return _is_subset(*this,x); }
//bool           Affine2Vector::is_strict_subset(const Affine2Vector& x) const    { return _is_strict_subset(*this,x); }
//bool           Affine2Vector::is_strict_subset(const IntervalVector& x) const   { return _is_strict_subset(*this,x); }
//bool           Affine2Vector::is_zero() const                                   { return _is_zero(*this); }
//bool           Affine2Vector::is_bisectable() const                             { return _is_bisectable(*this); }
//Vector         Affine2Vector::rad() const                                       { return _rad(*this); }
//Vector         Affine2Vector::diam() const                                      { return _diam(*this); }
//int            Affine2Vector::extr_diam_index(bool min) const                   { return _extr_diam_index(*this,min); }
std::ostream& operator<<(std::ostream& os, const Affine2Vector& x)              { return _display(os,x); }
Пример #12
0
static _slot_info_ptr _choose(cptr verb, int options)
{
    _slot_info_ptr result = NULL;
    int            slot = 0;
    int            cmd;
    rect_t         r = _menu_rect();
    string_ptr     prompt = NULL;
    bool           done = FALSE;
    bool           exchange = FALSE;
    int            slot1 = _INVALID_SLOT, slot2 = _INVALID_SLOT;

    if (REPEAT_PULL(&cmd))
    {
        slot = A2I(cmd);
        if (0 <= slot && slot < _MAX_SLOTS)
            return &_spells[slot];
    }

    prompt = string_alloc();
    screen_save();
    while (!done)
    {
        string_clear(prompt);

        if (exchange)
        {
            if (slot1 == _INVALID_SLOT)
                string_append_s(prompt, "Select the first spell:");
            else
                string_append_s(prompt, "Select the second spell:");
        }
        else
        {
            string_printf(prompt, "%s which spell", verb);
            if (options & _ALLOW_EXCHANGE)
                string_append_s(prompt, " [Press 'X' to Exchange]");
            string_append_c(prompt, ':');
        }
        prt(string_buffer(prompt), 0, 0);
        _display(r, options);

        cmd = inkey_special(FALSE);

        if (cmd == ESCAPE || cmd == 'q' || cmd == 'Q')
            done = TRUE;

        if (options & _ALLOW_EXCHANGE)
        {
            if (!exchange && (cmd == 'x' || cmd == 'X'))
            {
                exchange = TRUE;
                slot1 = slot2 = _INVALID_SLOT;
            }
        }

        if ('a' <= cmd && cmd < 'a' + _MAX_SLOTS)
        {
            slot = A2I(cmd);
            if (exchange)
            {
                if (slot1 == _INVALID_SLOT)
                    slot1 = slot;
                else
                {
                    slot2 = slot;
                    if (slot1 != slot2)
                    {
                        _slot_info_t  tmp = _spells[slot1];
                        _spells[slot1] = _spells[slot2];
                        _spells[slot2] = tmp;
                    }
                    exchange = FALSE;
                    slot1 = slot2 = _INVALID_SLOT;
                }
            }
            else
            {
                if (_spells[slot].realm != REALM_NONE || (options & _ALLOW_EMPTY))
                {
                    result = &_spells[slot];
                    done = TRUE;
                }
            }
        }
    }

    if (result)
    {
        REPEAT_PUSH(I2A(slot));
    }

    screen_load();
    string_free(prompt);
    return result;
}
Пример #13
0
static void display(void)
{
	_display(14, 0, 0, 0, 0);
	_display(15, 0, 0, 0, 0);
	_display(14, 6, 2, 0.5, 2);
	_display(15, 6, 2, 0.5, 2);
	_display(14, HUGE_VAL, HUGE_VAL, 1, HUGE_VAL);
	_display(15, HUGE_VAL, HUGE_VAL, 1, HUGE_VAL);
	_display(5, 6, 2, 0.5, 2);
	_display(4, 6, 2, 0.5, 2);
	_display(3, 6, 2, 0.5, 2);
	_display(2, 6, 2, 0.5, 2);
	_display(1, 0, 0, 0, 0);
	_display(1, 6, 2, 0.5, 2);
	_display(1, HUGE_VAL, HUGE_VAL, 1.0, HUGE_VAL);
}