20 |
| T_Image of int (* n-dimensional image data *) |
| T_Image of int (* n-dimensional image data *) |
21 |
| T_Data (* pointer to image data *) |
| T_Data (* pointer to image data *) |
22 |
|
|
|
type program = CL.decl list |
|
|
|
|
23 |
type strand = unit (* FIXME *) |
type strand = unit (* FIXME *) |
24 |
|
|
25 |
type var = (ty * string) (* FIXME *) |
type var = (ty * string) (* FIXME *) |
30 |
|
|
31 |
type method = unit (* FIXME *) |
type method = unit (* FIXME *) |
32 |
|
|
33 |
|
datatype program = Prog of { |
34 |
|
globals : CL.decl list ref, |
35 |
|
strands : strand list ref |
36 |
|
} |
37 |
|
|
38 |
|
fun newProgram () = Prog{ |
39 |
|
globals = ref [], |
40 |
|
strands = ref [] |
41 |
|
} |
42 |
|
|
43 |
(* globals that specify the target characteristics. These should be initialized |
(* globals that specify the target characteristics. These should be initialized |
44 |
* when the program object is created. |
* when the program object is created. |
45 |
*) |
*) |
250 |
fun stabilize () = raise Fail "FIXME: Stmt.die" |
fun stabilize () = raise Fail "FIXME: Stmt.die" |
251 |
end |
end |
252 |
|
|
253 |
|
fun generate (baseName, Prog{globals, strands}) = let |
254 |
|
val fileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "c"} |
255 |
|
val outS = TextIO.openOut fileName |
256 |
|
val ppStrm = PrintAsC.new outS |
257 |
|
in |
258 |
|
List.app (fn dcl => PrintAsC.output(ppStrm, dcl)) (!globals); |
259 |
|
(* what about the strands, etc? *) |
260 |
|
PrintAsC.close ppStrm; |
261 |
|
TextIO.closeOut outS |
262 |
|
end |
263 |
|
|
264 |
end |
end |
265 |
|
|
266 |
structure CBackEnd = CodeGenFn(CTarget) |
structure CBackEnd = CodeGenFn(CTarget) |