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

SCM Repository

[smlnj] Diff of /sml/trunk/src/ml-nlffigen/spec.sml
ViewVC logotype

Diff of /sml/trunk/src/ml-nlffigen/spec.sml

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

revision 975, Wed Oct 31 20:22:44 2001 UTC revision 1011, Thu Jan 10 20:22:04 2002 UTC
# Line 32  Line 32 
32      type field = { name: string, spec: fieldspec }      type field = { name: string, spec: fieldspec }
33    
34      type s =      type s =
35           { tag: tag, anon: bool, size: word, fields: field list }           { src: string,
36               tag: tag, anon: bool, size: word, fields: field list }
37      type u =      type u =
38           { tag: tag, anon: bool, size: word, largest: field, all: field list }           { src: string,
39               tag: tag, anon: bool, size: word, largest: field, all: field list }
40    
41      type gvar = { name: string, spec: cobj }      type gvar = { src: string, name: string, spec: cobj }
42    
43      type gfun = { name: string, spec: cft, argnames: string list option }      type gfun = { src: string,
44                      name: string, spec: cft, argnames: string list option }
45    
46      type gty = { name: string, spec: ctype }      type gty = { src: string, name: string, spec: ctype }
47    
48      type enum = { name: string, spec: LargeInt.int }      type enumval = { name: string, spec: LargeInt.int }
49    
50        type enum = { src: string, tag: tag, spec: enumval list }
51    
52      type spec = { structs: s list,      type spec = { structs: s list,
53                    unions: u list,                    unions: u list,
# Line 50  Line 55 
55                    gvars: gvar list,                    gvars: gvar list,
56                    gfuns: gfun list,                    gfuns: gfun list,
57                    enums: enum list }                    enums: enum list }
58    
59        fun join (x: spec, y: spec) = let
60            fun uniq sel = let
61                fun loop ([], a) = rev a
62                  | loop (h :: t, a) =
63                    loop (t, if List.exists (fn x => sel x = sel h) a then a
64                             else h :: a)
65            in
66                loop
67            end
68        in
69            { structs = uniq #tag (#structs x, #structs y),
70              unions = uniq #tag (#unions x, #unions y),
71              gtys = uniq #name (#gtys x, #gtys y),
72              gvars = uniq #name (#gvars x, #gvars y),
73              gfuns = uniq #name (#gfuns x, #gfuns y),
74              enums = uniq #tag (#enums x, #enums y) } : spec
75        end
76    
77        val empty : spec = { structs = [], unions = [], gtys = [], gvars = [],
78                             gfuns = [], enums = [] }
79  end  end

Legend:
Removed from v.975  
changed lines
  Added in v.1011

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