全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1730
推到 Plurk!
推到 Facebook!

要如何使用模組?

答題得分者是:william
huangeider
高階會員


發表:288
回覆:492
積分:231
註冊:2003-02-26

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-03-18 15:31:10 IP:210.201.xxx.xxx 未訂閱
請教以下的'模組'是什麼意思? 如何才能得知其模組碼代表什麼意思? 要如何使用? //模組gLanarMonth存放陰曆1901年到2050年閏月的月份,如沒有則為0,每字節存兩年 gLunarMonth:array[0..74] of Byte=( $00, $50, $04, $00, $20, //1910 $60, $05, $00, $20, $70, //1920 $05, $00, $40, $02, $06, //1930 $00, $50, $03, $07, $00, //1940 $60, $04, $00, $20, $70, //1950 $05, $00, $30, $80, $06, //1960 $00, $40, $03, $07, $00, //1970 $50, $04, $08, $00, $60, //1980 $04, $0a, $00, $60, $05, //1990 $00, $30, $80, $05, $00, //2000 $40, $02, $07, $00, $50, //2010 $04, $09, $00, $60, $04, //2020 $00, $20, $60, $05, $00, //2030 $30, $b0, $06, $00, $50, //2040 $02, $07, $00, $50, $03); //2050 aric
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-03-18 15:40:16 IP:147.8.xxx.xxx 未訂閱
gLunarMonth is an array of byte. I GUESS the month is being stored inside a nibble (i.e. 4 bit), e.g. gLunarMonth[1] = $50 => 1913(or 1912?) has a 閏月 at May... Just my wild GUESS  >
huangeider
高階會員


發表:288
回覆:492
積分:231
註冊:2003-02-26

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-03-18 16:07:38 IP:210.201.xxx.xxx 未訂閱
引言: gLunarMonth is an array of byte. I GUESS the month is being stored inside a nibble (i.e. 4 bit), e.g. gLunarMonth[1] = $50 => 1913(or 1912?) has a 閏月 at May... Just my wild GUESS > < face="Verdana, Arial, Helvetica"> 那要用如何使用模組呢? 這個模組要用之前要如何查知代表的意思呢? 是內定的值還是自設的呢? aric
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-03-18 16:37:22 IP:147.8.xxx.xxx 未訂閱
引言:那要用如何使用模組呢? 這個模組要用之前要如何查知代表的意思呢? 是內定的值還是自設的呢? aric
This 模組gLunarMonth is actually a consant array. I think it is implmeneted to be a table lookup. Any documentation for it? It not, guessing from the embedded comments, an example lookup function may looks like:
function GetMonth(Year: integer): integer;
var
    index: integer;
begin
    index := (Year-1901) div 2;
    if (index>=Low(gLunarMonth)) and (index<=High(gLunarMonth)) then begin
        if (Year mod 2)=0 then
            Result := Lo(gLunarMonth[index])
        else
            Result := Hi(gLunarMonth[index]);
        end
    else
        Result := 0;
end;
Result=0 means no 閏月 or year out of range. BTW, please check with the calendar that the correct order of the nibble is being used, otherwise you should swap the Lo() and Hi() function. 發表人 -
huangeider
高階會員


發表:288
回覆:492
積分:231
註冊:2003-02-26

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-03-20 13:14:20 IP:210.201.xxx.xxx 未訂閱
[/quote] actually a consant array是什麼意思我查字典查不到consant這個word? 'hi'和'lo' function 要如何swap? aric
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-03-20 13:27:52 IP:147.8.xxx.xxx 未訂閱
引言: actually a consant array是什麼意思我查字典查不到consant這個word? 'hi'和'lo' function 要如何swap? aric
>>
huangeider
高階會員


發表:288
回覆:492
積分:231
註冊:2003-02-26

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-03-20 13:47:44 IP:210.201.xxx.xxx 未訂閱
引言: $04 and $0F 這是代表什麼意思? 假如$04:=19;$0f:=05; 那可不可以這樣表示 $04 $0f 和$04 and $0f有沒有相等
aric
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-03-20 14:08:27 IP:147.8.xxx.xxx 未訂閱
引言: $04 and $0F 這是代表什麼意思? 假如$04:=19;$0f:=05; 那可不可以這樣表示 $04 $0f 和$04 and $0f有沒有相等 aric
$04 and $0F are hex numbers. ($04 and $0F) -> ($04 & $0F) in C/C .. perform an AND operation on $04 and $0F In the previous post, $04 = gLunarMonth[2] (i.e. data for year 1905/1906).
huangeider
高階會員


發表:288
回覆:492
積分:231
註冊:2003-02-26

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-03-20 14:25:06 IP:210.201.xxx.xxx 未訂閱
引言: >< face="Verdana, Arial, Helvetica"> aric
系統時間:2024-05-08 7:35:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!