| 1 | |
|---|
| 2 | :- protocol(characterp). |
|---|
| 3 | |
|---|
| 4 | :- info([ |
|---|
| 5 | version is 1.0, |
|---|
| 6 | author is 'Paulo Moura', |
|---|
| 7 | date is 2000/7/24, |
|---|
| 8 | comment is 'Character protocol.']). |
|---|
| 9 | |
|---|
| 10 | :- public(is_alphanumeric/1). |
|---|
| 11 | :- mode(is_alphanumeric(+char), zero_or_one). |
|---|
| 12 | :- info(is_alphanumeric/1, [ |
|---|
| 13 | comment is 'True if the argument is an alphanumeric character.', |
|---|
| 14 | argnames is ['Term']]). |
|---|
| 15 | |
|---|
| 16 | :- public(is_alpha/1). |
|---|
| 17 | :- mode(is_alpha(+char), zero_or_one). |
|---|
| 18 | :- info(is_alpha/1, [ |
|---|
| 19 | comment is 'True if the argument is a letter or an underscore.', |
|---|
| 20 | argnames is ['Term']]). |
|---|
| 21 | |
|---|
| 22 | :- public(is_letter/1). |
|---|
| 23 | :- mode(is_letter(+char), zero_or_one). |
|---|
| 24 | :- info(is_letter/1, [ |
|---|
| 25 | comment is 'True if the argument is a letter.', |
|---|
| 26 | argnames is ['Term']]). |
|---|
| 27 | |
|---|
| 28 | :- public(is_bin_digit/1). |
|---|
| 29 | :- mode(is_bin_digit(+char), zero_or_one). |
|---|
| 30 | :- info(is_bin_digit/1, [ |
|---|
| 31 | comment is 'True if the argument is a binary digit.', |
|---|
| 32 | argnames is ['Term']]). |
|---|
| 33 | |
|---|
| 34 | :- public(is_octal_digit/1). |
|---|
| 35 | :- mode(is_octal_digit(+char), zero_or_one). |
|---|
| 36 | :- info(is_octal_digit/1, [ |
|---|
| 37 | comment is 'True if the argument is an octal digit.', |
|---|
| 38 | argnames is ['Term']]). |
|---|
| 39 | |
|---|
| 40 | :- public(is_dec_digit/1). |
|---|
| 41 | :- mode(is_dec_digit(+char), zero_or_one). |
|---|
| 42 | :- info(is_dec_digit/1, [ |
|---|
| 43 | comment is 'True if the argument is a decimal digit.', |
|---|
| 44 | argnames is ['Term']]). |
|---|
| 45 | |
|---|
| 46 | :- public(is_hex_digit/1). |
|---|
| 47 | :- mode(is_hex_digit(+char), zero_or_one). |
|---|
| 48 | :- info(is_hex_digit/1, [ |
|---|
| 49 | comment is 'True if the argument is an hexadecimal digit.', |
|---|
| 50 | argnames is ['Term']]). |
|---|
| 51 | |
|---|
| 52 | :- public(is_lower_case/1). |
|---|
| 53 | :- mode(is_lower_case(+char), zero_or_one). |
|---|
| 54 | :- info(is_lower_case/1, [ |
|---|
| 55 | comment is 'True if the argument is a lower case letter.', |
|---|
| 56 | argnames is ['Term']]). |
|---|
| 57 | |
|---|
| 58 | :- public(is_upper_case/1). |
|---|
| 59 | :- mode(is_upper_case(+char), zero_or_one). |
|---|
| 60 | :- info(is_upper_case/1, [ |
|---|
| 61 | comment is 'True if the argument is a upper case letter.', |
|---|
| 62 | argnames is ['Term']]). |
|---|
| 63 | |
|---|
| 64 | :- public(is_vowel/1). |
|---|
| 65 | :- mode(is_vowel(+char), zero_or_one). |
|---|
| 66 | :- info(is_vowel/1, [ |
|---|
| 67 | comment is 'True if the argument is a vowel.', |
|---|
| 68 | argnames is ['Term']]). |
|---|
| 69 | |
|---|
| 70 | :- public(is_layout/1). |
|---|
| 71 | :- mode(is_layout(+char), zero_or_one). |
|---|
| 72 | :- info(is_layout/1, [ |
|---|
| 73 | comment is 'True if the argument is a layout character.', |
|---|
| 74 | argnames is ['Term']]). |
|---|
| 75 | |
|---|
| 76 | :- public(lower_upper/2). |
|---|
| 77 | :- mode(lower_upper(?char, ?char), zero_or_more). |
|---|
| 78 | :- mode(lower_upper(+char, ?char), zero_or_one). |
|---|
| 79 | :- mode(lower_upper(?char, +char), zero_or_one). |
|---|
| 80 | :- info(lower_upper/2, [ |
|---|
| 81 | comment is 'Converts between lower and upper case letters.', |
|---|
| 82 | argnames is ['Term1', 'Term2']]). |
|---|
| 83 | |
|---|
| 84 | :- end_protocol. |
|---|