| 1 | |
|---|
| 2 | :- protocol(datep). |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | :- info([ |
|---|
| 6 | version is 1.0, |
|---|
| 7 | author is 'Paulo Moura', |
|---|
| 8 | date is 2000/7/24, |
|---|
| 9 | comment is 'Date protocol.']). |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | :- public(today/3). |
|---|
| 13 | |
|---|
| 14 | :- mode(today(-integer, -integer, -integer), one). |
|---|
| 15 | |
|---|
| 16 | :- info(now/3, [ |
|---|
| 17 | comment is 'Returns current date.', |
|---|
| 18 | argnames is ['Year', 'Month', 'Day']]). |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | :- public(leap_year/1). |
|---|
| 22 | |
|---|
| 23 | :- mode(leap_year(+integer), zero_or_one). |
|---|
| 24 | |
|---|
| 25 | :- info(empty/1, |
|---|
| 26 | [comment is 'True if the argument is a leap year.', |
|---|
| 27 | argnames is ['Year']]). |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | :- public(name_of_day/3). |
|---|
| 31 | |
|---|
| 32 | :- mode(name_of_day(?integer, ?atom, ?atom), zero_or_more). |
|---|
| 33 | |
|---|
| 34 | :- info(valid/3, [ |
|---|
| 35 | comment is 'Name and short name of day.', |
|---|
| 36 | argnames is ['Index', 'Name', 'Short']]). |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | :- public(name_of_month/3). |
|---|
| 40 | |
|---|
| 41 | :- mode(name_of_month(?integer, ?atom, ?atom), zero_or_more). |
|---|
| 42 | |
|---|
| 43 | :- info(valid/3, [ |
|---|
| 44 | comment is 'Name and short name of month.', |
|---|
| 45 | argnames is ['Index', 'Name', 'Short']]). |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | :- public(days_in_month/3). |
|---|
| 49 | |
|---|
| 50 | :- mode(days_in_month(?integer, +integer, ?integer), zero_or_more). |
|---|
| 51 | |
|---|
| 52 | :- info(valid/3, [ |
|---|
| 53 | comment is 'Number of days in a month.', |
|---|
| 54 | argnames is ['Month', 'Year', 'Days']]). |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | :- public(valid/3). |
|---|
| 58 | |
|---|
| 59 | :- mode(valid(@integer, @integer, @integer), zero_or_one). |
|---|
| 60 | |
|---|
| 61 | :- info(valid/3, [ |
|---|
| 62 | comment is 'True if the arguments represent a valid date.', |
|---|
| 63 | argnames is ['Year', 'Month', 'Day']]). |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | :- end_protocol. |
|---|