• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 45,  comments - 232,  trackbacks - 0

            最近在為文檔的書寫苦惱,本來想自己寫一個文檔解析程序,名字都想好了。后來竟然在找資料的過程中發(fā)現(xiàn)了一個很好的C/C++ java文檔生成器Doxygen,真是無心插柳柳成行,我的原則是不要重復發(fā)明車輪,所以就是用這個開源的項目。給大家一些學習的鏈接看看,很容易入門的。
            http://m.shnenglu.com/richardzeng/archive/2006/03/23/4508.html
            http://www.chinaitpower.com/A/2003-01-19/47536.html
            如果你要看全面的介紹文檔,可以在它的主頁去看:http://www.stack.nl/~dimitri/doxygen/,不過都是英文的。
            問題:我的一個C文檔的注釋在Eclipse里面是中文寫的,所以編碼格式為utf-8。無論我Doxygen改成english或者chinese都沒有辦法正確顯示。我查看了生成的html的編碼竟然不是utf-8編碼,我想解決的辦法就是要自己來定義生成的html文檔。
            高興,Show我生成的文檔。下面是C語言寫得一個函數(shù)

            /* *
            *@brief?read?string?in?initialization?file
            *
            *retrieves?a?string?from?the?specified?section?in?an?initialization?file
            *@param?section?[name?of?the?section?containing?the?key?name]
            *@param?key?[name?of?the?section?containing?the?key?name]
            *@param?value?[pointer?to?the?buffer?that?receives?the?retrieved?string]
            *@param?size?[size?of?value?buffer]
            *@param?file?[name?of?the?initialization?file]
            *@return?[1?:?read?success;?0?:?read?fail]
            */
            int ?read_profile_string(? const ? char ? * section,? const ? char ? * key, char ? * value,?? int ?size,? const ? char ? * file)
            {
            ????
            char ?buf[MAX_FILE_SIZE] = { 0 };
            ????
            int ?file_size;
            ????
            int ?sec_s,sec_e,key_s,key_e,?value_s,?value_e;

            ????
            // check?parameters
            ????assert(section? != ?NULL? && ?strlen(section));
            ????assert(key?
            != ?NULL? && ?strlen(key));
            ????assert(value?
            != ?NULL);
            ????assert(size?
            > ? 0 );
            ????assert(file?
            != NULL? && strlen(key));

            ????
            if (? ! load_ini_file(file,buf, & file_size))
            ????????
            return ? 0 ;

            ????
            if ( ! parse_file(section,key,buf, & sec_s, & sec_e, & key_s, & key_e, & value_s, & value_e))
            ????{
            ????????
            return ? 0 ;? // not?find?the?key
            ????}
            ????
            else
            ????{
            ????????
            int ?cpcount? = ?value_e? - value_s;

            ????????
            if (?size - 1 ? < ?cpcount)
            ????????{
            ????????????cpcount?
            = ??size - 1 ;
            ????????}
            ????
            ????????memset(value,?
            0 ,?size);
            ????????memcpy(value,buf
            + value_s,?cpcount?);
            ????????value[cpcount]?
            = ? ' \0 ' ;

            ????????
            return ? 1 ;
            ????}
            }

            生成的HTML文檔如下:

            函數(shù)文檔

            int read_profile_string (const char *?section,
            const char *?key,
            char *?value,
            int?size,
            const char *?file?
            )

            read string in initialization file

            retrieves a string from the specified section in an initialization file

            參數(shù):
            section?[name of the section containing the key name]
            key?[name of the section containing the key name]
            value?[pointer to the buffer that receives the retrieved string]
            size?[size of value buffer]
            file?[name of the initialization file]
            返回:
            [1 : read success; 0 : read fail]
            posted on 2007-01-16 13:41 天下無雙 閱讀(2875) 評論(4)  編輯 收藏 引用 所屬分類: C/C++

            FeedBack:
            # 找到一個解決utf-8的方法
            2007-01-16 16:22 | 天下無雙

            > Hi,
            > does doxygen support unicode comments? If so, are there any options I
            > should enable to get this working?

            By default iso-8859-1 is used. It depends on what encoding you are
            using. It seems like if you encode as UTF-8 things works nice. Note
            that the MS-world often use the word unicode to mean unicode
            encoded as UCS-2 or UTF-16. Both of these encodings have deficiencies;
            UCS-2 does not cover all unicode code-points, UTF-16 is not
            endianess-neutral. UTF-8 does not have any of these problems.

            To make it work, you have to supply your own HTML_HEADER that creates
            HTML tag like this
            <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

            Feature Request:
            It would be nice if the encoding could be supplied as a paremter, so
            you don't have to supply your own header just to change encoding.

            Jarl

              回復  更多評論
              
            # re: Doxygen-C/C++ java文檔生成器入門心得
            # re: Doxygen-C/C++ java文檔生成器入門心得
            2007-08-16 17:29 | 天下無雙
            關于源文件是utf-8的問題我找到了解決的辦法。通過doxywizard 把文檔的語言配置成中文,然后把utf-8的源文件通過iconv轉(zhuǎn)化為gb2312,然后運行doxygen就可以了。如果有多個文件,可能需要寫一個腳本來執(zhí)行這些機械的人物,不過都應該很簡單。  回復  更多評論
              
            # re: Doxygen-C/C++ java文檔生成器入門心得
            2007-08-17 10:52 | 天下無雙
            下面是我為一個工程寫的轉(zhuǎn)化utf-8到GB2312的BASH腳本(由于是C語言,只針對.h .c文件進行轉(zhuǎn)化:
            #!/bin/bash
            #(C)2007 GEC written by Deng Yangjun
            DOXY_DIR="doxygen/"

            echo "convert *.h *.c form UTF-8 to GB2312"
            for f in *.[hc]
            do
            echo $f" -> "$DOXY_DIR$f
            iconv -s -f utf-8 -t gb2312 $f > $DOXY_DIR$f
            done
            cd $DOXY_DIR
            echo "build doxygen..."
            doxygen 1>/dev/null
            echo "OK"  回復  更多評論
              

            常用鏈接

            留言簿(15)

            隨筆分類

            隨筆檔案

            相冊

            我的其它領域Blog

            搜索

            •  

            積分與排名

            • 積分 - 206373
            • 排名 - 130

            最新評論

            閱讀排行榜

            評論排行榜

            精品久久久久久国产91| 欧美日韩中文字幕久久伊人| 伊人色综合久久天天人守人婷| 久久久WWW免费人成精品| 久久国产精品无| 久久久国产乱子伦精品作者| 久久九九亚洲精品| 亚洲精品97久久中文字幕无码| 无码专区久久综合久中文字幕| 亚洲国产精品久久久久婷婷老年| 久久中文字幕无码专区| 99久久er这里只有精品18| 欧美激情精品久久久久久| 69SEX久久精品国产麻豆| 久久国产综合精品五月天| 久久久久久毛片免费播放| 久久久久人妻一区精品果冻| 国产精品久久久亚洲| 久久久久亚洲av综合波多野结衣| 久久99精品国产麻豆宅宅| 精品久久久无码人妻中文字幕| 久久国产高清字幕中文| 一本一道久久综合狠狠老| 欧美精品丝袜久久久中文字幕| www.久久99| 国产成人久久激情91| 无码人妻少妇久久中文字幕蜜桃 | 久久精品这里热有精品| 伊人久久综合无码成人网 | 91精品国产高清久久久久久io| 一本大道久久东京热无码AV| 久久婷婷综合中文字幕| 国产精品一久久香蕉国产线看| 国色天香久久久久久久小说| 一本久久综合亚洲鲁鲁五月天| 九九久久精品国产| 久久久久噜噜噜亚洲熟女综合| 久久艹国产| 99久久做夜夜爱天天做精品| 亚洲欧美日韩精品久久亚洲区 | 久久这里只精品国产99热|