This file is indexed.

/usr/lib/ats2-postiats-0.2.6/prelude/SATS/char.sats is in ats2-lang 0.2.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
(***********************************************************************)
(*                                                                     *)
(*                         Applied Type System                         *)
(*                                                                     *)
(***********************************************************************)

(*
** ATS/Postiats - Unleashing the Potential of Types!
** Copyright (C) 2010-2015 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/SATS/CODEGEN/char.atxt
** Time of generation: Sat Nov  7 22:19:26 2015
*)

(* ****** ****** *)

(* Author: Hongwei Xi *)
(* Authoremail: hwxi AT cs DOT bu DOT edu *)
(* Start time: September, 2011 *)

(* ****** ****** *)
//
praxi
lemma_char_size
(
// argumentless
) : [sizeof(char)==sizeof(byte)] void
praxi
lemma_schar_size
(
// argumentless
) : [sizeof(schar)==sizeof(byte)] void
praxi
lemma_uchar_size
(
// argumentless
) : [sizeof(uchar)==sizeof(byte)] void
//
(* ****** ****** *)
//
castfn char2schar0 (c: char):<> schar
castfn schar2char0 (c: schar):<> char
//
castfn char2uchar0 (c: char):<> uchar
castfn uchar2char0 (c: uchar):<> char
//
(* ****** ****** *)
//
fun int2char0 (i: int):<> char = "mac#%"
fun int2schar0 (i: int):<> schar = "mac#%"
fun int2uchar0 (i: int):<> uchar = "mac#%"
//
fun uint2uchar0 (u: uint):<> uchar = "mac#%"
//
(* ****** ****** *)

fun char2int0 (c: char):<> int = "mac#%"
fun schar2int0 (c: schar):<> int = "mac#%"
fun uchar2int0 (c: uchar):<> int = "mac#%"

(* ****** ****** *)

fun char2uint0 (c: char):<> uint = "mac#%"
fun schar2uint0 (c: schar):<> uint = "mac#%"
fun uchar2uint0 (c: uchar):<> uint = "mac#%"

(* ****** ****** *)

fun char2u2int0 (c: char):<> int = "mac#%"
fun char2u2uint0 (c: char):<> uint = "mac#%"

(* ****** ****** *)
//
fun char0_iseqz (c: char):<> bool = "mac#%"
fun char0_isneqz (c: char):<> bool = "mac#%"
//
overload iseqz with char0_iseqz of 0
overload isneqz with char0_isneqz of 0
//
(* ****** ****** *)
//
fun add_char0_int0
  (c: char, i: int):<> char = "mac#%"
fun sub_char0_int0
  (c: char, i: int):<> char = "mac#%"
fun sub_char0_char0
  (c1: char, c2: char):<> int = "mac#%"
//
overload + with add_char0_int0 of 0
overload - with sub_char0_int0 of 0
overload - with sub_char0_char0 of 0
//
(* ****** ****** *)

fun lt_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload < with lt_char0_char0 of 0
fun lte_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload <= with lte_char0_char0 of 0

fun gt_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload > with gt_char0_char0 of 0
fun gte_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload >= with gte_char0_char0 of 0

fun eq_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload = with eq_char0_char0 of 0
fun neq_char0_char0
  (c1: char, c2: char):<> bool = "mac#%"
overload != with neq_char0_char0 of 0
overload <> with neq_char0_char0 of 0

fun compare_char0_char0
  (c1: char, c2: char):<> int = "mac#%"
overload compare with compare_char0_char0 of 0

(* ****** ****** *)
//
castfn g0ofg1_char (c: Char):<> char
castfn g1ofg0_char (c: char):<> Char
//
overload g0ofg1 with g0ofg1_char // index-erasing
overload g1ofg0 with g1ofg0_char // index-inducing
//
(* ****** ****** *)
//
castfn
char2schar1
  {c:int}(c: char (c)):<> schar (c)
castfn
schar2char1
  {c:int}(c: schar (c)):<> char (c)
