• <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

            最近在為文檔的書寫苦惱,本來想自己寫一個文檔解析程序,名字都想好了。后來竟然在找資料的過程中發現了一個很好的C/C++ java文檔生成器Doxygen,真是無心插柳柳成行,我的原則是不要重復發明車輪,所以就是用這個開源的項目。給大家一些學習的鏈接看看,很容易入門的。
            http://www.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語言寫得一個函數

            /* *
            *@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文檔如下:

            函數文檔

            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

            參數:
            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 天下無雙 閱讀(2870) 評論(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轉化為gb2312,然后運行doxygen就可以了。如果有多個文件,可能需要寫一個腳本來執行這些機械的人物,不過都應該很簡單。  回復  更多評論
              
            # re: Doxygen-C/C++ java文檔生成器入門心得
            2007-08-17 10:52 | 天下無雙
            下面是我為一個工程寫的轉化utf-8到GB2312的BASH腳本(由于是C語言,只針對.h .c文件進行轉化:
            #!/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

            搜索

            •  

            積分與排名

            • 積分 - 205775
            • 排名 - 130

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品久久久久久影院| 色偷偷久久一区二区三区| 成人精品一区二区久久久| 一本大道久久a久久精品综合| 综合久久精品色| 亚洲午夜久久影院| 日韩AV毛片精品久久久| 人人狠狠综合久久亚洲88| 久久精品国产亚洲av影院| 久久久SS麻豆欧美国产日韩| 88久久精品无码一区二区毛片| 久久青青国产| 久久中文字幕无码专区| 午夜精品久久久久久毛片| 亚洲va久久久噜噜噜久久男同 | 久久无码人妻一区二区三区 | 亚洲精品白浆高清久久久久久 | 99久久婷婷国产一区二区| 国内精品久久久久影院薰衣草 | 婷婷久久精品国产| 精品国产一区二区三区久久| 久久久精品2019免费观看| 三级片免费观看久久| 欧美亚洲国产精品久久蜜芽| 日产精品久久久久久久性色| 久久99精品久久久久久水蜜桃| 久久九九全国免费| 亚洲AV无码久久寂寞少妇| 久久久无码精品亚洲日韩蜜臀浪潮| 伊人久久综合热线大杳蕉下载| 91精品国产9l久久久久| 午夜精品久久久久久久| 久久精品久久久久观看99水蜜桃| 日本加勒比久久精品| 久久精品国产亚洲一区二区三区| 青青久久精品国产免费看| 久久国产精品免费一区二区三区| 国产精品日韩欧美久久综合| 91久久精品电影| 日本加勒比久久精品| 久久受www免费人成_看片中文|