• <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://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語言寫得一個函數

            /* *
            *@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 天下無雙 閱讀(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轉化為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

            搜索

            •  

            積分與排名

            • 積分 - 206334
            • 排名 - 130

            最新評論

            閱讀排行榜

            評論排行榜

            91精品国产高清久久久久久io| 精品熟女少妇AV免费久久| 四虎国产精品成人免费久久| 久久婷婷五月综合色奶水99啪| 无夜精品久久久久久| 久久精品国产亚洲AV无码偷窥| 欧美久久天天综合香蕉伊| 中文字幕无码久久久| 久久精品男人影院| 久久婷婷激情综合色综合俺也去 | 久久国产成人午夜aⅴ影院| 久久久久香蕉视频| 国产L精品国产亚洲区久久| 久久中文骚妇内射| 国产精品久久久久一区二区三区 | 人妻无码αv中文字幕久久| 久久久九九有精品国产| 久久精品中文字幕无码绿巨人| 97精品伊人久久久大香线蕉| 99久久免费国产特黄| 久久综合伊人77777| 亚洲国产成人久久精品99 | 国产精品成人99久久久久 | 久久99精品久久久久子伦| 亚洲AV日韩AV永久无码久久| 久久人人添人人爽添人人片牛牛| 成人资源影音先锋久久资源网| 免费精品国产日韩热久久| 亚洲国产天堂久久综合| 97久久精品人人澡人人爽| 77777亚洲午夜久久多喷| 欧美丰满熟妇BBB久久久| 国产精品久久久久久久人人看| 久久99国产一区二区三区| 青青草国产成人久久91网| 国产精品9999久久久久| 久久精品国产亚洲AV嫖农村妇女| 一本色道久久88精品综合 | 国产精品成人99久久久久| 色综合色天天久久婷婷基地| 久久久综合九色合综国产|