Annotation of researchv10no/cmd/sml/src/env/namespace.sml, revision 1.1.1.1

1.1       root        1: (* Copyright 1989 by AT&T Bell Laboratories *)
                      2: (* namespace.sml *)
                      3: 
                      4: structure NameSpace: NAMESPACE =
                      5: struct
                      6: 
                      7:   open Symbol
                      8: 
                      9:   (* there are 7 namespaces, numbered 0 to 6 *)
                     10:   val namespaces = 7
                     11:   val varSpace = 0
                     12:   val tycSpace = 1
                     13:   val tyvSpace = 2
                     14:   val sigSpace = 3
                     15:   val strSpace = 4
                     16:   val fctSpace = 5
                     17:   val fixSpace = 6
                     18: 
                     19:   fun varIndex(id: symbol) = number(id)*namespaces
                     20:   fun conIndex(id: symbol) = number(id)*namespaces
                     21:   fun tycIndex(id: symbol) = number(id)*namespaces+1
                     22:   fun tyvIndex(id: symbol) = number(id)*namespaces+2
                     23:   fun sigIndex(id: symbol) = number(id)*namespaces+3
                     24:   fun strIndex(id: symbol) = number(id)*namespaces+4
                     25:   fun fctIndex(id: symbol) = number(id)*namespaces+5
                     26:   fun fixIndex(id: symbol) = number(id)*namespaces+6
                     27: 
                     28:   fun varKey(id: symbol) = (number(id)*namespaces, name(id))
                     29:   fun conKey(id: symbol) = (number(id)*namespaces, name(id))
                     30:   fun tycKey(id: symbol) = (number(id)*namespaces+1, name(id))
                     31:   fun tyvKey(id: symbol) = (number(id)*namespaces+2, name(id))
                     32:   fun sigKey(id: symbol) = (number(id)*namespaces+3, name(id))
                     33:   fun strKey(id: symbol) = (number(id)*namespaces+4, name(id))
                     34:   fun fctKey(id: symbol) = (number(id)*namespaces+5, name(id))
                     35:   fun fixKey(id: symbol) = (number(id)*namespaces+6, name(id))
                     36: 
                     37:   fun key(namespace:int, id:symbol) = 
                     38:       (namespaces*(number id)+namespace, name id)
                     39: 
                     40: end (* NameSpace *)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.