simulavr  1.1.0
string2.cpp
Go to the documentation of this file.
1 /*
2  ****************************************************************************
3  *
4  * simulavr - A simulator for the Atmel AVR family of microcontrollers.
5  * Copyright (C) 2009 Joel Sherrill
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  ****************************************************************************
22  *
23  * $Id$
24  */
25 
26 #include <errno.h>
27 #include <stdlib.h>
28 #include <limits.h>
29 
30 #ifdef _MSC_VER
31 # define strtoll _strtoi64
32 # define strtoull _strtoui64
33 #endif
34 
35 /*
36  * Instantiate an error checking wrapper for strtol (unsigned char)
37  */
38 #undef STRING_TO_TYPE
39 #undef STRING_TO_NAME
40 #undef STRING_TO_METHOD
41 #undef STRING_TO_MAX
42 #undef STRING_TO_MIN
43 #define STRING_TO_TYPE unsigned char
44 #define STRING_TO_NAME StringToUnsignedChar
45 #define STRING_TO_METHOD strtoul
46 #define STRING_TO_MAX 255
47 #include "string2_template.h"
48 
49 /*
50  * Instantiate an error checking wrapper for strtoul (unsigned long)
51  */
52 #undef STRING_TO_TYPE
53 #undef STRING_TO_NAME
54 #undef STRING_TO_METHOD
55 #undef STRING_TO_MAX
56 #undef STRING_TO_MIN
57 #define STRING_TO_TYPE unsigned long int
58 #define STRING_TO_NAME StringToUnsignedLong
59 #define STRING_TO_METHOD strtoul
60 #define STRING_TO_MAX ULONG_MAX
61 #include "string2_template.h"
62 
63 /*
64  * Instantiate an error checking wrapper for strtoull (unsigned long long)
65  */
66 #undef STRING_TO_TYPE
67 #undef STRING_TO_NAME
68 #undef STRING_TO_METHOD
69 #undef STRING_TO_MAX
70 #undef STRING_TO_MIN
71 #define STRING_TO_TYPE unsigned long long
72 #define STRING_TO_NAME StringToUnsignedLongLong
73 #define STRING_TO_METHOD strtoull
74 #define STRING_TO_MAX ULLONG_MAX
75 #include "string2_template.h"
76