X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fword.c;h=64e9f55607aba5dae75ca5614287c180dc6f4a6b;hp=34a39463263b4dabd319d2a89183daee2598e9e3;hb=ae04e48ee62a95f6f77794d5611db189a19e70de;hpb=019b584feedf0402e473fba3e0e7752db78e616a diff --git a/src/word.c b/src/word.c index 34a3946..64e9f55 100644 --- a/src/word.c +++ b/src/word.c @@ -8,25 +8,32 @@ #include "cerr.h" /** - * wordのエラー定義 + * @brief 10進数値を表す文字列をWORD値に変換する + * + * @return WORD値 + * + * @param *str 10進数値を表す文字列 */ -static CERR cerr_word[] = { - { 114, "not integer" }, - { 115, "not hex" }, - { 116, "out of hex range" }, -}; +WORD n2word(const char *str); /** - * wordのエラーをエラーリストに追加 + * @brief 16進数の文字列をWORD値に変換する + * + * @return WORD値 + * + * @param *str 16進数値を表す文字列 */ -void addcerrlist_word() -{ - addcerrlist(ARRAYSIZE(cerr_word), cerr_word); -} +WORD h2word(const char *str); /** - * 10進数の文字列をWORD値に変換 + * @brief wordのエラー定義 */ +static CERR cerr_word[] = { + { 114, "not integer" }, + { 115, "not hex" }, + { 116, "out of hex range" }, +}; + WORD n2word(const char *str) { assert(isdigit(*str) || *str == '-'); @@ -46,9 +53,6 @@ WORD n2word(const char *str) return (WORD)n; } -/** - * 16進数の文字列をWORD値に変換 - */ WORD h2word(const char *str) { assert(*str == '#'); @@ -69,9 +73,12 @@ WORD h2word(const char *str) return w; } -/** - * 10進数または16進数の文字列をWORD値に変換 - */ +/* word.hで定義された関数群 */ +void addcerrlist_word() +{ + addcerrlist(ARRAYSIZE(cerr_word), cerr_word); +} + WORD nh2word(const char *str) { WORD w; @@ -89,9 +96,6 @@ WORD nh2word(const char *str) return w; } -/** - * WORD値を10進数の文字列に変換 - */ char *word2n(WORD word) { enum { @@ -111,9 +115,6 @@ char *word2n(WORD word) return digit; } -/** - * WORD値を2進数の文字列に変換 - */ char *word2bit(const WORD word) { enum { @@ -130,9 +131,6 @@ char *word2bit(const WORD word) return bit; } -/** - * WORD値を解析して表示 - */ void print_dumpword(WORD word, bool logicalmode) { char *b; @@ -151,6 +149,5 @@ void print_dumpword(WORD word, bool logicalmode) } else if(word == '\t') { fprintf(stdout, " = \'\\t\'"); } - fprintf(stdout, "\n"); FREE(b); }