搜索
bottom↓
回复: 44

[原创] 实用工具 在BBS中高亮显示C/C++中的关键字

[复制链接]

出0入0汤圆

发表于 2009-9-18 01:33:37 | 显示全部楼层 |阅读模式
[原创] 实用工具 在BBS中高亮显示C/C++中的关键字

CodePaint 1.0 源代码
ourdev_482069.zip(文件大小:116K) (原文件名:CodePaint.zip)
CodePaint 可执行程序
点击此处下载 ourdev_482132.zip(文件大小:171K) (原文件名:UIParser.zip)


由VS2003编译
词法分析部分是由lex编写
文件包中包含lex编译程序"flex.exe"

编译过程
1. 用CFlex.bat调用flex.exe,把Parser.l编译成Parser.cpp
2. 用VS编译工程

功能:
将C/C++中的关键字、字符串、数字以及注释用高亮的方式在论坛中显示出来
可以在代码前面加上行号,方便阅读

使用方法:
将源代码粘贴至上面的文本框中,点击Convert按钮
在下面的文本框中会生成BBS中的代码,同时内容被复制到剪切板中,在论坛中粘贴即可


(原文件名:Pre-Cov.jpg)


(原文件名:Post-Cov.jpg)


效果如下:
static int srcRemain = 0;   //< remain characters for the source text
static int srcLength = 0;   //< length of the source text
static char* lpSrc = NULL;  //< source buffer pointer
/* lex parser function */
int     yylex(void);
void    ParseStart(void);
CComboBox* pLog = NULL;     //< combo box pointer used for log data
string  result;             //< result generate by the parser
BOOL    bNeedLineNumber;    //< Flag used for output line number
char*   lnFormatComment;    //< line number format for block comment
char*   lnFormatNormal;     //< line number format for normal code
char*   currentFormat;      //< current format style, e.g. "ouravr"
int     curPos;             //< current source character position

