示例#1
0
文件: test6.c 项目: 8l/soc
void _printnum(int32 *str, int32 v)
{
  itoa(v,tmp);
  _print(str);
  _print(tmp);
  _print("\n");
}
bool PyDumpVisitor::VisitList( const PyList* rep )
{
    if( rep->empty() )
        _print( "%sList: Empty", _pfx() );
    else
    {
        _print( "%sList: %lu elements", _pfx(), rep->size() );

        PyList::const_iterator cur, _end;
        cur = rep->begin();
        _end = rep->end();
        for( uint32 i = 0; cur != _end; cur++, i++ )
        {
            if( i > 200 && !fullNested() )
            {
                _print( "%s  ... truncated ...", _pfx() );
                break;
            }

            _pfxExtend( "  [%2u] ", i );
            bool res = (*cur)->visit( *this );
            _pfxWithdraw();

            if( !res )
                return false;
        }
    }
    return true;
}
示例#3
0
Adesk::Boolean myWorldGeometry::polyline(const Adesk::UInt32 nbPoints,
                const AcGePoint3d* pVertexList,
                const AcGeVector3d* pNormal, // = NULL
                Adesk::LongPtr lBaseSubEntMarker
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::polyline %d\n"), nbPoints);
    Adesk::UInt32 i;
    for (i = 0; i < nbPoints; i++)
    {
        _print(_T("\t\t\tAcGePoint3d %g,%g,%g\n"), 
            pVertexList[i].x,
            pVertexList[i].y,
            pVertexList[i].z);
    }
    if (pNormal)
    {
        _print(_T("\t\t\tAcGeVector3d %g,%g,%g\n"), 
            pNormal->x,
            pNormal->y,
            pNormal->z);
    }
    _print(_T("\t\tAdesk::Int32 %d\n"), lBaseSubEntMarker);
    return 0;
}
bool PyDumpVisitor::VisitPackedRow( const PyPackedRow* rep )
{
    _print( "%sPacked Row:", _pfx() );
    _print( "%s column_count=%u", _pfx(), rep->header()->ColumnCount() );

    PyPackedRow::const_iterator cur, end;
    cur = rep->begin();
    end = rep->end();
    for( uint32 i = 0; cur != end; cur++, i++ )
    {
        _pfxExtend( "  [%2u] %s: ", i, rep->header()->GetColumnName( i )->content().c_str() );

        bool res = true;
        if( (*cur) == NULL )
            _print( "%s(None)", _pfx() );
        else
            res = (*cur)->visit( *this );

        _pfxWithdraw();

        if( !res )
            return false;
    }

    return true;
}
示例#5
0
文件: test3.c 项目: 8l/soc
void _printtsth(int32 *str, int32 num)
{
  _print(str);
  itoah(num, buf);
  _print(buf);
  _print("\n");
}
示例#6
0
文件: main.c 项目: georgeee/OS_4sem
int line_processor (struct line_read_state * state, char * line, int len, int counter, int err_code){
    if(err_code != _GETLINE_NONE && err_code != _GETLINE_EOF) return -1;
    if(len > 0){
        state->line_counter++;
        if(state->line_counter == 1){
            return init_complex_pipe(&state->pipe, create_exec_args(line));
        }else{
            struct str_splited_pair pointers [3];
            int cnt = _split(line, " ", pointers, 2);
            if(cnt < 2){
                _print(STDERR_FILENO, "Wrong format!\n");
                return 0;
            }
            *pointers[0].end = '\0';
            *pointers[1].end = '\0';
            if(strcmp(pointers[0].start, "->") == 0){
                return bind_left(&state->pipe, create_exec_args(pointers[1].start));
            }else if(strcmp(pointers[0].start, "<-") == 0){
                return bind_right(&state->pipe, create_exec_args(pointers[1].start));
            }else{
                _print(STDERR_FILENO, "Wrong format!\n");
                return 0;
            }
        }
    }else{
        return 1;
    }
    return 0;
}
示例#7
0
		void _print(pointer_type node) const
		{
			bool printed(false);
			if (node->left_ != nullptr)
			{
				_print(node->left_);
			}
			else
			{
				std::cout << node->data_ << std::endl;
				printed = true;
			}

			if (node == head_)
			{
				std::cout << node->data_ << std::endl;
				printed = true;
			}

			if (node->right_ != nullptr)
			{
				_print(node->right_);
			}
			else
			{
				if (!printed)
				{
					std::cout << node->data_ << std::endl;
					printed = true;
				}
			}

			if (!printed)
				std::cout << node->data_ << std::endl;
		}
