[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Umm-AlQura + Hijri code



Now that prayertime command-line application is mostly done (sans the
man page or any changes to the underlying lib by Thamer and others),
I've started to look into the hijri code/lib that has been recently
uploaded to Arabeyes' CVS and am rather perplexed.  I can't say that
I follow the code and/or think that its well structured (compared to
say how 'hdate' is written among others).  I also don't have a clue
to how Umm-AlQura is calculated which I'm sure is making things more
cryptic for me.

  http://cvs.arabeyes.org/viewcvs/projects/itl/libs/hijridata/hijri.cpp

A couple of key concerns with the hijri code as it stands now (and
I do hope that Roozbeh will kick start the other full-fledged Hijri
implementation based on the algorithms in the book by Reingold and
Dershowitz soon).

For more info on what I'm talking about please look at,

  http://lists.arabeyes.org/archives/developer/2003/December/msg00050.html

Some constructive criticism (just trying to help and point out the
obvious - please don't take it the wrong way !!), the 'hijri.cpp'
file on CVS has the following issues,

  + It only calculates Hijri date based on 'Umm-AlQura calendar'
    (the Saudi's official calander); compared to 'hdate' this is
    very limiting.

    As such this file should really be renamed from 'hijri.cpp'
    to 'umm_alqura.cpp', no ?

  + It only works for hijri dates between 1420 - 1450 (note,
    "HStartYear" and "HEndYear"), I'm assuming in both directions.
    This is way too restrictive, no ?

  + The three functions (sorry if I'm being dense),
    - G2HA	(Gregorian/Meladi -> Hijri)
    - H2GA	(Hijri            -> Gregorian/Meladi)
    - BH2GA	(is this a copy of H2GA with checks ?)

    Ideally we just need 2 API calls 'gdate' (for hijri->gregorian)
    and 'hdate' (for gregorian->hijri) and some flags for options.

  + The code as it stands now should do more rigorous checking
    and error reporting when one enters dates outside its allowed
    realm.  Using G2HA and the following dates, "22 12 210"
    (ie. dec 12, 210 - yup year = 210) or "22 12 5210", the code
    coredumps on the first and hangs on the second.

  + The code is not well commented and the variable names are a
    bit difficult to follow (A, B, C, D, Z, etc), do please code
    so that you can understand this code a year from now without
    any supplementary notes.

I would really have hoped for us to get something as good (if not
better) than 'hdate' and we should compare our results to its as
validation every step of the way.

My hope is that once Roozbeh gets us moving (no pressure :-), we can
add a flag to the upcoming code to do an 'umm-alqura' option since
it seems like a subset of the calculations (it seems more of a static
nature to me since hard-coded arrays are used).  We should also have
a robust converter that should work for dates before the Hijrah and
well into the future.  In other words, we should be able to convert
Dec 12, 210 to its equivalent B.H (before Hijrah) as well as dates
in say 5210 :-)

BTW: it's well established that B.H means "Before Hijrah" where-as
     A.H stands for "After Hijrah" (just in case).

Here are some links I thought were useful (I haven't gone through
all of 'em either),

  Old sample code (doesn't do B.H though):
    http://emr.cs.uiuc.edu/~reingold/calendar.C

  Online Converters:
    http://www.rabiah.com/convert/convert.php3
    http://www.ori.unizh.ch/hegira.html
    http://prayer.al-islam.com/convert.asp?l=eng
    http://bennyhills.fortunecity.com/elfman/454/calindex.html#TOP

  Background info:
    http://www.math.nus.edu.sg/aslaksen/calendar/links.shtml#Islamic
    http://www.phys.uu.nl/~vgent/islam/mecca/ummalqura.htm

Comments/thoughts ?

Salam.

 - Nadim


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree