File: reference.dats

package info (click to toggle)
ats2-lang 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 40,064 kB
  • sloc: ansic: 389,637; makefile: 7,123; lisp: 812; sh: 657; php: 573; python: 387; perl: 365
file content (69 lines) | stat: -rw-r--r-- 1,221 bytes parent folder | download | duplicates (4)
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
(*
** For writing ATS code
** that translates into Python
*)

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

#define ATS_DYNLOADFLAG 0

(* ****** ****** *)
//
// HX-2014-08:
// prefix for external names
//
#define
ATS_EXTERN_PREFIX "ats2pypre_"
#define
ATS_STATIC_PREFIX "_ats2pypre_reference_"
//
(* ****** ****** *)
//
#staload
UN = "prelude/SATS/unsafe.sats"
//
(* ****** ****** *)
//
#staload "./../basics_py.sats"
#staload "./../SATS/PYlist.sats"
#staload "./../SATS/reference.sats"
//
(* ****** ****** *)
//
(*
assume
ref_vt0ype_type(a:t@ype) = PYlist(a)
*)
//
(* ****** ****** *)
(*
//
implement
ref{a}(x) = $UN.cast{ref(a)}(PYlist_sing(x))
implement
ref_make_elt{a}(x) = $UN.cast{ref(a)}(PYlist_sing(x))
//
implement
ref_get_elt{a}(r) = let
  val r = $UN.cast{PYlist(a)}(r) in PYlist_get_at(r, 0)
end // end of [ref_get_elt]
//
implement
ref_set_elt{a}(r, x0) = let
  val r = $UN.cast{PYlist(a)}(r) in PYlist_set_at(r, 0, x0)
end // end of [ref_set_elt]
//
implement
ref_exch_elt{a}(r, x0) = let
  val r =
    $UN.cast{PYlist(a?)}(r)
  // end of [val]
  val x1 = PYlist_get_at(r, 0)
in
  PYlist_set_at(r, 0, $UN.castvwtp0{a?}(x0)); $UN.castvwtp0{a}(x1)
end // end of [ref_exch_elt]
//
*)
(* ****** ****** *)

(* end of [reference.dats] *)