This file is indexed.

/usr/lib/ats2-postiats-0.1.3/prelude/SATS/filebas.sats is in ats2-lang 0.1.3-1.

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
(***********************************************************************)
(*                                                                     *)
(*                         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/SATS/CODEGEN/filebas.atxt
** Time of generation: Fri Sep 26 22:20:46 2014
*)

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

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

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

sortdef t0p = t@ype and vt0p = viewt@ype

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

#define NSH (x) x // for commenting: no sharing
#define SHR (x) x // for commenting: it is shared

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

val stdin_ref : FILEref = "mac#%FILE_stdin"
val stdout_ref : FILEref = "mac#%FILE_stdout"
val stderr_ref : FILEref = "mac#%FILE_stderr"

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

fun{} dirsep_get ():<> charNZ
fun{} dirname_self ():<> string
fun{} dirname_parent ():<> string

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

fun{}
filename_get_ext (name: string):<> vStrptr0
fun{}
filename_test_ext (name: string, ext: string):<> bool

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

fun{}
filename_get_base (name: string):<> vStrptr1
fun{}
filename_test_base (name: string, base: string):<> bool

(* ****** ****** *)
//
val file_mode_r
  : file_mode (r()) = "mac#%" // = "r"
val file_mode_rr
  : file_mode (rw()) = "mac#%" // = "r+"
//
val file_mode_w
  : file_mode (w()) = "mac#%" // = "w"
val file_mode_ww
  : file_mode (rw()) = "mac#%" // = "w+"
//
val file_mode_a
  : file_mode (rw()) = "mac#%" // = "a"
val file_mode_aa
  : file_mode (rw()) = "mac#%" // = "a+"
//
(* ****** ****** *)

(*
** HX: [stat] is called
*)
fun test_file_exists (path: NSH(string)): bool = "mac#%"

(* ****** ****** *)
//
// HX-2011-02-16:
// [stat] is called to obtain the mode of a given file
// for [f] to be applied to it.
//
fun{}
test_file_mode (path: NSH(string)): int
//
fun{} test_file_mode$pred (mode: uint): bool
//
fun test_file_mode_fun
  (path: NSH(string), f: uint -> bool): int = "mac#%"
//
// HX: [stat] is called // ~1/0/1: error/false/true
//
fun test_file_isblk (path: NSH(string)): int = "mac#%"
fun test_file_ischr (path: NSH(string)): int = "mac#%"
fun test_file_isdir (path: NSH(string)): int = "mac#%"
fun test_file_isfifo (path: NSH(string)): int = "mac#%"
fun test_file_isreg (path: NSH(string)): int = "mac#%"
//
// HX: [lstat] is called // ~1/0/1: error/false/true
//
fun test_file_islnk (path: NSH(string)): int = "mac#%"
//
(* ****** ****** *)

fun
fileref_open_exn
  (path: NSH(string), fm: file_mode): FILEref = "mac#%"
// end of [fileref_open_exn]

fun{
} fileref_open_opt
  (path: NSH(string), fm: file_mode): Option_vt (FILEref)
// end of [fileref_open_opt]

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

fun fileref_close (fil: FILEref): void = "mac#%"

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

fun fileref_flush (fil: FILEref): void = "mac#%"

(* ****** ****** *)
//
// HX: error indication: EOF
//
fun fileref_getc (inp: FILEref): int = "mac#%"
//
(* ****** ****** *)
//
// HX: no error reporting
//
symintr fileref_putc
//
fun fileref_putc_int
  (out: FILEref, c: int): void = "mac#%"
overload fileref_putc with fileref_putc_int
fun fileref_putc_char
  (out: FILEref, c: char): void = "mac#%"
overload fileref_putc with fileref_putc_char
//
(* ****** ****** *)
//
// HX: no error reporting
//
fun fileref_puts
  (out: FILEref, s: NSH(string)): void = "mac#%"
//
(* ****** ****** *)

fun fileref_is_eof (fil: FILEref): bool = "mac#%"

macdef
fileref_isnot_eof (inp) = ~fileref_is_eof (,(inp))

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

typedef
fileref_load_type (a:t@ype) =
  (FILEref, &a? >> opt (a, b)) -<fun1> #[b:bool] bool (b)
// end of [fileref_load_type]

fun{a:t0p}
fileref_load : fileref_load_type (a)

fun fileref_load_int : fileref_load_type (int) = "mac#%"
fun fileref_load_lint : fileref_load_type (lint) = "mac#%"
fun fileref_load_uint : fileref_load_type (uint) = "mac#%"
fun fileref_load_ulint : fileref_load_type (ulint) = "mac#%"

fun fileref_load_float : fileref_load_type (float) = "mac#%"
fun fileref_load_double : fileref_load_type (double) = "mac#%"

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

fun{a:t0p}
fileref_get_optval
  (inp: FILEref): Option_vt (a)
// end of [fileref_get_optval]

fun{
a:t0p
} fileref_get_exnmsg
  (inp: FILEref, msg: NSH(string)): a
// end of [fileref_get_exnmsg]

macdef
fileref_get_exnloc
  (inp) = fileref_get_exnmsg (,(inp), $mylocation)
// end of [fileref_get_exnloc]

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

typedef charlst = List0 (char)
vtypedef charlst_vt = List0_vt (char)

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

fun fileref_get_line_charlst (inp: FILEref): charlst_vt

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

(*
** HX: only for files of "tiny" size
*)
fun fileref_get_lines_charlstlst (inp: FILEref): List0_vt (charlst_vt)

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

(*
** HX: for handling files of "tiny" size
*)
fun fileref_get_file_charlst (inp: FILEref): List0_vt (char)
fun fileref_get2_file_charlst (inp: FILEref, n: int): List0_vt (char)

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

fun fileref_put_charlst (inp: FILEref, cs: NSH(List(char))): void

(* ****** ****** *)
//
//
// HX-2013-05:
// these functions are based on [fgets];
// they should only be applied to files containing
// no occurrences of the NUL character ('\000').
//
fun{
} fileref_get_line_string (inp: FILEref): Strptr1
//
fun{
} fileref_get_line_string_main
  (inp: FILEref, n: &int? >> int n): #[n:nat] strnptr (n)
fun{}
fileref_get_line_string$bufsize ((*void*)): intGte(1)
//
fun{
} fileref_get_lines_stringlst (inp: FILEref): List0_vt (Strptr1)
//
(* ****** ****** *)
//
fun{
} fileref_get_file_string (inp: FILEref): Strptr1
fun{}
fileref_get_file_string$bufsize ((*void*)): intGte(1)
//
(* ****** ****** *)
//
fun{}
fileref_get_word (inp: FILEref): Strptr0
fun{}
fileref_get_word$isalpha (c: charNZ): bool
//
(* ****** ****** *)
//
fun{}
fileref_foreach (inp: FILEref): void
fun{
env:vt0p
} fileref_foreach_env (inp: FILEref, env: &(env) >> _): void
//
fun{}
fileref_foreach$bufsize (): sizeGte(1)
fun{
env:vt0p
} fileref_foreach$fwork (c: char, env: &(env) >> _): void
fun{
env:vt0p
} fileref_foreach$fworkv
  {n:int} (arrayref(char, n), size_t(n), &(env) >> _): void
//
(* ****** ****** *)

(* end of [filebas.sats] *)