1 |
//----------------------------------------------------------------------------------------------------
|
2 |
//$Header: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/dtaipubs/cron/2010/blackjack_201010/source/bjcceval/charfunc.h,v 1.7 2012/03/30 00:58:36 dashley Exp $
|
3 |
//----------------------------------------------------------------------------------------------------
|
4 |
//Copyright (C) 2012, David T. Ashley.
|
5 |
//
|
6 |
//This file is part of BJCCEVAL, a program that evaluates by simulation
|
7 |
//the best basic strategy, card-counting, and other playing strategies
|
8 |
//for several variants of the game of Blackjack.
|
9 |
//
|
10 |
//BJCCEVAL is free software: you can redistribute it and/or modify
|
11 |
//it under the terms of the GNU General Public License as published by
|
12 |
//the Free Software Foundation, either version 3 of the License, or
|
13 |
//(at your option) any later version.
|
14 |
//
|
15 |
//BJCCEVAL is distributed in the hope that it will be useful,
|
16 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
//GNU General Public License for more details.
|
19 |
//
|
20 |
//You should have received a copy of the GNU General Public License
|
21 |
//along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22 |
//(A copy of the GNU General Public License, Version 3 is provided in
|
23 |
//the file "COPYING" distributed with BJCCEVAL.)
|
24 |
//
|
25 |
//David T. Ashley can be contacted at DASHLEY@GMAIL.COM and/or at
|
26 |
//P.O. Box 918, Marshall MI 49068.
|
27 |
//----------------------------------------------------------------------------------------------------
|
28 |
#ifndef CHARFUNC_H_INCLUDED
|
29 |
#define CHARFUNC_H_INCLUDED
|
30 |
|
31 |
#ifdef MODULE_CHARFUNC
|
32 |
#define DECMOD_CHARFUNC
|
33 |
#else
|
34 |
#define DECMOD_CHARFUNC extern
|
35 |
#endif
|
36 |
|
37 |
#include <stdlib.h>
|
38 |
|
39 |
//Character classification functions --------------------------
|
40 |
//
|
41 |
//!=0 if digit, 0 otherwise.
|
42 |
DECMOD_CHARFUNC int CHARFUNC_is_digit(char c);
|
43 |
//
|
44 |
//!=0 if lower-case letter, 0 otherwise.
|
45 |
DECMOD_CHARFUNC int CHARFUNC_is_letter_lc(char c);
|
46 |
//
|
47 |
//!=0 if upper-case letter, 0 otherwise.
|
48 |
DECMOD_CHARFUNC int CHARFUNC_is_letter_uc(char c);
|
49 |
//
|
50 |
//!=0 if whitespace, 0 otherwise. Whitespace is defined as space,
|
51 |
//tab, or newline.
|
52 |
DECMOD_CHARFUNC int CHARFUNC_is_whitespace(char c);
|
53 |
|
54 |
//Hexadecimal arithmetic/presentation functions --------------------------
|
55 |
//
|
56 |
//Returns the value of a digit (0-9), or -1 if the
|
57 |
//passed character is not a digit.
|
58 |
DECMOD_CHARFUNC int CHARFUNC_digit_to_val(char digit);
|
59 |
|
60 |
//Returns a lower-case character corresponding to the
|
61 |
//lowest nibble of the argument.
|
62 |
DECMOD_CHARFUNC char CHARFUNC_nibble_to_lc_hex_digit(int nibble);
|
63 |
|
64 |
//Converts a passed integer to 8 hex digits, lower case letters,
|
65 |
//in reverse order (LSB first), with no terminator. s may not
|
66 |
//be null, and caller must provide space for s[0] through s[7].
|
67 |
//s[8] is not necessary (no terminator is appended.
|
68 |
DECMOD_CHARFUNC void CHARFUNC_int_to_lc_hex_rev(int arg, char *s);
|
69 |
|
70 |
//Character case conversion functions --------------------------
|
71 |
//
|
72 |
//If the character is a lower-case letter, converts it to an upper-case
|
73 |
//letter. All other characters are passed through unchanged.
|
74 |
DECMOD_CHARFUNC char CHARFUNC_to_upper(char c);
|
75 |
|
76 |
//If the character is an upper-case letter, converts it to a lower-case
|
77 |
//letter. All other characters are passed through unchanged.
|
78 |
DECMOD_CHARFUNC char CHARFUNC_to_lower(char c);
|
79 |
|
80 |
//Returns lower-case letter corresponding to integer [0..25]. If out of
|
81 |
//range returns '?'.
|
82 |
DECMOD_CHARFUNC char CHARFUNC_int_to_lower(int arg);
|
83 |
|
84 |
DECMOD_CHARFUNC const char *CHARFUNC_Vcinfo_C(void);
|
85 |
DECMOD_CHARFUNC const char *CHARFUNC_Vcinfo_H(void);
|
86 |
|
87 |
#define CHARFUNC_VCINFO_H "$Revision: 1.7 $"
|
88 |
|
89 |
#endif
|
90 |
|
91 |
//----------------------------------------------------------------------------------------------------
|
92 |
//$Log: charfunc.h,v $
|
93 |
//Revision 1.7 2012/03/30 00:58:36 dashley
|
94 |
//Edits.
|
95 |
//
|
96 |
//Revision 1.6 2012/03/30 00:20:14 dashley
|
97 |
//Edits.
|
98 |
//
|
99 |
//Revision 1.5 2012/03/29 23:44:00 dashley
|
100 |
//Edits.
|
101 |
//
|
102 |
//Revision 1.4 2012/03/29 00:42:06 dashley
|
103 |
//Edits.
|
104 |
//
|
105 |
//Revision 1.3 2012/03/28 23:58:42 dashley
|
106 |
//Edits.
|
107 |
//
|
108 |
//Revision 1.2 2012/03/15 23:38:08 dashley
|
109 |
//License text enhanced.
|
110 |
//
|
111 |
//Revision 1.1 2012/03/12 02:54:25 dashley
|
112 |
//Initial checkin.
|
113 |
//----------------------------------------------------------------------------------------------------
|
114 |
//End of $RCSfile: charfunc.h,v $
|
115 |
//----------------------------------------------------------------------------------------------------
|