加上行号后的效果
/*0001*/  void CUIParserDlg::OnBnClickedConvert()</font>
/*0002*/  {
<font color=#646400>/*0003*/  
    // TODO: Add your control notification handler code here
/*0004*/  
/*0005*/      /** convert the Unicode string to mulit-byte for parser */
/*0006*/      CString str;
/*0007*/      m_sourceView.GetWindowText(str);
/*0008*/      if(m_textSrc)delete [] m_textSrc;
/*0009*/      m_textSrcLen = ::WideCharToMultiByte(CP_ACP,0,str,-1,NULL,0,NULL,NULL);
/*0010*/      m_textSrc = new char[m_textSrcLen];
/*0011*/      if(!m_textSrc){
/*0012*/          AfxMessageBox(_T("Fail to allocate buffer for the text!"));
/*0013*/          return;
/*0014*/      }
/*0015*/      ::WideCharToMultiByte(CP_ACP,0,str,-1,m_textSrc,(int)m_textSrcLen,NULL,NULL);
</font>

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2009-9-18 02:39:22 | 显示全部楼层
……真够累的,这点功能也需要个ActiveX控件啊?

出0入0汤圆

 楼主| 发表于 2009-9-18 10:49:56 | 显示全部楼层
ActiveX控件?不解?这是一个独立的可执行程序

前面看到有人把代码改了颜色后发出来,于是就看看能不能做成语法高亮的形式
这个代码稍加修改也可以用在其它的论坛上

最好当然是论坛直接支持语法高亮,也不用打tag这么麻烦

出0入148汤圆

发表于 2009-9-18 11:25:50 | 显示全部楼层
感觉不出这工具的实用性,基本上把代码粘到随便一个编辑器上都可以有这效果(M$的就算了)。

如果是要在网页中显示高亮,也有很多js脚本可用,根本不需要这复制粘贴的步骤。

出0入0汤圆

 楼主| 发表于 2009-9-18 11:54:01 | 显示全部楼层
楼上说的是自己能够控制网站代码的情况下,那可以用很多方法来着色

但是如果你访问的地方不支持语法高亮,只支持颜色标签,可以用这个东西

实用的确称不上
代码文档化方面doxygen做得很不错了
但是你得有自己能管理的服务器把它做的Html文档上传

出0入0汤圆

发表于 2009-9-18 11:58:58 | 显示全部楼层
有意思!

出0入0汤圆

发表于 2009-9-18 13:27:53 | 显示全部楼层
真的不错啊,顶了

出0入0汤圆

发表于 2009-9-18 13:28:44 | 显示全部楼层
不错,看来楼主对yacc 和 lex比较熟悉吧?好东西。

出0入0汤圆

 楼主| 发表于 2009-9-18 16:11:23 | 显示全部楼层
【7楼】 oldtom
不错,看来楼主对yacc 和 lex比较熟悉吧?好东西。
-----------------------------
以前做过一个源代码分析的工具,代码现在自己看都有点吃力了
现在做这个小玩意就当是复习一下吧,不过这个里面没有用到yacc的语法分析

出0入46汤圆

发表于 2009-9-18 16:33:28 | 显示全部楼层
不错!

出0入42汤圆

发表于 2009-9-18 16:37:27 | 显示全部楼层
挺好的工具,以后求助的时候铁代码至少有人看了

出0入0汤圆

发表于 2009-9-18 18:15:29 | 显示全部楼层
不错。收下。

先试试。

/*0001*/  
/*0002*/  #include "config.h"
/*0003*/  
/*0004*/  TTimer   Timer1;
/*0005*/  
/*0006*/  int main()
/*0007*/  {
/*0008*/      DDRB  |=   _BV(0)|_BV(1)|_BV(2)|_BV(3);
/*0009*/      PORTB &= ~(_BV(0)|_BV(1)|_BV(2)|_BV(3));
/*0010*/      TMR_TicksInit();
/*0011*/  
/*0012*/      sei();
/*0013*/  
/*0014*/      while (1)
/*0015*/      {
/*0016*/        
/*0017*/        TMR_Delay(&Timer1,VE_TICKS_PER_SEC);
/*0018*/        PORTB^=_BV(0);
/*0019*/      }
/*0020*/  
/*0021*/  }
/*0022*/  
/*0023*/  SIGNAL(TIMER1_COMPA_vect)
/*0024*/  {
/*0025*/      TMR_TicksHandler();            //系统节拍
/*0026*/  }

出0入0汤圆

发表于 2009-9-18 18:58:55 | 显示全部楼层
Mark

出0入0汤圆

发表于 2009-9-22 22:50:47 | 显示全部楼层
Mark

出0入0汤圆

发表于 2009-9-23 21:03:01 | 显示全部楼层
good mark

出0入8汤圆

发表于 2009-9-24 22:28:57 | 显示全部楼层
mark

出0入0汤圆

发表于 2009-9-25 10:45:37 | 显示全部楼层
mark。。。。

出0入0汤圆

发表于 2009-9-25 11:07:58 | 显示全部楼层
不错 好东西

出0入0汤圆

发表于 2009-9-25 11:29:39 | 显示全部楼层
不错,好多论坛一贴代码缩进都没有了,代码完全没法看,有这个就不怕了 :)

出330入0汤圆

发表于 2009-9-25 11:32:55 | 显示全部楼层
很好,很酷。
所以  嵌入到19楼。

出0入0汤圆

发表于 2009-9-25 11:40:38 | 显示全部楼层
爽啊,感谢楼主,试试看

