home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / modula2 / compiler / m2mmdemo / isinst / module / datedemo.mod next >
Encoding:
Text File  |  1989-02-27  |  3.6 KB  |  108 lines

  1.  
  2. MODULE DateDemo;
  3.   (*---------------------------------------------------------------------*)
  4.   (*                     D A T E - C A L C - D E M O                     *)
  5.   (*                           M 2 P R O L I B                           *)
  6.   (*  Copyright (C) 1987    Bühlmann Computer Software   CH-8636 WALD    *)
  7.   (*                     -- All Rights Reserved --                       *)
  8.   (*---------------------------------------------------------------------*)
  9.   (*  Author: X. Bühlmann                                                *)
  10.   (*                                                                     *)
  11.   (*  Version 1.0      Date: 28/09/88                                    *)
  12.   (*---------------------------------------------------------------------*)
  13.   FROM DateCalc IMPORT sDateFormat, eDateFormat, aDateType, DateFormat, 
  14.       DateControl, DaysToDate, CountDate, CardDate;
  15.   IMPORT Screen, ScreenNum;
  16.   IMPORT Terminal;
  17.   VAR
  18.     g : 
  19.       RECORD
  20.         Day : LONGINT;
  21.         Date : aDateType;
  22.         dType : ARRAY [0..1] OF CHAR;
  23.       END;
  24.   PROCEDURE Copyright();
  25.     BEGIN
  26.       Screen.ClearScrBound();
  27.       Screen.ScrWriteLn();
  28.       Screen.ScrPutString(
  29.           '                D A T E - D E M O    Version 1.0   ');
  30.       Screen.ScrWriteLn();
  31.       Screen.ScrPutString(
  32.           '                           1 9 8 8                 ');
  33.       Screen.ScrWriteLn();
  34.       Screen.ScrWriteLn();
  35.       Screen.ScrPutString(
  36.           '                         Copyright by           ');
  37.       Screen.ScrWriteLn();
  38.       Screen.ScrPutString(
  39.           '                 (c) Bühlmann Computer Software    ');
  40.       Screen.ScrWriteLn();
  41.       Screen.ScrPutString(
  42.           '                         CH-8636 Wald              ');
  43.       Screen.ScrWriteLn();
  44.     END Copyright;
  45.   BEGIN
  46.     Copyright();
  47.     LOOP
  48.       Screen.ScrPutString('Keine Eingabe = Ende');
  49.       Screen.ScrWriteLn();
  50.       Screen.ScrPutString(
  51.           'USA = U / Europe = E / Japan = J / Long = L / Short = S');
  52.       Screen.ScrWriteLn();
  53.       Screen.ScrPutString('Format [UL/EL/JL/US/ES/JS]: ');
  54.       g.dType := '';
  55.       Terminal.ReadString(g.dType);
  56.       g.dType[0] := CAP(g.dType[0]);
  57.       g.dType[1] := CAP(g.dType[1]);
  58.       CASE g.dType[0] OF
  59.       | 'U' :
  60.         CASE g.dType[1] OF
  61.         | 'L' :
  62.           DateFormat := sDateFormat{usa,long};
  63.         ELSE
  64.           DateFormat := sDateFormat{usa,short};
  65.         END;
  66.       | 'J' :
  67.         CASE g.dType[1] OF
  68.         | 'L' :
  69.           DateFormat := sDateFormat{japan,long};
  70.         ELSE
  71.           DateFormat := sDateFormat{japan,short};
  72.         END;
  73.       | 'E' :
  74.         CASE g.dType[1] OF
  75.         | 'L' :
  76.           DateFormat := sDateFormat{europe,long};
  77.         ELSE
  78.           DateFormat := sDateFormat{europe,short};
  79.         END;
  80.       ELSE
  81.         EXIT;
  82.       END;
  83.       LOOP
  84.         Screen.ScrWriteLn();
  85.         DaysToDate(LONGINT(0), g.Date);
  86.         Screen.ScrPutString('Von ');
  87.         Screen.ScrPutString(g.Date);
  88.         Screen.ScrPutString(' bis ');
  89.         Terminal.ReadString(g.Date);
  90.         IF g.Date[0]=0C THEN
  91.           EXIT;
  92.         END;
  93.         IF CountDate(g.Date,g.Day) THEN
  94.           Screen.ScrPutString(g.Date);
  95.           Screen.ScrWriteLn();
  96.           Screen.ScrPutString('Julianisches Datum = ');
  97.           ScreenNum.WriteLong(g.Day, 10);
  98.           Screen.ScrPutString('     Gregorianisches Datum = ');
  99.           DaysToDate(g.Day, g.Date);
  100.           Screen.ScrPutString(g.Date);
  101.         ELSE
  102.           Screen.ScrPutString('  Falsches Datum ');
  103.         END;
  104.         Screen.ScrWriteLn();
  105.       END;
  106.     END;
  107.   END DateDemo.
  108.