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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3886 - (download) (annotate)
Fri May 20 15:10:11 2016 UTC (3 years, 2 months ago) by jhr
File size: 1023 byte(s)
working on merge
(* border-ctl.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *
 * Image boarder controls.  I.e., what to do when an image index is out of bounds.
 *)

structure BorderCtl =
  struct

    datatype 'var ctl
      = None			(* default behavior is to not check for control *)
      | Default of 'var		(* uses default value for out-of-bounds indices *)
      | Index of IndexCtl.t	(* control by remapping index *)

    val clamp = Index IndexCtl.Clamp	(* clamp indices to image dimensions *)
    val mirror = Index IndexCtl.Mirror	(* reflect indices at border *)
    val wrap = Index IndexCtl.Wrap	(* wrap indices at border *)

    fun fmt _ None = "None"
      | fmt v2s (Default x) = concat["Default(", v2s x, ")"]
      | fmt _ (Index ctl) = IndexCtl.toString ctl

    fun map f ctl = (case ctl
	   of None => None
	    | Default x => Default(f x)
	    | Index ctl => Index ctl
	  (* end case *))

  end

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