Exemplo n.º 1
0
static  void AddWords( msg_list *curr_msg, char *text )
//=====================================================
{
    int         index;
    msg_word    *curr_word;

    curr_word = NULL;
    for( ;; ) {
        while( *text == ' ' ) {
            ++text;
        }
        if( *text == NULLCHAR )
            break;
        index = 0;
        for( ; text[index] != NULLCHAR; ++index ) {
            if( text[index] == ' ' ) {
                text[index++] = NULLCHAR;
                break;
            }
        }
        if( curr_word == NULL ) {
            curr_word = malloc( sizeof( msg_word ) );
            curr_msg->msg = curr_word;
        } else {
            curr_word->link = malloc( sizeof( msg_word ) );
            curr_word = curr_word->link;
        }
        curr_word->link = NULL;
        curr_word->word = ProcessWord( text );
        curr_msg->count++;
        text += index;
    }
}
Exemplo n.º 2
0
void FeederCONTROL::ProcessListenWork()
{
  ListenBuf[BufPos] = 0;
  int CharLen = BufPos;

  switch(FeederListenWorkType)
  {
    case FLWT_COMMAND_FEEDBACK:
    {
      char *pTemp = ListenBuf;
      while(*pTemp)
      {
        if(*pTemp == ' ')
          pTemp++;
        else
          break;
      }
      if(strcmp(pTemp, Command) == 0)
        CommandFeedbackOk = 1;
      else
        CommandFeedbackOk = 0;
      break;
    }
    case FLWT_COMMAND_RET:
    {
      char *pNum = strchr(ListenBuf, ':');
      if(pNum)
      {
        pNum++;
        CommandRet = atoi(pNum);
        CommandRetOk = 1;
      }
      else
      {
        CommandRet = -1;
        CommandRetOk = 1;
      }
      break;
    }
    case FLWT_ERROR_CODE:
    {
      ErrorCode = 1;
      break;
    }
    case FLWT_FEED_FINISH:
    {
      bFinishFeed = 1;
      break;
    }
    case FLWT_IDLE:
    {
      ProcessWord();
      break;
    }
  }
  
  BufPos = 0;
  FeederListenWorkType = FLWT_IDLE;
}
Exemplo n.º 3
0
void FeederCONTROL::ProcessListen(char R)
{
  if(R == '\r'|| R == '\n')
  {
    ProcessListenWork();
    return ;
  }

  switch(FeederListenWorkType)
  {
    case FLWT_IDLE:
    {
      if(R == '$')
        FeederListenWorkType = FLWT_COMMAND_RET;
      else if(R == '[')
        FeederListenWorkType = FLWT_ERROR_CODE;
      else if(R == '@')
        FeederListenWorkType = FLWT_FEED_FINISH;
      else
      {
        if(R == ' ')
          ProcessWord();
        else
        {
          Word[WordPos] = R;
          WordPos++;
          if(WordPos >= 0xFF)
            ProcessWord();
        }
      }
      break;
    }
    default:
    {
      ListenBuf[BufPos] = R;
      BufPos++;
      if(BufPos >= 0xFF)
        ProcessListenWork();
      break;
    }
  }
}
Exemplo n.º 4
0
void CLibraryDictionary::ProcessPhrase(CLibraryFile& oFile, const CString& strPhrase, bool bAdd,
	bool bCanUpload)
{
	if ( strPhrase.IsEmpty() )
		return;

	CStringList oKeywords;
	CQueryHashTable::MakeKeywords( strPhrase, oKeywords );
	for ( POSITION pos = oKeywords.GetHeadPosition(); pos; )
	{
		ProcessWord( oFile, oKeywords.GetNext( pos ), bAdd, bCanUpload );
	}
}
Exemplo n.º 5
0
static  msg_list        *AddWords( char *msg ) {
//==============================================

    int         index;
    char        *word_str;
    msg_list    *curr_msg;
    msg_word    *curr_word;
    int         word_size;

    curr_msg = InitMsg();
    curr_word = NULL;
    for(;;) {
        while( *msg == ' ' ) {
            ++msg;
        }
        if( *msg == NULLCHAR ) break;
        index = 0;
        for(;;) {
            if( msg[ index ] == NULLCHAR ) break;
            ++index;
            if( msg[ index ] == ' ' ) break;
        }
        word_size = index + 1;
        if( msg[ index ] == ' ' ) {
            msg[ index++ ] = NULLCHAR;
        }
        word_str = malloc( word_size );
        strcpy( word_str, msg );
        if( curr_word == NULL ) {
            curr_word = malloc( sizeof( msg_word ) );
            curr_msg->msg = curr_word;
        } else {
            curr_word->link = malloc( sizeof( msg_word ) );
            curr_word = curr_word->link;
        }
        curr_word->link = NULL;
        curr_word->word = ProcessWord( word_str );
        curr_msg->count++;
        msg += index;
    }
    return( curr_msg );
}
Exemplo n.º 6
0
void TextBox::DrawText()
{
  if (performState == suspend) return;
 
  if (performState == running && checkVisible()) {
    if (--draw_current <= 0) {
      if (wordsToRender[0] == '/') { //部分文字输出结束,等待用户继续,'/p'为不换行,'/n'为换行
	wordsToRender.erase(0, 1);
	if (wordsToRender[0] == 'n') {
	  NewLine();
	}
	wordsToRender.erase(0, 1);
	performState = waiting;
      } else {
	ProcessWord(wordsToRender[0]);
	wordsToRender.erase(0, 1);
	if (wordsToRender.empty()) 
	  performState = suspend;
      }
      draw_current = draw_interval;
    }
  }
}