/*0001*/  
/*0002*/  byte KeyLED_SCAN(void)
/*0003*/  {
/*0004*/      static byte keycon;
/*0005*/  
/*0006*/      SETROW1();
/*0007*/      SETROW2();
/*0008*/      SETROW3();
/*0009*/      SETROW4();
/*0010*/      CLRLCOL1();
/*0011*/      CLRLCOL2();
/*0012*/      CLRLCOL3();
/*0013*/      CLRLCOL4();
/*0014*/      CLRLCOL5();
/*0015*/  
/*0016*/      if (++KeyRowIndex > 3)        KeyRowIndex = 0;
/*0017*/  
/*0018*/      switch (KeyRowIndex)
/*0019*/      {
/*0020*/      case 0:
/*0021*/          if (powerupFlag)
/*0022*/          {
/*0023*/              SETLCOL5();         //L1
/*0024*/          }
/*0025*/  
/*0026*/          if (xxFlag)
/*0027*/          {
/*0028*/              SETLCOL3();                //L3
/*0029*/          }
/*0030*/          if (xxFlag)
/*0031*/          {
/*0032*/              SETLCOL4();                //L5
/*0033*/          }
/*0034*/  
/*0035*/          if (xxFlag)                //L10
/*0036*/          {
/*0037*/              SETLCOL1();
/*0038*/          }
/*0039*/          CLRROW1();
/*0040*/  
/*0041*/          keyflag0 = 0;
/*0042*/          if (!RDCOL1() )        return 1;
/*0043*/          if (!RDCOL2() )        return 2;
/*0044*/          if (!RDCOL3() )        return 7;
/*0045*/          keyflag0 = 1;
/*0046*/          break;
/*0047*/      case 1:
/*0048*/          if (xxFlag)                        SETLCOL5();         //L2  
/*0049*/          if (xxFlag)                        SETLCOL1();                //L12
/*0050*/          if (xxFlag)                                        //L4  
/*0051*/          {
/*0052*/                      SETLCOL3();
/*0053*/  
/*0054*/          }
/*0055*/  
/*0056*/          if (xxFlag)                                        //L6  
/*0057*/          {
/*0058*/  
/*0059*/                      SETLCOL2();
/*0060*/          }
/*0061*/  
/*0062*/          if (xxFlag)
/*0063*/          {
/*0064*/                             //L15   
/*0065*/                  SETLCOL4();
/*0066*/          }
/*0067*/          CLRROW2();
/*0068*/  
/*0069*/          keyflag1 = 0;
/*0070*/          if (!RDCOL1() )        return 3;
/*0071*/          if (!RDCOL2() )        return 4;
/*0072*/          if (!RDCOL3() )        return 8;
/*0073*/          keyflag1 = 1;
/*0074*/          break;
/*0075*/      case 2:
/*0076*/  
/*0077*/          if (xxFlag)
/*0078*/          {
/*0079*/              SETLCOL1();                                                //L11   
/*0080*/          }
/*0081*/  
/*0082*/          if (xxFlag)                                                //L16         
/*0083*/          {
/*0084*/  
/*0085*/                  SETLCOL3();
/*0086*/          }
/*0087*/  
/*0088*/          if (xxFlag)
/*0089*/          {
/*0090*/                                   //L13   
/*0091*/                  SETLCOL2();
/*0092*/          }
/*0093*/  
/*0094*/          if (xxFlag)
/*0095*/          {
/*0096*/                          //L8       
/*0097*/                  SETLCOL5();
/*0098*/          }
/*0099*/          CLRROW3();
/*0100*/  
/*0101*/          keyflag2 = 0;
/*0102*/          if (!RDCOL1() )        return 5;
/*0103*/          if (!RDCOL2() )        return 6;
/*0104*/          if (!RDCOL3() )        return 11;
/*0105*/          keyflag2 = 1;
/*0106*/  
/*0107*/          break;
/*0108*/      case 3:
/*0109*/  
/*0110*/          if (xxFlag)
/*0111*/          {
/*0112*/              if (VibLevel == 1)                                //L17         
/*0113*/                  SETLCOL2();
/*0114*/              if (VibLevel == 2)                                //L18         
/*0115*/                  SETLCOL4();
/*0116*/          }
/*0117*/          if (xxFlag)
/*0118*/          {
/*0119*/                                    //L14   
/*0120*/                  SETLCOL1();
/*0121*/          }
/*0122*/  
/*0123*/          if (xxFlag)
/*0124*/          {
/*0125*/              if (xxFlag)                                //L9       
/*0126*/                  SETLCOL5();
/*0127*/  
/*0128*/          }
/*0129*/          CLRROW4();
/*0130*/  
/*0131*/          keyflag3 = 0;
/*0132*/          if (!RDCOL1() )        return 9;
/*0133*/          if (!RDCOL2() )        return 10;
/*0134*/          if (!RDCOL3() )        return 12;
/*0135*/          keyflag3 = 1;
/*0136*/  
/*0137*/          break;
/*0138*/      default:
/*0139*/          break;
/*0140*/      }
/*0141*/  
/*0142*/      if (!keybit&&keyflag0&&keyflag1&&keyflag2&&keyflag3)
/*0143*/      {
/*0144*/          if (++keycon > 7)
/*0145*/          {
/*0146*/              keybit = 1;
/*0147*/              keycon = 0;
/*0148*/          }
/*0149*/  
/*0150*/      }
/*0151*/      return 0;
/*0152*/  }

