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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/IL/border-ctl.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/IL/border-ctl.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.3071  
changed lines
  Added in v.3072

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