CVS: sml-dist/src/compiler/ElabData/basics primopid.sig, NONE, 1.1.2.1 primopid.sml, NONE, 1.1.2.1

George Kuan <[email protected]> Thu, 06 Jul 2006 09:35:40 -0700
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml-dist/src/compiler/ElabData/basics
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv2289/src/compiler/ElabData/basics

Added Files:
      Tag: primop-branch-2
	primopid.sig primopid.sml 
Log Message:
Moving to new PrimOpId instead of InlInfo (int based primop id scheme)

--- NEW FILE: primopid.sig ---
(* primopid.sig
 *
 * (C) 2001 Lucent Technologies, Bell Labs
 *)

signature PRIMOPID =
sig

    type primId
    type strElemPrimIds

(*
    val match : inl_info ->
		{ inl_prim: PrimOp.primop * Types.ty -> 'a,
		  inl_str: inl_info list -> 'a,
		  inl_no: unit -> 'a } ->
		'a

    val prInfo : inl_info -> string

    val isPrimop : primId -> bool
    val selStrInfo : inl_info * int -> inl_info

    val isPrimCallcc : inl_info -> bool
    val isPrimCast : inl_info -> bool

    val mkPrimInfo : PrimOp.primop * Types.ty -> inl_info
    val mkStrInfo : inl_info list -> inl_info
    val nullInfo : inl_info

    val primopTy : inl_info -> Types.ty option
 *)
end (* signature INL_INFO *)

--- NEW FILE: primopid.sml ---
(* primopid.sml
 *
 * (C) 2001 Lucent Technologies, Bell Labs
 *)

(* [dbm, 6/19/06]
     Folded ii.sml into this structure, eliminating exn hack.
     Changed name of pureInfo to isPrimCast.
     Eliminated redundant INL_PRIM, INL_STR, INL_NO. *)

structure PrimOpId : PRIMOPID = 
struct

    fun bug s = ErrorMsg.impossible ("PrimOpId: " ^ s)

    datatype primId = Prim of int | NonPrim
    datatype strElemPrimIds = PrimE of primId
                            | StrE of strInfo
    withtype strInfo = strElemPrimIds list


    fun isPrimop (Prim _) = true
      | isPrimop NonPrim  = false
(* 
    fun selStrInfo (StrE l, i) =
	(List.nth (l, i) handle Subscript => bug "Wrong field in List")
      | selStrInfo (Null, _) = Null
      | selStrInfo (Info _, i) = bug "Unexpected selection from Info"
   

    fun match i { inl_prim, inl_str, inl_no } =
	case i
	  of Info x => inl_prim x
	   | List l => inl_str l
	   | Null => inl_no ()

    fun prInfo i = let
	fun loop (i, acc) =
	    case i
              of Info (p,_) => PrimOp.prPrimop p :: acc
	       | Null => "<InlNo>" :: acc
	       | List m => 
                 (case m
                   of [] => "{}" :: acc
		    | h::t =>
		      "{" :: loop (h,foldr (fn (x, a) => "," :: loop (x, a))
                                           ("}" :: acc)
					   t))
    in
	concat (loop (i, []))
    end

    fun isPrimCallcc (Info ((PrimOp.CALLCC | PrimOp.CAPTURE), _)) = true
      | isPrimCallcc _ = false

    fun isPrimCast (Info (PrimOp.CAST, _)) = true
      | isPrimCast _ = false

    val mkPrimInfo = Info
    val mkStrInfo = List
    val nullInfo = Null

    fun primopTy (Info (_, ty)) = SOME ty
      | primopTy _ = NONE
 *)
end (* structure InlInfo *)


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642