//
castfn
char2uchar1
  {c:int}(c: char (c)):<> uchar (i2u8(c))
castfn
uchar2char1
  {c:int}(c: uchar (c)):<> char (u2i8(c))
//
(* ****** ****** *)
//
fun
char2int1
  {c:int}(c: char (c)):<> int (c) = "mac#%"
fun
schar2int1
  {c:int}(c: schar (c)):<> int (c) = "mac#%"
fun
uchar2int1
  {c:int}(c: uchar (c)):<> int (c) = "mac#%"
//
(* ****** ****** *)
//
fun char1_iseqz
  {c:int}(c: char(c)):<> bool(c == 0) = "mac#%"
fun char1_isneqz
  {c:int}(c: char(c)):<> bool(c != 0) = "mac#%"
//
overload iseqz with char1_iseqz of 10
overload isneqz with char1_isneqz of 10
//
(* ****** ****** *)

fun
lt_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 < c2) = "mac#%"
overload < with lt_char1_char1 of 20
fun
lte_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 <= c2) = "mac#%"
overload <= with lte_char1_char1 of 20

fun
gt_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 > c2) = "mac#%"
overload > with gt_char1_char1 of 20
fun
gte_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 >= c2) = "mac#%"
overload >= with gte_char1_char1 of 20

fun
eq_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 == c2) = "mac#%"
overload = with eq_char1_char1 of 20
fun
neq_char1_char1 {c1,c2:int}
  (c1: char (c1), c2: char (c2)):<> bool (c1 != c2) = "mac#%"
overload != with neq_char1_char1 of 20
overload <> with neq_char1_char1 of 20

fun compare_char1_char1
  {c1,c2:int}
  (c1: char c1, c2: char c2) :<> int (c1-c2) = "mac#%"
overload compare with compare_char1_char1 of 20

(* ****** ****** *)
//
fun eq_char0_int0 : (char, int) -<fun0> bool = "mac#%"
fun eq_int0_char0 : (int, char) -<fun0> bool = "mac#%"
overload = with eq_char0_int0 of 0
overload = with eq_int0_char0 of 0
fun neq_char0_int0 : (char, int) -<fun0> bool = "mac#%"
fun neq_int0_char0 : (int, char) -<fun0> bool = "mac#%"
overload != with neq_char0_int0 of 0
overload <> with neq_char0_int0 of 0
overload != with neq_int0_char0 of 0
overload <> with neq_int0_char0 of 0
//
fun compare_char0_int0 : (char, int) -<fun0> int = "mac#%"
fun compare_int0_char0 : (int, char) -<fun0> int = "mac#%"
overload compare with compare_char0_int0
overload compare with compare_int0_char0
//
(* ****** ****** *)
//
// unsigned characters
//
(* ****** ****** *)

fun lt_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload < with lt_uchar0_uchar0 of 0
fun lte_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload <= with lte_uchar0_uchar0 of 0

fun gt_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload > with gt_uchar0_uchar0 of 0
fun gte_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload >= with gte_uchar0_uchar0 of 0

fun eq_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload = with eq_uchar0_uchar0 of 0
fun neq_uchar0_uchar0
  (c1: uchar, c2: uchar):<> bool = "mac#%"
overload != with neq_uchar0_uchar0 of 0
overload <> with neq_uchar0_uchar0 of 0

fun compare_uchar0_uchar0
  (c1: uchar, c2: uchar):<> int = "mac#%"
overload compare with compare_uchar0_uchar0 of 0

(* ****** ****** *)

fun
lt_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 < c2) = "mac#%"
overload < with lt_uchar1_uchar1 of 20
fun
lte_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 <= c2) = "mac#%"
overload <= with lte_uchar1_uchar1 of 20

fun
gt_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 > c2) = "mac#%"
overload > with gt_uchar1_uchar1 of 20
fun
gte_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 >= c2) = "mac#%"
overload >= with gte_uchar1_uchar1 of 20

