-- Last modified: 2008-01-23 package Lois_Script_Pkg is Type Message_Level is (Silent, Conditional, Descriptive); Msg_Level : Message_Level := Silent; -- -- The Set_message_Level procedure sets the "verbosity" of -- messages that will be produced by this package. Three levels -- are available: -- -- Level Meaning -- -- Silent Error messages produced but informative -- messages suppressed -- Conditional Error, warning and important status messages -- produced. -- Descriptive All Conditioinal messages produced plus -- execution trace information -- -- The default message level is "Silent". -- procedure Set_Message_Level (Level : in Message_Level); -- -- The "mod" function inplements a modulo function for floating -- point numbers. That is, for positive arguments, it returns -- the remainder of Arg1/Arg2. -- function "mod" (Arg1 : in Long_Float; Arg2 : in Long_Float) return Long_Float; -- -- The Julian procedure calculates the Julian date for the -- calendar date parameters Year, Month, Day, Hour, Minute, and -- Second (using the obvious abbreviations shown below). The -- Month is specified by its normal index number. -- -- Reminder: The Julian date is a date specified in days. The -- days run consecutively across all calendar boundaries. -- 2000-01-01T12:00:00 corresponds to a Julian date of 2451545.0. -- The Julian date of 0.0 corresponds approximately to a date 4712 -- B.C. (Creationists, this is a joke, so don't read anything else -- into it.) -- procedure Julian (Yr : in Integer; Mo : in Integer; Dy : in Integer; Hr : in Integer; Mn : in Integer; Sc : in Long_Float; Jd : out Long_Float); -- -- The Calen procedure returns the Year, Month, Day, Hour, Minute, -- and Second (using the obvious abbreviations shown below) when a -- Julian date is provided as the input parameter. The Month is -- specified by its normal index number. -- procedure Calen (Jd : in Long_Float; Yr : out Integer; Mo : out Integer; Dy : out Integer; Hr : out Integer; Mn : out Integer; Sc : out Long_Float); -- -- The Is_ISO_8601_Date function verifies a string is in ISO 8601 -- date format. Actually only a subset of all permissible ISO -- 8601 dates are checked by this routine. Specifically, only forms -- listed below can be validated. -- -- yyyy-mm-ddThh:mm:ss.sss or -- yyyy-mm-dd or -- hh:mm:ss.sss -- -- Other forms will be declared invalid. -- function Is_ISO_8601_Date (Str : in String) return Boolean; -- -- The Parse_ISO_8601_Date procedure extracts the year, month, -- day, hour minute and second from a string in ISO 8601 date -- format. Actually only a subset of all permissible ISO 8601 -- dates are parsed by this routine. Specifically, only forms -- listed below will be parsed. -- -- yyyy-mm-ddThh:mm:ss.sss or -- yyyy-mm-dd or -- hh:mm:ss.sss -- -- This procedure invokes Is_ISO_8601_Date prior to parsing the -- date so the user does not have to test the form of the date -- prior to using this procedure. -- procedure Parse_ISO_8601_Date (Str : in String; Year : out Integer; Month : out Natural; Day : out Natural; Hour : out Natural; Minute : out Natural; Second : out Long_Float); -- -- The Is_Unsigned_Int function returns true if the specified -- string contains a single unsigned base 10 integer. It returns -- false otherwise. The integer must contain at least one digit. -- -- Programming interface: -- -- Name Meaning -- Str The string containing the putative unsigned integer. -- function Is_Unsigned_Int (Str : in String) return Boolean; -- -- The Is_Int_Num function returns true if the specified string -- contains a single base 10 integer. The integer may be signed or -- unsigned. It returns false otherwise. The integer must contain -- at least one digit. -- -- Programming interface: -- -- Name Meaning -- Str The string containing the putative integer. -- function Is_Int_Num (Str : in String) return Boolean; -- -- The Is_Fp_Num funciton returns true if the specified string -- contains a single base 10 floating point number. It returns -- false otherwise. The number may be signed or unsigned. The -- number must have a decimal point and at least one digit -- preceeding the decimal point and at least one digit following -- the decimal point. These requirements are more strict than the -- normal Ada requirements for a number. -- -- Programming interface: -- -- Name Meaning -- Str The string containing the putative floating point -- number. -- function Is_Fp_Num (Str : in String) return Boolean; -- -- The Hms2rad procedure converts a string that specifies a Right -- Ascension in hour, minute, second format to an angle specified -- in radians. The hh mm ss fields may be integers or floating -- point numbers. Any subset of the three fields may be specified -- but the procedure assumes the highest possible order. That is, -- hh mm is valid but mm ss is not. (Note that this is an -- undetectable error. The user may intend 23 minutes 43 seconds -- when writing the string but this procedure will assume 23 hours -- 43 minutes.) The last of any set may be a floating point -- number. For example. 23.5 is correct but 23.5 16 is not. -- -- Programming interface: -- -- Name Meaning -- -- str The string specifying the angle expressed in -- hours: hh mm ss.ss or -- hh mm.mm or -- hh.hh -- -- rad The RA angle expressed in radians -- -- Errors: -- -- If the angle is in a format that cannot be converted, or if the -- string specification is in a non-standard format, or if the -- specified angle is out of the standard range, then an error is -- raised. -- procedure Hms2rad (Str : in String; Rad : out Long_Float); -- -- The Rad2hms procedure converts a long_float number representing -- the hour angle (in radians) to the hour angle in hr min sec -- character format. -- -- If the supplied string is not large enough to represent the -- format, an error is raised. The routine folds any value of Ra -- into a valid value between 0 and 24 hr. -- -- Programming interface: -- -- Name Meaning -- -- Ra The hour angle expressed in radians. -- Str The character form of hour angle expressed in -- hr min sec of right ascension. hh mm ss.sss -- procedure Rad2hms (Ra : in Long_Float; Str : out String; Delim : in Character := ' '); -- -- The Dms2rad procedure converts a string that specifies a -- declination in degree, minute, second format to an angle -- specified in radians. The dd mm ss fields may be integers or -- floating point numbers. Any subset of the three fields may be -- specified but the procedure assumes the highest possible order. -- That is, dd mm is valid but mm ss is not. Only the last of any -- set may be a floating point number. For example. 23.5 is -- correct but 23.5 16 is not. -- -- Programming interface: -- -- Name Meaning -- -- str The string specifying the angle expressed in -- declination dd mm ss.ss -- -- rad The angle expressed in ecliptic radians -- -- Errors: -- -- If the angle is in a format that cannot be converted, or if the -- string specification is in a non-standard format, or if the -- specified angle is out of the standard range, then an error is -- raised. -- procedure Dms2rad (Str : in String; Rad : out Long_Float); -- -- The Rad2dms procedure converts a long_float number representing -- the declination (in radians) to declination in deg min sec -- character format. -- -- If the supplied string is not large enough to represent the -- format, an error is raised. The routine folds any value of Rad -- into a valid value between -90 and +90 deg. -- -- Programming interface: -- -- Name Meaning -- -- Rad The equitorial declination expressed in radians. -- Str The character form of declinationexpressed in deg min sec -- of declination. dd mm ss.ss -- procedure Rad2dms (Rad : in Long_Float; Str : out String; Delim : in Character := ' '); -- -- The Spherical_Distance procedure calculates the angular -- distance between two points on the celestial sphere. The first -- point is specified by Ra1 and Dec1. The second point is -- specified by Ra2 and Dec2. The angular distance is specified by -- "Distance". All coordinates and distances are specified in -- radians. -- procedure Spherical_Distance (Ra1 : in Long_Float; Dec1 : in Long_Float; Ra2 : in Long_Float; Dec2 : in Long_Float; Distance : out Long_Float); -- -- The Epoch procedure returns the fractional number of centuries -- since 2000-Jan-01T12:00:00. The Julian date required as input -- can be found by using the Julian procedure. -- procedure Epoch (Jd : in Long_Float; Centuries : out Long_Float); -- -- The Greenwich_Mean_Sidereal_Time procedure returns the -- Greenwich Mean Sidereal Time (GMST) when supplied the the -- Julian date (see procedure Julian). GMST corresponds to the RA -- of the meridian in Greenwich at the requested time. The units -- are in radians rather than the more normal hours. -- procedure Greenwich_Mean_Sidereal_Time (Jd : in Long_Float; Gmst : out Long_Float); -- -- The Local_Mean_Sidereal_Time procedure returns the Local Mean -- Sidereal Time (LMST) when supplied the the Julian date (see -- procedure Julian) and the local longitude. LMST corresponds to -- the RA of the meridian at the specified longitude at the -- requested time. All units are in radians rather than the more -- normal hours and degrees. -- procedure Local_Mean_Sidereal_Time (Jd : in Long_Float; Local_Longitude : in Long_Float; Lmst : out Long_Float); -- -- The Galactic_To_Equitorial procedure converts galactic -- coordinates, Lat, Long to equitorial coordinates Alpha (RA), -- Dec. All angle are in radians. -- procedure Galactic_To_Equitorial (Lat,Long : in Long_Float; Alpha, Decl : out Long_Float); -- -- The Equitorial_To_Galactic procedure converts equitorial -- coordinates, Alpha (RA), Decl to galactic coordinates Lat, -- Long. All angle are in radians. -- procedure Equitorial_To_Galactic (Alpha, Decl : in Long_Float; Lat,Long : out Long_Float); end Lois_Script_Pkg;