出0入0汤圆

发表于 2009-9-25 14:45:43 | 显示全部楼层
试试,原是代码:

// get time
UINT32 GetMillisecond()
{
        UINT32 ret;
        LARGE_INTEGER liFrequency;
        if ( QueryPerformanceFrequency(&liFrequency) )
        {
                LARGE_INTEGER liCounter;
                QueryPerformanceCounter(&liCounter);
                ret = (UINT32)((1000 * liCounter.QuadPart) / liFrequency.QuadPart);
        }
        else
        {
                ret = GetTickCount();
        }
        return ret;
}

出0入0汤圆

发表于 2009-9-25 14:46:10 | 显示全部楼层
转换后的代码:

// get time
UINT32 GetMillisecond()
{
        UINT32 ret;
        LARGE_INTEGER liFrequency;
        if ( QueryPerformanceFrequency(&liFrequency) )
        {
                LARGE_INTEGER liCounter;
                QueryPerformanceCounter(&liCounter);
                ret = (UINT32)((1000 * liCounter.QuadPart) / liFrequency.QuadPart);
        }
        else
        {
                ret = GetTickCount();
        }
        return ret;
}

出0入0汤圆

发表于 2009-9-25 14:46:47 | 显示全部楼层
转换,加行号的代码:

/*0001*/  // get time
/*0002*/  UINT32 GetMillisecond()
/*0003*/  {
/*0004*/          UINT32 ret;
/*0005*/          LARGE_INTEGER liFrequency;
/*0006*/          if ( QueryPerformanceFrequency(&liFrequency) )
/*0007*/          {
/*0008*/                  LARGE_INTEGER liCounter;
/*0009*/                  QueryPerformanceCounter(&liCounter);
/*0010*/                  ret = (UINT32)((1000 * liCounter.QuadPart) / liFrequency.QuadPart);
/*0011*/          }
/*0012*/          else
/*0013*/          {
/*0014*/                  ret = GetTickCount();
/*0015*/          }
/*0016*/          return ret;
/*0017*/  }

出0入0汤圆

发表于 2009-9-25 14:47:36 | 显示全部楼层
楼主,我用tab键缩进显示不正确!

出0入0汤圆

 楼主| 发表于 2009-9-25 18:58:30 | 显示全部楼层
【24楼】 hugeice 戬峰
积分:11
派别:
等级:------
来自:麻城
楼主,我用tab键缩进显示不正确!
-----------------------------
嗯,很多地方Tab表示的位置都不一样,有的地方根本就不支持Tab
而基本上写程序的人都会将Tab缩进改成空格缩进,一些编辑器也支持将Tab转换成空格
所以在这个小程序中没有实现对Tab的支持

谢谢大家的支持

出0入0汤圆

 楼主| 发表于 2009-9-26 00:27:56 | 显示全部楼层
CodePaint 1.1
新增功能
1. 支持论坛风格选择,可在Ini文件中增加风格
2. 可以选择是否自动复制到剪切板
3. 可以选择是否将Tab换成空格 (网友“hugeice 戬峰”提出的需求)