示例#8
0
文件: test6.c 项目: 8l/soc
void _printpos(int32 *str, int32 *ptr)
{
  int32 p = _ptrint(ptr);
  itoah(p,tmp);
  _print(str);
  _print(tmp);
  _print("\n");
}
示例#9
0
void _printtst(int32 *str, int32 num)
{
  int32 buf[32];
  _print(str);
  itoa(num, buf);
  _print(buf);
  _print("\n");
}
示例#10
0
void PolycodeConsole::handleEvent(Event *event) {

	if(event->getDispatcher() == CoreServices::getInstance()->getLogger()) {
		if(event->getEventCode() == Event::NOTIFY_EVENT) {
			LoggerEvent *loggerEvent = (LoggerEvent*)event;
			_print(loggerEvent->message);
		}
	} else if(event->getDispatcher() == consoleWindow->clearButton) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
			debugTextInput->setText("");
		}
	} else if(event->getDispatcher() == consoleWindow->hideConsoleButton) {
		globalFrame->hideConsole();
	}

	if(event->getDispatcher() == consoleTextInput) {
		if(event->getEventCode() == Event::COMPLETE_EVENT && event->getEventType() == "" && consoleTextInput->getText() != "") {
			_print(">"+consoleTextInput->getText()+"\n");
			if(debugger) {
				if(!debugger->isConnected()) {
					_print("Unable to inject code. No debugger clients connected.\n");
				} else {
					debugger->injectCode(consoleTextInput->getText());
				}
			}
			
			consoleHistory.push_back(consoleTextInput->getText());
			if (consoleHistory.size() > consoleHistoryMaxSize) { consoleHistory.erase(consoleHistory.begin()); }
			consoleHistoryPosition = consoleHistory.size();
			
			consoleTextInput->setText("");
		}
	}

	if (event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) {
		if (consoleTextInput->hasFocus && event->getEventCode() == InputEvent::EVENT_KEYDOWN) {
			InputEvent *inputEvent = (InputEvent*)event;
			if (inputEvent->keyCode() == KEY_UP) { 
				consoleHistoryPosition--;
				if (consoleHistoryPosition >= 0) {
					consoleTextInput->setText(consoleHistory.at(consoleHistoryPosition));
				} else {
					consoleHistoryPosition = -1;
					consoleTextInput->setText("");
				}
			}
			if (inputEvent->keyCode() == KEY_DOWN) { 
				consoleHistoryPosition++;
				if (consoleHistoryPosition < consoleHistory.size()) {
					consoleTextInput->setText(consoleHistory.at(consoleHistoryPosition));
				} else {
					consoleHistoryPosition = consoleHistory.size();
					consoleTextInput->setText("");
				}
			}
		}
	}
}
void _print(node*& ptr)
{
    if(ptr == NULL){
        return;
    }
    std::cout << ptr->data << " ";
    _print(ptr->left);
    _print(ptr->right);
}
示例#12
0
bool PyDumpVisitor::VisitString( const PyString *rep )
{
    if( IsPrintable( rep ) )
        _print( "%sString: '%s'", _pfx(), rep->content().c_str() );
    else
        _print( "%sString: '<binary, len=%lu>'", _pfx(), rep->content().length() );

    return true;
}
示例#13
0
bool PyDumpVisitor::VisitWString( const PyWString* rep )
{
    // how to do it correctly?
    if( IsPrintable( rep ) )
        _print( "%sWString: '%s'", _pfx(), rep->content().c_str() );
    else
        _print( "%sWstring: '<binary, len=%lu>'", _pfx(), rep->content().length() );

    return true;
}
示例#14
0
extern void print(Node *head) {
	if (!head)
		return;
	_print(head->child[0]);
	wprintf(L"  ||  ");
	_print(head->child[1]);
	wprintf(L"  ||  ");
	_print(head->child[2]);
	wprintf(L"  ||  ");
	return;
}
示例#15
0
static void
oeth_print_packet(unsigned long add, int len)
{
	int i;

	_print("ipacket: add = %lx len = %d\n", add, len);
	for(i = 0; i < len; i++) {
  		if(!(i % 16))
    			_print("\n");
  		_print(" %.2x", *(((unsigned char *)add) + i));
	}
	_print("\n");
}
/* return cmd.*/
int Connect::_connect_asyncReceive(Daemon_cmd_T *p_cmd,int *p_error)
{


	char *buffer = NULL;
	int len = 0,receiveLen = 0;

	if( (receiveLen = _p.available()) > 0)
	{
		//_print(" receive data: \n");
		receiveLen +=128;
		buffer = (char*)malloc(receiveLen);
		if(buffer == NULL)
			return 0;

		memset(buffer,0,receiveLen);
		for(len = 0;_p.available() > 0;len++)
		{
		
			if(len  < receiveLen)
			{
				//char c;
				buffer[len]=_p.read();
				//c = buffer[len];
				//Serial.print(c);
 			}
		}
		
		*p_cmd = (Daemon_cmd_T)manage_handleReceive(buffer,&index,p_error,&_l_port);
#if 0		
		_print("\n receive buf : \n");
		_printArray(buffer,strlen(buffer));

		_print(" \n _connect_asyncReceive cmd :\n");
		Serial.print(*p_cmd,DEC);
		_print(" \n _connect_asyncReceive index :\n");
		Serial.print(index,DEC);
		_print(" \n _connect_asyncReceive error :\n");
		Serial.print(*p_error,DEC);
		_print("\tend \n");
#endif		
		if(buffer)
			free(buffer);

		return receiveLen;
	}

	return 0;
}
示例#17
0
void _print(tree *root, int spc)
{
        if (root == NULL)
                return;

        int i;

        _print(root->right, spc + 1);
        for (i = 0; i < spc; i++)
                printf("\t");
        printf("%d\n", root->data);
        _print(root->left, spc + 1);

        return;
}
示例#18
0
/*  ============================= _print ============================= 
	This function uses recursion to print the tree. At each level, the 
    level number is printed along with the node contents.
    Pre		root is the root of a tree or subtree
            level is the level of the tree: tree root is 0
    Post    Tree has been printed.
*/
void _print (BSTNODE *root, int   level) 
{
 	int i;
 	
  	if ( root )
 	{
		_print ( root->right, level + 1 );
		for (i = 0; i <= level; i++ )
 			printf (" " );
		printf( "%d: %s\n", level, root->ptrPackage->name  );
		_print ( root->left, level + 1 );
 	} 

	return;
 } 
