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

SCM Repository

[smlnj] Annotation of /sml/trunk/ckit/src/ast/ctype-eq.sml
ViewVC logotype

Annotation of /sml/trunk/ckit/src/ast/ctype-eq.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 975 - (view) (download)

1 : dbm 597 (* Copyright (c) 1998 by Lucent Technologies *)
2 :    
3 :     (* equality for ctype datatype (defined in ast.sml) *)
4 :     structure CTypeEq =
5 :     struct
6 :     open Ast
7 :     fun eqStorageClass(AUTO, AUTO) = true
8 :     | eqStorageClass(EXTERN, EXTERN) = true
9 :     | eqStorageClass(REGISTER, REGISTER) = true
10 :     | eqStorageClass(STATIC, STATIC) = true
11 :     | eqStorageClass(DEFAULT, DEFAULT) = true
12 :     | eqStorageClass _ = false
13 :    
14 :     fun eqQualifier(CONST, CONST) = true
15 :     | eqQualifier(VOLATILE, VOLATILE) = true
16 :     | eqQualifier _ = false
17 :    
18 :     fun eqSignedness(SIGNED, SIGNED) = true
19 :     | eqSignedness(UNSIGNED, UNSIGNED) = true
20 :     | eqSignedness _ = false
21 :    
22 :     fun eqIntKind(CHAR, CHAR) = true
23 :     | eqIntKind(SHORT, SHORT) = true
24 :     | eqIntKind(INT, INT) = true
25 :     | eqIntKind(LONG, LONG) = true
26 :     | eqIntKind(LONGLONG, LONGLONG) = true
27 :     | eqIntKind(FLOAT, FLOAT) = true
28 :     | eqIntKind(DOUBLE, DOUBLE) = true
29 :     | eqIntKind(LONGDOUBLE, LONGDOUBLE) = true
30 :     | eqIntKind _ = false
31 :    
32 :     fun eqFractionality(FRACTIONAL, FRACTIONAL) = true
33 :     | eqFractionality(WHOLENUM, WHOLENUM) = true
34 :     | eqFractionality _ = false
35 :    
36 :     fun eqSaturatedness(SATURATE, SATURATE) = true
37 :     | eqSaturatedness(NONSATURATE, NONSATURATE) = true
38 :     | eqSaturatedness _ = false
39 :    
40 :     fun eqCType(Void, Void) = true
41 :     | eqCType(Ellipses, Ellipses) = true
42 :     | eqCType(Qual(q1, ct1), Qual(q2, ct2)) = eqQualifier(q1, q2) andalso eqCType(ct1, ct2)
43 :     | eqCType(Numeric x1, Numeric x2) = (x1 = x2)
44 :     | eqCType(Array(SOME(i1, _), ct1), Array(SOME(i2, _), ct2)) = (i1=i2) andalso eqCType(ct1, ct2)
45 :     | eqCType(Pointer ct1, Pointer ct2) = eqCType(ct1, ct2)
46 :     | eqCType(Function(ct1, ctl1), Function(ct2, ctl2)) = eqCType(ct1, ct2) andalso eqCTypeList(ctl1, ctl2)
47 :     | eqCType(StructRef tid1, StructRef tid2) = (tid1 = tid2)
48 :     | eqCType(UnionRef tid1, UnionRef tid2) = (tid1 = tid2)
49 :     | eqCType(EnumRef tid1, EnumRef tid2) = (tid1 = tid2)
50 :     | eqCType(TypeRef tid1, TypeRef tid2) = (tid1 = tid2)
51 :     | eqCType(Error, Error) = true
52 :     | eqCType _ = false
53 :    
54 : blume 975 and eqCTypeList((ct1, _) :: ctl1, (ct2, _) :: ctl2) =
55 :     eqCType(ct1, ct2) andalso eqCTypeList(ctl1, ctl2)
56 : dbm 597 | eqCTypeList(nil, nil) = true
57 :     | eqCTypeList _ = false
58 :    
59 :     end

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