fun
eq_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 == c2) = "mac#%"
overload = with eq_uchar1_uchar1 of 20
fun
neq_uchar1_uchar1 {c1,c2:int}
  (c1: uchar (c1), c2: uchar (c2)) :<> bool (c1 != c2) = "mac#%"
overload != with neq_uchar1_uchar1 of 20
overload <> with neq_uchar1_uchar1 of 20

fun compare_uchar1_uchar1
  {c1,c2:int}
  (c1: uchar c1, c2: uchar c2) :<> int (c1-c2) = "mac#%"
overload compare with compare_uchar1_uchar1 of 20

(* ****** ****** *)

sortdef tk = tkind

(* ****** ****** *)

fun{tk:tk}
g0int_of_char (c: char):<> g0int (tk)
fun{tk:tk}
g0int_of_schar (c: schar):<> g0int (tk)
fun{tk:tk}
g0int_of_uchar (c: uchar):<> g0int (tk)

fun{tk:tk}
g0uint_of_uchar (c: uchar):<> g0uint (tk)

(* ****** ****** *)

fun{tk:tk}
g1int_of_char1 // c:int8
  {c:int} (c: char (c)):<> g1int (tk, c)
// end of [g1int_of_char1]
fun{tk:tk}
g1int_of_schar1 // c:int8
  {c:int} (c: schar (c)):<> g1int (tk, c)
// end of [g1int_of_schar1]
fun{tk:tk}
g1int_of_uchar1 // c:uint8
  {c:int} (c: uchar (c)):<> g1int (tk, c)
// end of [g1int_of_uchar1]

(*
** HX: g1uint_of_schar1: schar -> int -> uint
*)
fun{tk:tk}
g1uint_of_uchar1
  {c:int} (c: uchar (c)):<> g1uint (tk, c)
// end of [g1uint_of_uchar1]

(* ****** ****** *)
//
// HX:
// return is dynamically allocated
//
fun{}
char2string(c: char):<> string
fun{}
char2strptr(c: char):<!wrt> Strptr1
//
(* ****** ****** *)

fun print_char (x: char): void = "mac#%"
fun prerr_char (x: char): void = "mac#%"
overload print with print_char
overload prerr with prerr_char
fun fprint_char : fprint_type (char) = "mac#%"
overload fprint with fprint_char
fun print_schar (x: schar): void = "mac#%"
fun prerr_schar (x: schar): void = "mac#%"
overload print with print_schar
overload prerr with prerr_schar
fun fprint_schar : fprint_type (schar) = "mac#%"
overload fprint with fprint_schar
fun print_uchar (x: uchar): void = "mac#%"
fun prerr_uchar (x: uchar): void = "mac#%"
overload print with print_uchar
overload prerr with prerr_uchar
fun fprint_uchar : fprint_type (uchar) = "mac#%"
overload fprint with fprint_uchar

(* ****** ****** *)

symintr isalpha
fun isalpha_int (c: int):<> bool = "mac#%"
overload isalpha with isalpha_int of 0
fun isalpha_char (c: char):<> bool = "mac#%"
overload isalpha with isalpha_char of 0
symintr isalnum
fun isalnum_int (c: int):<> bool = "mac#%"
overload isalnum with isalnum_int of 0
fun isalnum_char (c: char):<> bool = "mac#%"
overload isalnum with isalnum_char of 0

symintr isascii
fun isascii_int (c: int):<> bool = "mac#%"
overload isascii with isascii_int of 0
fun isascii_char (c: char):<> bool = "mac#%"
overload isascii with isascii_char of 0

symintr isblank
fun isblank_int (c: int):<> bool = "mac#%"
overload isblank with isblank_int of 0
fun isblank_char (c: char):<> bool = "mac#%"
overload isblank with isblank_char of 0
symintr isspace
fun isspace_int (c: int):<> bool = "mac#%"
overload isspace with isspace_int of 0
fun isspace_char (c: char):<> bool = "mac#%"
overload isspace with isspace_char of 0

