Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/vis15/src/compiler/cfg-ir/border-ctl.sml
ViewVC logotype

Annotation of /branches/vis15/src/compiler/cfg-ir/border-ctl.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3470 - (view) (download)

1 : jhr 3470 (* border-ctl.sml
2 :     *
3 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 :     * All rights reserved.
7 :     *
8 :     * Image boarder controls. I.e., what to do when an image index is out of bounds.
9 :     *)
10 :    
11 :     structure BorderCtl =
12 :     struct
13 :    
14 :     datatype 'var ctl
15 :     = None (* default behavior is to not check for control *)
16 :     | Default of 'var (* uses default value for out-of-bounds indices *)
17 :     | Index of IndexCtl.ctl (* control by remapping index *)
18 :    
19 :     val clamp = Index IndexCtl.Clamp (* clamp indices to image dimensions *)
20 :     val mirror = Index IndexCtl.Mirror (* reflect indices at border *)
21 :     val wrap = Index IndexCtl.Wrap (* wrap indices at border *)
22 :    
23 :     fun fmt _ None = "None"
24 :     | fmt v2s (Default x) = concat["Default(", v2s x, ")"]
25 :     | fmt _ (Index ctl) = IndexCtl.toString ctl
26 :    
27 :     fun map f ctl = (case ctl
28 :     of None => None
29 :     | Default x => Default(f x)
30 :     | Index ctl => Index ctl
31 :     (* end case *))
32 :    
33 :     end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0