This file is indexed.

/usr/lib/ats-anairiats-0.2.11/prelude/CATS/basics.cats is in ats-lang-anairiats 0.2.11-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
299
300
301
/************************************************************************/
/*                                                                      */
/*                         Applied Type System                          */
/*                                                                      */
/*                              Hongwei Xi                              */
/*                                                                      */
/************************************************************************/

/*
** ATS - Unleashing the Potential of Types!
**
** Copyright (C) 2002-2008 Hongwei Xi.
**
** ATS is free software;  you can  redistribute it and/or modify it under
** the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by the
** Free Software Foundation; either version 2.1, 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.
*/

/* ****** ****** */

/* author: Hongwei Xi (hwxi AT cs DOT bu DOT edu) */

/* ****** ****** */

#ifndef ATS_PRELUDE_BASICS_CATS
#define ATS_PRELUDE_BASICS_CATS

/* ****** ****** */

#include <stdio.h>
#include <stdarg.h>

/* ****** ****** */

#define _ATS_RUNTIME_CHECK
#undef _ATS_RUNTIME_CHECK // uncomment it for debugging

/* ****** ****** */

/*
** HX-2011-05-06:
*/
extern ats_empty_type ats_empty_value ;

/* ****** ****** */

/*
** HX-2010-02-07: this one is used in many places
*/
ATSinline()
ats_ptr_type
atspre_castfn_ptr (ats_ptr_type p) { return p ; }

/* ****** ****** */
/*
** HX-2011-02-26:
** this one is used to prevent tail-recursion optimization
*/
ATSinline()
ats_void_type atspre_donothing () { return ; }

/* ****** ****** */

ATSinline()
ats_void_type atspre_free_null () { return ; }

/* ****** ****** */

/*
** HX: cutting the corners? yes. worth it? probably.
*/

ATSinline()
ats_ptr_type
atspre_fun_coerce (ats_ptr_type p) { return p ; }

ATSinline()
ats_ptr_type
atspre_clo_coerce (ats_ptr_type p) { return p ; }

/* ****** ****** */

ATSinline()
ats_ptr_type
atspre_cloptr_get_view_ptr (ats_ptr_type p) { return p ; }

/* ****** ****** */

ATSinline()
ats_void_type
atspre_cloptr_free (
  ats_ptr_type p ) { ATS_FREE (p) ; return ; }
// end of [atspre_cloptr_free]

/* ****** ****** */

ATSinline()
ats_void_type
atspre_vbox_make_view_ptr (ats_ptr_type p) { return ; }

ATSinline()
ats_void_type
atspre_vbox_make_view_ptr_gc (ats_ptr_type p) { return ; }

/* ****** ****** */

/*
** HX: various functions for exits
*/

// implemented in [prelude/DATS/basics.dats]
extern ats_void_type ats_exit (const ats_int_type n) ;
// end of [ats_exit]

// implemented in [prelude/DATS/basics.dats]
extern ats_void_type
ats_exit_errmsg (const ats_int_type n, const ats_ptr_type msg) ;
// end of [ats_exit_errmsg]

// implemented in [prelude/DATS/printf.dats]
extern ats_void_type
atspre_exit_prerrf (ats_int_type code, ats_ptr_type fmt, ...) ;
// end of [atspre_exit_prerrf]

/* ****** ****** */

//
// HX: these will probably be removed in ATS/Postiats
//
extern int ats_stdin_view_lock ;
extern int ats_stdout_view_lock ;
extern int ats_stderr_view_lock ;

/* ****** ****** */

ATSinline()
ats_ptr_type
atspre_stdin_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stdin_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdin_get] failed\n") ;
  } // end of [if]
  ats_stdin_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return (ats_ptr_type)stdin;
} // end of [atspre_stdin_get]

ATSinline()
ats_void_type
atspre_stdin_view_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stdin_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdin_view_get] failed\n") ;
  } // end of [if]
  ats_stdin_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stdin_view_get]

ATSinline()
ats_void_type
atspre_stdin_view_set () {
#ifdef _ATS_RUNTIME_CHECK
  if (ats_stdin_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdin_view_set] failed\n") ;
  } // end of [if]
  ats_stdin_view_lock = 1 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stdin_view_set]

/* ****** ****** */

ATSinline()
ats_ptr_type
atspre_stdout_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stdout_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdout_get] failed\n") ;
  } // end of [if]
  ats_stdout_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return (ats_ptr_type)stdout ;
} // end of [atspre_stdout_get]

ATSinline()
ats_void_type
atspre_stdout_view_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stdout_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdout_view_get] failed\n") ;
  } // end of [if]
  ats_stdout_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stdout_view_get]

ATSinline()
ats_void_type
atspre_stdout_view_set () {
#ifdef _ATS_RUNTIME_CHECK
  if (ats_stdout_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stdout_view_set] failed\n") ;
  } // end of [if]
  ats_stdout_view_lock = 1 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stdout_view_set]

/* ****** ****** */

ATSinline()
ats_ptr_type
atspre_stderr_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stderr_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stderr_get] failed\n") ;
  } // end of [if]
  ats_stderr_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return (ats_ptr_type)stderr ;
} // end of [atspre_stderr_get]

ATSinline()
ats_void_type
atspre_stderr_view_get () {
#ifdef _ATS_RUNTIME_CHECK
  if (!ats_stderr_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, "exit(ATS): [stderr_view_get] failed\n") ;
  } // end of [if]
  ats_stderr_view_lock = 0 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stderr_view_get]

ATSinline()
ats_void_type
atspre_stderr_view_set () {
#ifdef _ATS_RUNTIME_CHECK
  if (ats_stderr_view_lock) {
    ats_exit_errmsg (EXIT_FAILURE, (ats_ptr_type)"exit(ATS): [stderr_view_set] failed\n") ;
  } // end of [if]
  ats_stderr_view_lock = 1 ;
#endif // end of [_ATS_RUNTIME_CHECK]
  return ;
} // end of [atspre_stderr_view_set]

/* ****** ****** */
//
// HX:
// printing a newline on a given stream also fflushes the buffer
// associated with the stream.
//

ATSinline()
ats_void_type
atspre_fprint_newline (
  const ats_ptr_type out
) {
  int n1, n2 ;
  n1 = fprintf((FILE*)out, "\n") ; n2 = fflush((FILE*)out) ;
#if(0) // HX: this is too much ...
  if (n1 + n2 < 0) { ats_exit_errmsg
    (EXIT_FAILURE, (ats_ptr_type)"exit(ATS): [fprint_newline] failed.\n") ;
  } // end of [if]
#endif // end of [#if(0)]
  return ;
} // end of [atspre_fprint_newline]

ATSinline()
ats_void_type
atspre_print_newline () {
  atspre_stdout_view_get() ;
  atspre_fprint_newline((ats_ptr_type)stdout) ;
  atspre_stdout_view_set() ;
  return ;
} // end of [atspre_print_newline]

ATSinline()
ats_void_type
atspre_prerr_newline () {
  atspre_stderr_view_get() ;
  atspre_fprint_newline((ats_ptr_type)stderr) ;
  atspre_stderr_view_set() ;
  return ;
} // end of [atspre_prerr_newline]

/* ****** ****** */

#endif /* ATS_PRELUDE_BASICS_CATS */