symintr iscntrl
fun iscntrl_int (c: int):<> bool = "mac#%"
overload iscntrl with iscntrl_int of 0
fun iscntrl_char (c: char):<> bool = "mac#%"
overload iscntrl with iscntrl_char of 0

symintr isdigit
fun isdigit_int (c: int):<> bool = "mac#%"
overload isdigit with isdigit_int of 0
fun isdigit_char (c: char):<> bool = "mac#%"
overload isdigit with isdigit_char of 0
symintr isxdigit
fun isxdigit_int (c: int):<> bool = "mac#%"
overload isxdigit with isxdigit_int of 0
fun isxdigit_char (c: char):<> bool = "mac#%"
overload isxdigit with isxdigit_char of 0

symintr isgraph
fun isgraph_int (c: int):<> bool = "mac#%"
overload isgraph with isgraph_int of 0
fun isgraph_char (c: char):<> bool = "mac#%"
overload isgraph with isgraph_char of 0
symintr isprint
fun isprint_int (c: int):<> bool = "mac#%"
overload isprint with isprint_int of 0
fun isprint_char (c: char):<> bool = "mac#%"
overload isprint with isprint_char of 0
symintr ispunct
fun ispunct_int (c: int):<> bool = "mac#%"
overload ispunct with ispunct_int of 0
fun ispunct_char (c: char):<> bool = "mac#%"
overload ispunct with ispunct_char of 0

symintr islower
fun islower_int (c: int):<> bool = "mac#%"
overload islower with islower_int of 0
fun islower_char (c: char):<> bool = "mac#%"
overload islower with islower_char of 0
symintr isupper
fun isupper_int (c: int):<> bool = "mac#%"
overload isupper with isupper_int of 0
fun isupper_char (c: char):<> bool = "mac#%"
overload isupper with isupper_char of 0

(* ****** ****** *)

fun toascii (c: int):<> int = "mac#%"

(* ****** ****** *)

symintr tolower
fun tolower_int (c: int):<> int = "mac#%"
fun tolower_char (c: char):<> char = "mac#%"
overload tolower with tolower_int
overload tolower with tolower_char

symintr toupper
fun toupper_int (c: int):<> int = "mac#%"
fun toupper_char (c: char):<> char = "mac#%"
overload toupper with toupper_int
overload toupper with toupper_char

(* ****** ****** *)

fun int2digit (i: intBtw(0, 10)): char = "mac#%"
fun int2xdigit (i: intBtw(0, 16)): char = "mac#%"
fun int2xxdigit (i: intBtw(0, 16)): char = "mac#%"

(* ****** ****** *)

symintr c2uc
overload c2uc with char2uchar0 of 0
overload c2uc with char2uchar1 of 10
symintr uc2c
overload uc2c with uchar2char0 of 0
overload uc2c with uchar2char1 of 10

(* ****** ****** *)

symintr char2i
overload char2i with char2int0 of 0
symintr char2ui
overload char2ui with char2uint0 of 0
symintr uchar2i
overload uchar2i with uchar2int0 of 0
symintr uchar2ui
overload uchar2ui with uchar2uint0 of 0

(* ****** ****** *)

symintr char2u2i
overload char2u2i with char2u2int0 of 0
symintr char2u2ui
overload char2u2ui with char2u2uint0 of 0

(* ****** ****** *)
//
fun int2byte0 (i: int): byte = "mac#%"
fun byte2int0 (b: byte):<> int = "mac#%"
//
fun uint2byte0 (u: uint): byte = "mac#%"
fun byte2uint0 (b: byte):<> uint = "mac#%"
//
symintr byte2i
overload byte2i with byte2int0 of 0
symintr i2byte
overload i2byte with int2byte0 of 0
//
symintr byte2ui
overload byte2i with byte2uint0 of 0
symintr ui2byte
overload i2byte with uint2byte0 of 0
//
(* ****** ****** *)

(* end of [char.sats] *)