[BACK]Return to bye_bye_message.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / System

Annotation of OpenXM_contrib/PHC/Ada/System/bye_bye_message.adb, Revision 1.1.1.1

1.1       maekawa     1: with Ada.Calendar;    use Ada.Calendar;
                      2:
                      3: function Bye_Bye_Message return string is
                      4:
                      5:   date : time := Clock;
                      6:
                      7:   function Convert1 ( n : integer ) return character is
                      8:   begin
                      9:     case n is
                     10:       when 1 => return '1';
                     11:       when 2 => return '2';
                     12:       when 3 => return '3';
                     13:       when 4 => return '4';
                     14:       when 5 => return '5';
                     15:       when 6 => return '6';
                     16:       when 7 => return '7';
                     17:       when 8 => return '8';
                     18:       when 9 => return '9';
                     19:       when others => return '0';
                     20:     end case;
                     21:   end Convert1;
                     22:
                     23:   function Convert2 ( n : integer ) return string is
                     24:   begin
                     25:     if n < 10
                     26:      then declare
                     27:             res : string(1..1);
                     28:           begin
                     29:             res(1) := Convert1(n);
                     30:             return res;
                     31:           end;
                     32:      else declare
                     33:             n10 : integer := n/10;
                     34:             n1 : integer := n mod 10;
                     35:             last : string(1..1);
                     36:             first : constant string := Convert2(n10);
                     37:           begin
                     38:             last(1) := Convert1(n1);
                     39:             return first & last;
                     40:           end;
                     41:     end if;
                     42:   end Convert2;
                     43:
                     44:   function Convert ( d : Time ) return string is
                     45:
                     46:     yr : Year_Number;
                     47:     mo : Month_Number;
                     48:     da : Day_Number;
                     49:     se : Day_Duration;
                     50:
                     51:   begin
                     52:     Split(d,yr,mo,da,se);
                     53:     return Convert2(da) & "/" & Convert2(mo) & "/" & Convert2(yr);
                     54:   end Convert;
                     55:
                     56: begin
                     57:   return "PHC worked" & " on " & Convert(date) & ".";
                     58: end Bye_Bye_Message;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>