len3d

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

    
const char *word = pszLine;
    
char word_buffer[EI_MAX_CHAR_NUM];
    
int  addr = 0;
    
bool last_word_is_space = false;
    
while(1){
        
if(word[0!= ' ' && word[0!= '\t' && word[0!= 0){
            
if(last_word_is_space){
                word_buffer[addr] 
= 0;
                addr 
= 0;
                set_text_color(EI_MAIN_WINDOW_TEXT_COLOR);
                draw_text(word_buffer);
            }

            last_word_is_space 
= false;
        }
else{
            
if(!last_word_is_space){
                word_buffer[addr] 
= 0;
                addr 
= 0;
                
bool is_keyword = false;
                
for(int i = 0; i < KEYWORD_TABLE_SIZE; ++i){
                    
if(strcmp(word_buffer,keyword_table[i].name)==0){
                        is_keyword 
= true;
                        set_text_color(keyword_table[i].color);
                        
break;
                    }

                }

                
if(!is_keyword)
                    set_text_color(EI_MAIN_WINDOW_TEXT_COLOR);
                draw_text(word_buffer);
            }

            
if(word[0== 0)
                
break;
            last_word_is_space 
= true;
        }

        word_buffer[addr] 
= word[0];
        
++addr;
        
++word;
    }

    draw_text(
"\r\n");
posted on 2005-08-25 16:42  Len3d  阅读(298)  评论(0编辑  收藏  举报