示例#19
0
Adesk::Boolean myWorldGeometry::polygon(const Adesk::UInt32 nbPoints,
                const AcGePoint3d* pVertexList
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::polygon %d\n"), nbPoints);
    Adesk::UInt32 i;
    for (i = 0; i < nbPoints; i++)
    {
        _print(_T("\t\t\tAcGePoint3d %g,%g,%g\n"), 
            pVertexList[i].x,
            pVertexList[i].y,
            pVertexList[i].z);
    }
    return 0;
}
示例#20
0
static void _print(Node *head) {
	if (!head)
		return;
	wchar_t *string = (wchar_t *) calloc(3, sizeof(wchar_t));
	string[0] = head->value[0];
	string[1] = head->value[1];
	string[2] = 0x0000;
	wprintf(L" %ls ", string);
	free(string);
	if (!head->child[0])
		return;
	_print(head->child[0]);
	_print(head->child[1]);
	_print(head->child[2]);
	return;
}
示例#21
0
Adesk::Boolean myWorldGeometry::xline(const AcGePoint3d& one_xline_point,
                                const AcGePoint3d& a_different_xline_point
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::xline\n"));
    return 0;
}
示例#22
0
// external facing version of the tree printer.
void print()
{
    pthread_mutex_lock(&mutex);
    //DEBUG_PRINT("Tree: Root = %p\n", root);
    _print(root, 0);
    pthread_mutex_unlock(&mutex);
}
示例#23
0
Adesk::Boolean myWorldGeometry::ray(const AcGePoint3d& rays_starting_point,
                                const AcGePoint3d& a_different_ray_point
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::ray\n"));
    return 0;
}
示例#24
0
int
main(int argc, char *argv[])
{
   if (!efreet_init())
     {
        fputs("ERROR: Could not initialize efreet!\n", stderr);
        return EXIT_FAILURE;
     }

   if (argc < 2)
     _print_all();
   else
     {
        int i;

        for (i = 1; i < argc; i++)
          if ((strcmp(argv[i], "-h") == 0) ||
              (strcmp(argv[i], "--help") == 0))
            {
               _help(argv[0]);
               goto end;
            }

        for (i = 1; i < argc; i++)
          _print(argv[i]);
     }

 end:
   efreet_shutdown();
   return EXIT_SUCCESS;
}
示例#25
0
// helper function for printing the trie
static void _print (struct trie_node *node, int indent)
{
    if (!node)
        return;
    
    int i = 0;
    for (;i<indent; ++i)
        DEBUG_PRINT("  ");
    
    DEBUG_PRINT("Node: %p,  Key: %.*s, IP: %d, Next: %p, Children: %p\n",
                node, (int)node->strlen, node->key, node->ip4_address,
                node->next, node->children);
    
    _print(node->children, indent+1);
    _print(node->next, indent);
}
示例#26
0
int main() {
    int i,j,k;
    i = 0;
    j = 1;
    k = 2;
    _print(i,j,k);

    if (k>i)
        _print("k > i");
    if (j>i)
        _print("j > i");
    if (i>j)
        _print("i > j");
    else
        _print("else works!");
}
示例#27
0
文件: debug.cpp 项目: haobug/gnote
  /** assert 
   * 
   */
  void dbg_assert(bool condvalue, const char* cond, const char* filen,
          int linen, const char* reason)
  {
    if(!condvalue) {
      _print("ASSERT: ", "%s:%d %s", cond, filen, linen, reason);

    }
  }
示例#28
0
Adesk::Boolean myWorldGeometry::circle(const AcGePoint3d& center,
                const double radius,
                const AcGeVector3d& normal
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::circle\n"));
    return 0;
}
示例#29
0
Adesk::Boolean myWorldGeometry::circle(const AcGePoint3d& pt1,
                const AcGePoint3d& pt2,
                const AcGePoint3d& pt3
                                ) const
{
    _print(_T("\t\tmyWorldGeometry::circle\n"));
    return 0;
}
示例#30
0
Adesk::Boolean myWorldGeometry::pline(const AcDbPolyline& lwBuf,
                                        Adesk::UInt32 fromIndex,  // = 0
                                        Adesk::UInt32 numSegs     // = 0
                                        ) const
{
    _print(_T("\t\tmyWorldGeometry::pline\n"));
    return Adesk::kTrue;
}