1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
|
/***********************************************************************/
/* */
/* Applied Type System */
/* */
/***********************************************************************/
/* (*
** ATS/Postiats - Unleashing the Potential of Types!
** Copyright (C) 2010-2013 Hongwei Xi, ATS Trustful Software, Inc.
** All rights reserved
**
** ATS is free software; you can redistribute it and/or modify it under
** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the
** Free Software Foundation; either version 3, or (at your option) any
** later version.
**
** ATS is distributed in the hope that it will be useful, but WITHOUT ANY
** WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
** for more details.
**
** You should have received a copy of the GNU General Public License
** along with ATS; see the file COPYING. If not, please write to the
** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
** 02110-1301, USA.
*) */
/* ****** ****** */
/*
** Source:
** $PATSHOME/prelude/CATS/CODEGEN/char.atxt
** Time of generation: Fri Apr 4 23:21:55 2014
*/
/* ****** ****** */
/*
(* Author: Hongwei Xi *)
(* Authoremail: hwxi AT cs DOT bu DOT edu *)
(* Start time: February, 2012 *)
*/
/* ****** ****** */
#ifndef ATS2CPP_PRELUDE_CATS_CHAR
#define ATS2CPP_PRELUDE_CATS_CHAR
/* ****** ****** */
ATSinline()
atstype_char
atspre_int2char (atstype_int i) { return ((atstype_char)i) ; }
#define atspre_int2char0 atspre_int2char
ATSinline()
atstype_schar
atspre_int2schar (atstype_int i) { return ((atstype_schar)i) ; }
#define atspre_int2schar0 atspre_int2schar
ATSinline()
atstype_uchar
atspre_int2uchar (atstype_int i) { return ((atstype_uchar)i) ; }
#define atspre_int2uchar0 atspre_int2uchar
/* ****** ****** */
ATSinline()
atstype_int
atspre_char2int (atstype_char c) { return ((atstype_int)c) ; }
#define atspre_char2int0 atspre_char2int
ATSinline()
atstype_int
atspre_schar2int (atstype_schar c) { return ((atstype_int)c) ; }
#define atspre_schar2int0 atspre_schar2int
ATSinline()
atstype_int
atspre_uchar2int (atstype_uchar c) { return ((atstype_int)c) ; }
#define atspre_uchar2int0 atspre_uchar2int
/* ****** ****** */
ATSinline()
atstype_uint
atspre_char2uint (atstype_char c) { return ((atstype_uint)c) ; }
#define atspre_char2uint0 atspre_char2uint
ATSinline()
atstype_uint
atspre_schar2uint (atstype_schar c) { return ((atstype_uint)c) ; }
#define atspre_schar2uint0 atspre_schar2uint
ATSinline()
atstype_uint
atspre_uchar2uint (atstype_uchar c) { return ((atstype_uint)c) ; }
#define atspre_uchar2uint0 atspre_uchar2uint
/* ****** ****** */
ATSinline()
atstype_int
atspre_char2u2int
(atstype_char c) { return ((atstype_int)((atstype_uchar)c)) ; }
#define atspre_char2u2int0 atspre_char2u2int
ATSinline()
atstype_uint
atspre_char2u2uint
(atstype_char c) { return ((atstype_uint)((atstype_uchar)c)) ; }
#define atspre_char2u2uint0 atspre_char2u2uint
/* ****** ****** */
ATSinline()
atstype_bool
atspre_char_iseqz
(atstype_char c)
{
return ((c == 0) ? atsbool_true : atsbool_false) ;
} // end of [atspre_char_iseqz]
#define atspre_char0_iseqz(c) atspre_char_iseqz(c)
#define atspre_char1_iseqz(c) atspre_char_iseqz(c)
ATSinline()
atstype_bool
atspre_char_isneqz
(atstype_char c)
{
return ((c != 0) ? atsbool_true : atsbool_false) ;
} // end of [atspre_char_isneqz]
#define atspre_char0_isneqz(c) atspre_char_isneqz(c)
#define atspre_char1_isneqz(c) atspre_char_isneqz(c)
/* ****** ****** */
ATSinline()
atstype_char
atspre_add_char_int
(atstype_char c1, atstype_int i2) { return (c1 + i2) ; }
// end of [atspre_add_char_int]
#define atspre_add_char0_int0 atspre_add_char_int
/* ****** ****** */
ATSinline()
atstype_int
atspre_sub_char_char
(atstype_char c1, atstype_char c2) { return (c1 - c2) ; }
// end of [sub_char0_char0]
#define atspre_sub_char0_char0 atspre_sub_char_char
/* ****** ****** */
ATSinline()
atstype_bool
atspre_lt_int_int
(atstype_int i1, atstype_int i2) {
return (i1 < i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_lt_int_int]
#define atspre_lt_char0_char0 atspre_lt_int_int
#define atspre_lt_char1_char1 atspre_lt_int_int
ATSinline()
atstype_bool
atspre_lte_int_int
(atstype_int i1, atstype_int i2) {
return (i1 <= i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_lte_int_int]
#define atspre_lte_char0_char0 atspre_lte_int_int
#define atspre_lte_char1_char1 atspre_lte_int_int
ATSinline()
atstype_bool
atspre_gt_int_int
(atstype_int i1, atstype_int i2) {
return (i1 > i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_gt_int_int]
#define atspre_gt_char0_char0 atspre_gt_int_int
#define atspre_gt_char1_char1 atspre_gt_int_int
ATSinline()
atstype_bool
atspre_gte_int_int
(atstype_int i1, atstype_int i2) {
return (i1 >= i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_gte_int_int]
#define atspre_gte_char0_char0 atspre_gte_int_int
#define atspre_gte_char1_char1 atspre_gte_int_int
ATSinline()
atstype_bool
atspre_eq_int_int
(atstype_int i1, atstype_int i2) {
return (i1 == i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_eq_int_int]
#define atspre_eq_char0_char0 atspre_eq_int_int
#define atspre_eq_char1_char1 atspre_eq_int_int
ATSinline()
atstype_bool
atspre_neq_int_int
(atstype_int i1, atstype_int i2) {
return (i1 != i2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_neq_int_int]
#define atspre_neq_char0_char0 atspre_neq_int_int
#define atspre_neq_char1_char1 atspre_neq_int_int
/* ****** ****** */
ATSinline()
atstype_int
atspre_compare_int_int
(atstype_int i1, atstype_int i2)
{
return (i1 - i2) ;
} // end of [atspre_compare_int_int]
#define atspre_compare_char0_char0(c1, c2) atspre_compare_int_int(c1, c2)
#define atspre_compare_char1_char1(c1, c2) atspre_compare_int_int(c1, c2)
/* ****** ****** */
#define atspre_eq_char0_int0(c, i) atspre_eq_int_int(c, i)
#define atspre_eq_int0_char0(i, c) atspre_eq_int_int(i, c)
#define atspre_neq_char0_int0(c, i) atspre_neq_int_int(c, i)
#define atspre_neq_int0_char0(i, c) atspre_neq_int_int(i, c)
/* ****** ****** */
#define atspre_compare_char0_int0(c, i) atspre_compare_int_int(c, i)
#define atspre_compare_int0_char0(i, c) atspre_compare_int_int(i, c)
/* ****** ****** */
//
// unsigned characters
//
/* ****** ****** */
ATSinline()
atstype_bool
atspre_lt_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 < c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_lt_uchar_uchar]
#define atspre_lt_uchar0_uchar0 atspre_lt_uchar_uchar
#define atspre_lt_uchar1_uchar1 atspre_lt_uchar_uchar
ATSinline()
atstype_bool
atspre_lte_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 <= c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_lte_uchar_uchar]
#define atspre_lte_uchar0_uchar0 atspre_lte_uchar_uchar
#define atspre_lte_uchar1_uchar1 atspre_lte_uchar_uchar
ATSinline()
atstype_bool
atspre_gt_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 > c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_gt_uchar_uchar]
#define atspre_gt_uchar0_uchar0 atspre_gt_uchar_uchar
#define atspre_gt_uchar1_uchar1 atspre_gt_uchar_uchar
ATSinline()
atstype_bool
atspre_gte_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 >= c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_gte_uchar_uchar]
#define atspre_gte_uchar0_uchar0 atspre_gte_uchar_uchar
#define atspre_gte_uchar1_uchar1 atspre_gte_uchar_uchar
ATSinline()
atstype_bool
atspre_eq_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 == c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_eq_uchar_uchar]
#define atspre_eq_uchar0_uchar0 atspre_eq_uchar_uchar
#define atspre_eq_uchar1_uchar1 atspre_eq_uchar_uchar
ATSinline()
atstype_bool
atspre_neq_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return (c1 != c2 ? atsbool_true : atsbool_false) ;
} // end of [atspre_neq_uchar_uchar]
#define atspre_neq_uchar0_uchar0 atspre_neq_uchar_uchar
#define atspre_neq_uchar1_uchar1 atspre_neq_uchar_uchar
ATSinline()
atstype_int
atspre_compare_uchar_uchar
(atstype_uchar c1, atstype_uchar c2) {
return ((atstype_int)c1 - (atstype_int)c2) ;
} // end of [atspre_compare_uchar_uchar]
#define atspre_compare_uchar0_uchar0 atspre_compare_uchar_uchar
#define atspre_compare_uchar1_uchar1 atspre_compare_uchar_uchar
/* ****** ****** */
ATSinline()
atstype_char
atspre_int2digit
(atstype_int i) { return ('0' + i) ; }
// end of [atspre_int2digit]
ATSinline()
atstype_char
atspre_int2xdigit
(atstype_int i) {
return (i < 10) ? ('0' + i) : ('a' + (i - 10)) ;
} // end of [atspre_int2xdigit]
ATSinline()
atstype_char
atspre_int2xxdigit
(atstype_int i) {
return (i < 10) ? ('0' + i) : ('A' + (i - 10)) ;
} // end of [atspre_int2xxdigit]
/* ****** ****** */
#endif // ifndef(ATS2CPP_PRELUDE_CATS_CHAR)
/* ****** ****** */
/* end of [char.cats] */
|