
ES2 mudlib - FF extension v0.6c 函式說明書

程式: /adm/daemons/chinesed.c

	此物件使用 dict 映射變數儲存內部的中英對照表. 
	dict 變數的格式: ([ "英文" : "中文" ])

	目前 /cmds/arch/chinese.c 可以處理 dict 變數.

string chinese_year ( int i )

	依序讀出中文數字, 例如 i = 1234, 會傳回「一二三四」.

string chinese_number( int num )

	按照中文習慣讀出完整的數值. 例如 num = 1234, 會傳回「一千二百
	三十四」.

string chinese(string str)

	檢索 dict 變數, 傳回 str 的中文翻譯.

void remove_translate( string key )

	刪除 dict 裡面關鍵字為 key 的一組值.

void add_translate( string key, string chinz )

	在 dict 裡面加上一組中英對照值.

void dump_translate()

	把 dict 的值傾印到 /CHINESE_DUMP

varargs string chinese_date( int date, int real_time )

	以 date 的整數值印出中文時間, 如果 real_time 不為零, 年代改為
	mud 中的年代. date 的意義是從 1970 年一月一日零時起算的秒數.

string chinese_period( int t )

	以 t 整數值印出中文的時間值, t 為從 0 開始起算的秒數.

string ansi_color( string str )

	將 $RED$, $GRN$...等等的字串, 換成對應的 ANSI 控制碼. 因為禁止
	輸入 ANSI 碼所用的 ASCII 27 值 ESC 字元, 才會有這種功能.

int ansi_count( string str )

	計算一個字串內有多少字元是 ANSI 控制碼, 由下面的 ansi_display() 
	呼叫.

string ansi_display( string str, int length )

	以 sprintf("%10s, %10s\n", str1, str2 ); 為例, 如果 str1 內含 ANSI
	控制碼, 雖然螢幕上看不到 (被 terminal emulation 吃了) 控制碼, 
	卻會把 str2 往左拉過去, 預定的輸出格式常被打亂.

	此函式用 ansi_count() 計算 str 會造成多少偏移, 在字串後面補滿
	空白字元. 以上面的例子來看, 可以寫成:

	sprintf("%10s, %10s\n", CHINESE_D->ansi_display( str1, 10 ), str2 ); 
	
 	至於 str2 右邊並沒有字串, 就不用管了.

Spock of The Final Frontier	98.Sep.18.
