Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/instructions/labels.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/instructions/labels.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 430 - (download) (annotate)
Wed Sep 8 09:47:00 1999 UTC (19 years, 11 months ago) by monnier
File size: 899 byte(s)
This commit was generated by cvs2svn to compensate for changes in r429,
which included commits to RCS files with non-trunk default branches.
(* labels.sml
 *
 * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
 *
 *)

signature LABEL =
  sig
    datatype label = Label of {id : int, addr : int ref, name:string}

    val newLabel : string -> label
    val nameOf   : label -> string
    val id       : label -> int
    val addrOf   : label -> int
    val reset	 : unit -> unit
    val setAddr  : label * int -> unit
  end


structure Label : LABEL =
  struct
    datatype label = Label of {id:int, addr:int ref, name:string}

    val cnt 		           = ref 0

    fun newLabel name = 
    let val id = !cnt
    in  cnt := id + 1; Label{id=id, addr=ref ~1, name=name} end
    fun nameOf(Label{id,name="",...})   = "LL" ^ Int.toString id
      | nameOf(Label{name, ...}) = name
    fun id(Label{id,...})          = id
    fun addrOf(Label{addr,...})    = !addr
    fun setAddr(Label{addr,...},n) = addr := n
    fun reset() 		   = cnt := 0
  end



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