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