File: codegen2.sats

package info (click to toggle)
ats2-lang 0.4.2-4
  • links: PTS
  • area: main
  • in suites:
  • size: 40,524 kB
  • sloc: ansic: 389,898; makefile: 7,138; javascript: 1,852; lisp: 811; sh: 657; php: 573; python: 387; perl: 365
file content (145 lines) | stat: -rw-r--r-- 3,895 bytes parent folder | download | duplicates (6)
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
(***********************************************************************)
(*                                                                     *)
(*                         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.
*)

(* ****** ****** *)
//
// Author of the file:
// Hongwei Xi (gmhwxiATgmailDOTcom)
// Start Time: August, 2016
//
(* ****** ****** *)
//
// HX: For programming productivity, my bet is on meta-programming...
//
(* ****** ****** *)
//
// HX-2016-08-24:
// For #codegen2(absrec, ...)
//
abstype absrec_get(t0ype)
abstype absrec_set(t0ype)
abstype absrec_getset(t0ype)
//
abstype absrec_exch(vt0ype)
//
(*
abstype absrec_vtget0(vt0ype)
abstype absrec_vtget1(vt0ype)
*)
//
abstype absrec_getref(vt0ype)
//
// HX-2016-08-28:
// [getset] means both [get] and [set]
//
typedef get(a:t0ype) = absrec_get(a)
typedef set(a:t0ype) = absrec_set(a)
typedef getset(a:t0ype) = absrec_getset(a)
//
typedef exch(a:vt0ype) = absrec_exch(a)
//
(*
typedef vtget0(a:vt0ype) = absrec_vtget0(a)
typedef vtget1(a:vt0ype) = absrec_vtget1(a)
*)
//
typedef getref(a:vt0ype) = absrec_getref(a)
//
(* ****** ****** *)
//
typedef
absrec_get_fun_type
  (trec:type, res:t0ype) = (trec) -<0,!ref> (res)
typedef
absrec_set_fun_type
  (trec:type, res:t0ype) = (trec, res) -<0,!refwrt> void
typedef
absrec_exch_fun_type
  (trec:type, res:vt0ype) = (trec, res) -<0,!refwrt> (res)
typedef
absrec_getref_fun_type
  (trec:type, res:vt0ype) = (trec) -<0,!ref> vtakeoutptr(res)
//
(* ****** ****** *)
//
typedef
absrec_get_fun_vtype
  (trec:vtype, res:t0ype) = (!trec) -<fun> (res)
typedef
absrec_set_fun_vtype
  (trec:vtype, res:t0ype) = (!trec, res) -<0,!wrt> void
typedef
absrec_exch_fun_vtype
  (trec:vtype, res:vt0ype) = (!trec, res) -<0,!wrt> (res)
typedef
absrec_getref_fun_vtype
  (trec:vtype, res:vt0ype) = (!trec) -<0,!wrt> vtakeoutptr(res)
//
(*
typedef
absrec_vtget0_fun_vtype
  (trec:vtype, res: vt0ype) =
  (!trec >> minus_vt(trec, res)) -<fun> res
typedef
absrec_vtget1_fun_vtype
  (trec:vtype, res: vt0ype) =
  (!trec, res) -<fun> (minus_v(trec, res) | res)
*)
//
(* ****** ****** *)
//
typedef
absrec_get_fun_t0ype
  (trec:t0ype, res:t0ype) = (&trec) -<fun> (res)
typedef
absrec_set_fun_t0ype
  (trec:t0ype, res:t0ype) = (&trec, res) -<0,!wrt> void
typedef
absrec_exch_fun_t0ype
  (trec:t0ype, res:vt0ype) = (&trec, res) -<0,!wrt> (res)
typedef
absrec_getref_fun_t0ype
  (trec:t0ype, res:vt0ype) = (&trec) -<0,!wrt> vtakeoutptr(res)
//
(* ****** ****** *)
//
typedef
absrec_get_fun_vt0ype
  (trec:vt0ype, res:t0ype) = (&trec) -<fun> (res)
typedef
absrec_set_fun_vt0ype
  (trec:vt0ype, res:t0ype) = (&trec, res) -<0,!wrt> void
typedef
absrec_exch_fun_vt0ype
  (trec:vt0ype, res:vt0ype) = (&trec, res) -<0,!wrt> (res)
typedef
absrec_getref_fun_vt0ype
  (trec:vt0ype, res:vt0ype) = (&trec) -<0,!wrt> vtakeoutptr(res)
//
(* ****** ****** *)

(* end of [codegen2.sats] *)