CodePaint 1.1 源代码
点击此处下载 ourdev_485539.zip(文件大小:120K) (原文件名:UIParser.zip)
CodePaint 可执行程序
点击此处下载 ourdev_485540.zip(文件大小:147K) (原文件名:CodePaint.zip)

由VS2003编译
词法分析部分是由lex编写
文件包中包含lex编译程序"flex.exe"

编译过程
1. 用CFlex.bat调用flex.exe,把Parser.l编译成Parser.cpp
2. 用VS编译工程

功能:
将C/C++中的关键字、字符串、数字以及注释用高亮的方式在论坛中显示出来
可以在代码前面加上行号,方便阅读



(原文件名:UIParse.jpg)

出330入0汤圆

发表于 2009-9-26 08:17:11 | 显示全部楼层
好球

出0入0汤圆

发表于 2009-9-26 15:23:05 | 显示全部楼层
不错

出0入0汤圆

发表于 2009-9-26 20:29:08 | 显示全部楼层
不错,MARK

出0入0汤圆

发表于 2009-10-10 07:59:34 | 显示全部楼层
用VIM打开源码,然后用TOhtml命令就可以输出HTML格式的源码,可以通过改变VIM的颜色方案来改变输出的颜色方案

几乎可以支持所有的语言!!!

出0入0汤圆

发表于 2009-10-10 08:02:48 | 显示全部楼层
好东西, mark

出0入0汤圆

发表于 2009-10-10 08:35:22 | 显示全部楼层
喜欢,本人也爱做小工具

出0入0汤圆

发表于 2009-10-11 12:34:00 | 显示全部楼层
好东西,顶起!

出0入0汤圆

发表于 2009-10-24 07:43:45 | 显示全部楼层
MARK

出0入0汤圆

发表于 2009-11-9 17:29:02 | 显示全部楼层
呃,感覺我這個好用些,網頁版的,支持html和Discuz!代码,顏色、關鍵字可以自己修改!
http://dukedz.blog.163.com/blog/static/3911808820091094551595/edit/

出0入0汤圆

发表于 2010-1-5 12:11:15 | 显示全部楼层
mark

出0入0汤圆

