(view source code of easter2.kix as plain text)
; Check KiXtart version (4.20 required)
$KixMajorVer = SubStr( @Kix, 1, InStr( @Kix, "." ) - 1 )
$KixMinorVer = SubStr( @Kix, InStr( @Kix, "." ) + 1, 2 )
$KixVer = ( 100 * $KixMajorVer ) + $KixMinorVer
If $KixVer < 420
GoTo Syntax
EndIf
; Use current year if none specified
If $Year = ""
$Year = @YEAR
EndIf
; Is the specified year valid?
; Check if number and if within range
If VarType($Year) = 1 OR VarType($Year) <> 3 OR $Year < 1752 OR $Year > 3000
GoTo Syntax
EndIf
; Calculate Easter Day using the instructions found at
; Simon Kershaw's "KEEPING THE FEAST"
; http://www.oremus.org/liturgy/etc/ktf/app/easter.html
$G = ( $Year Mod 19 ) + 1
$S = (( $Year - 1600 ) / 100 ) - (( $Year - 1600 ) / 400 )
$L = ((( $Year - 1400 ) / 100 ) * 8 ) / 25
$P1 = ( 30003 - 11 * $G + $S - $L ) Mod 30
Select
Case $P1 = 28 AND $G > 11
$P = 28
Case $P1 = 29
$P = 28
Case 1
$P = $P1
EndSelect
$D = ( $Year + ( $Year / 4 ) - ( $Year / 100 ) + ( $Year / 400 )) Mod 7
$D1 = ( 8 - $D ) Mod 7
$P2 = (( 70003 + $P ) Mod 7 )
$X = (( 70004 - $D - $P ) Mod 7 ) + 1
$E = $P + $X
If $E < 11
$ED = $E + 21
$EM = "March"
Else
$ED = $E - 10
$EM = "April"
EndIf
Select
Case $Year < @YEAR
$IS = "was"
Case $Year = @YEAR
$IS = "is"
Case 1
$IS = "will be"
EndSelect
; Display the result
? "In $Year Easter Day $IS $EM $ED"
?
; End of main program
Exit 0
:Syntax
? "Easter.kix, Version 2.00 for KiXtart 4.2*"
? "Calculate the date of Easter Day for the specified year."
?
? "Usage: KIX32 EASTER.KIX [ $$YEAR=year ]"
?
? "Where: year should be within the range of 1752 through 3000"
?
? "Written by Rob van der Woude"
? "http://www.robvanderwoude.com"
?
? "Based on the instructions found at"
? "Simon Kershaw's " + Chr(34) + "KEEPING THE FEAST" + Chr(34)
? "http://www.oremus.org/liturgy/etc/ktf/app/easter.html"
?
? "This script requires KiXtart 4.20 or later."
? "Your KiXtart version is @Kix"
?
Exit 1
page last modified: 2024-04-16; loaded in 0.0080 seconds