发表于 2010-1-7 18:11:55 | 显示全部楼层
很好用,但是注释中有中文会乱码
/*0001*/  int main(void)
/*0002*/  {
/*0003*/      u16 i;
/*0004*/  
/*0005*/      recv_ptr = 0;
/*0006*/     
/*0007*/      RCC_Configuration();
/*0008*/      GPIO_Configuration();
/*0009*/      NVIC_Configuration();
/*0010*/      DMA_Configuration();
/*0011*/      USART1_Configuration();
/*0012*/     
/*0013*/      printf("\r\nSystem Start...\r\n");
/*0014*/      printf("Initialling SendBuff... \r\n");
/*0015*/      for(i=0;i<SENDBUFF_SIZE;i++)
/*0016*/      {
/*0017*/          SendBuff = i&0xff;
/*0018*/      }
/*0019*/      printf("Initial success!\r\nWaiting for transmission...\r\n");
/*0020*/      //&#161;¤&#161;é?¨&#170;¨¨&#163;¤¨&#186;y?Y¨°??-&#161;&#193;?&#161;&#192;?o?&#161;ê?&#161;&#227;&#161;&#228;??&#161;&#227;&#161;&#228;?¨&#185;?&#161;&#228;?a¨&#186;?&#161;&#228;?¨&#186;?
/*0021*/      while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_3));//KEY2
/*0022*/     
/*0023*/      printf("Start DMA transmission!\r\n");
/*0024*/     
/*0025*/      //?a¨¤?¨&#186;??a¨&#186;?DMA&#161;&#228;?¨&#186;??&#161;&#227;&#166;&#204;?¨°?D?&#161;&#193;?&#161;&#192;?1&#161;è&#161;&#193;&#161;&#194;&#161;ê???USART1?&#161;ê?¨&#166;¨&#166;¨¨??3¨&#166;DMA&#161;¤?¨&#186;?1&#161;è&#161;&#193;&#161;&#194;
/*0026*/      USART_DMACmd(USART1, USART_DMAReq_Tx, ENABLE);
/*0027*/      //?a¨&#186;?¨°?&#161;&#228;?DMA&#161;&#228;?¨&#186;?&#161;ê?
/*0028*/      DMA_Cmd(DMA1_Channel4, ENABLE);
/*0029*/     
/*0030*/      //&#166;&#204;¨¨&#161;&#228;yDMA&#161;&#228;?¨&#186;?¨&#170;¨&#186;3¨&#166;&#161;ê?&#161;&#228;?¨&#186;&#161;&#192;?¨°??¨¤&#161;&#228;&#161;&#193;?¨&#162;¨&#170;¨&#170;a¨°?D?¨&#186;?&#161;ê?&#166;&#204;?&#166;&#204;?
/*0031*/      //¨&#186;&#166;&#204;?¨&#186;¨&#174;|¨&#174;??D&#161;ê?&#161;&#228;?¨&#186;?¨&#186;y?Y?¨&#178;??&#161;ê??¨&#166;¨°??&#161;&#228;DD¨&#162;¨&#170;¨&#170;a&#166;&#204;?¨¨???
/*0032*/      #if 0
/*0033*/    while(DMA_GetFlagStatus(DMA1_FLAG_TC4) == RESET)
/*0034*/      {
/*0035*/          GPIOC->ODR ^= (1<<7);      //LED1&#161;¤-&#161;&#193;a
/*0036*/          Delay();        //¨¤?&#161;¤?¨&#186;&#161;&#192;??
/*0037*/      }
/*0038*/    #else
/*0039*/    while(DMA_GetFlagStatus(DMA1_FLAG_TC4) == RESET)
/*0040*/    {
/*0041*/      DMA_ClearITPendingBit(DMA1_IT_TC4);
/*0042*/      dma_count++;
/*0043*/    }
/*0044*/      #endif
/*0045*/     
/*0046*/      //DMA&#161;&#228;?¨&#186;??¨&#162;¨&#186;?o¨&#174;&#161;ê?&#161;&#193;??&#161;&#165;1?&#161;&#192;?¨&#162;?DMA¨&#170;&#161;§&#166;&#204;¨¤&#161;ê????TD¨¨¨&#186;??&#161;&#165;1?&#161;&#192;?
/*0047*/      //????&#166;&#204;?¨&#174;???&#161;&#192;?&#161;&#193;&#161;é¨&#186;¨&#170;
/*0048*/      //DMA_Cmd(DMA1_Channel4, DISABLE);
/*0049*/     
/*0050*/      printf("\r\nDMA transmission successful!\r\n");
/*0051*/      printf("\r\ndma_count=%d!\r\n",dma_count);
/*0052*/    printf("\r\nusart_count=%d!\r\n",usart_count);
/*0053*/  
/*0054*/     
/*0055*/      /* Infinite loop */
/*0056*/      while (1)
/*0057*/      {
/*0058*/      }
/*0059*/  }
/*0060*/  

出0入0汤圆

发表于 2010-1-31 13:34:53 | 显示全部楼层
我也试一下
/*0001*/  void    cpSetCodeColor(const string& formatName, const string& colorName, BOOL bNeedTrack)
/*0002*/  {
/*0003*/      cpColorFormat_t::iterator it = cpColorFormat.find(formatName);
/*0004*/      if(it == cpColorFormat.end()){
/*0005*/          return;
/*0006*/      }
/*0007*/      cpColorMap_t::iterator it1 = cpColorMap.find(colorName);
/*0008*/      if(it1 == cpColorMap.end()){
/*0009*/          return;
/*0010*/      }
/*0011*/      COLORREF ref = RGB(
/*0012*/          GetBValue(it1->second),
/*0013*/          GetGValue(it1->second),
/*0014*/          GetRValue(it1->second)
/*0015*/          );
/*0016*/      char buf[1024] = "";
/*0017*/      sprintf(buf,it->second.set.c_str(),ref);
/*0018*/      OutputString(buf,0);
/*0019*/      if(bNeedTrack){
/*0020*/          cpCodeColor cpColor;
/*0021*/          cpColor.color = it1->second;
/*0022*/          cpColor.start = curPos;
/*0023*/          cpPosStack.push_back(cpColor);
/*0024*/      }
/*0025*/  }
/*0026*/  
/*0027*/  
/*0028*/  void StringLog(const char* str);
/*0029*/  /**
<font color=#646400>|*0030*|  
  reset code color
|*0031*|   */</font>
/*0032*/  void    cpResetCodeColor(const string& formatName, BOOL bNeedTrack)
/*0033*/  {
/*0034*/      cpColorFormat_t::iterator it = cpColorFormat.find(formatName);
/*0035*/      if(it == cpColorFormat.end()){
/*0036*/          return;
/*0037*/      }
/*0038*/      char buf[1024] = "";
/*0039*/      sprintf(buf,it->second.reset.c_str());
/*0040*/      OutputString(buf,0);
/*0041*/      if(bNeedTrack && cpPosStack.size()){
/*0042*/          vector<cpCodeColor>::iterator it1 = cpPosStack.begin();
/*0043*/          it1 += (cpPosStack.size() - 1);
/*0044*/          if(it1 != cpPosStack.end()){
/*0045*/              it1->end = curPos;
/*0046*/              if(0){
/*0047*/                  char buf[1024] = "";
/*0048*/                  sprintf(buf,"Color: 0x%06X, Start: %d, End: %d",
/*0049*/                      it1->color,it1->start, it1->end);
/*0050*/                  StringLog(buf);
/*0051*/              }
/*0052*/              cpColorStack.push_back(*it1);
/*0053*/              cpPosStack.erase(it1);
/*0054*/          }
/*0055*/      }
/*0056*/  }

出0入0汤圆

发表于 2010-2-27 00:24:54 | 显示全部楼层
MARK 代码工具

出0入0汤圆

发表于 2010-2-27 00:33:10 | 显示全部楼层
不错

出0入0汤圆

发表于 2010-6-11 14:03:23 | 显示全部楼层
测试一下
    void putch(u8 c)
    {
        if(c=='\n')
        {
            USART_SendData(USART1, 0x0D);
            while(!USART_GetITStatus(USART1, USART_IT_TXE)); //将要改这里
            USART_SendData(USART1, 0x0A);
            while(!USART_GetITStatus(USART1, USART_IT_TXE));
        }
        else
        {
            USART_SendData(USART1, (unsigned char)c);
            while(!USART_GetITStatus(USART1, USART_IT_TXE));
        }
    }//end of void putch(u8 c)

<font size=5><font color="blue">测试字色和字体
</font>

出0入0汤圆

发表于 2010-6-11 21:01:30 | 显示全部楼层
static int srcRemain = 0;   //< remain characters for the source text
static int srcLength = 0;   //< length of the source text
static char* lpSrc = NULL;  //< source buffer pointer
/* lex parser function */
int     yylex(void);
void    ParseStart(void);
CComboBox* pLog = NULL;     //< combo box pointer used for log data
string  result;             //< result generate by the parser
BOOL    bNeedLineNumber;    //< Flag used for output line number
char*   lnFormatComment;    //< line number format for block comment
char*   lnFormatNormal;     //< line number format for normal code
char*   currentFormat;      //< current format style, e.g. "ouravr"
int     curPos;             <font color=#008000>//< current source character position

出0入0汤圆

发表于 2010-11-1 22:40:39 | 显示全部楼层
好东西啊,谢谢楼主

出0入0汤圆

发表于 2011-10-12 14:23:08 | 显示全部楼层
好工具 谢谢了
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-18 17:54

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表