Mercurial > urweb
comparison src/cjr_print.sml @ 1257:fd1a49b51db5
Fix C-mangling of datatype names
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 16 May 2010 15:34:24 -0400 |
parents | 69f1d39d3f2d |
children | be2ef50780ed |
comparison
equal
deleted
inserted
replaced
1256:d7d5b167f267 | 1257:fd1a49b51db5 |
---|---|
77 string "__uws_", | 77 string "__uws_", |
78 string (Int.toString i)] | 78 string (Int.toString i)] |
79 | TDatatype (Enum, n, _) => | 79 | TDatatype (Enum, n, _) => |
80 (box [string "enum", | 80 (box [string "enum", |
81 space, | 81 space, |
82 string ("__uwe_" ^ #1 (E.lookupDatatype env n) ^ "_" ^ Int.toString n)] | 82 string ("__uwe_" ^ ident (#1 (E.lookupDatatype env n)) ^ "_" ^ Int.toString n)] |
83 handle CjrEnv.UnboundNamed _ => string ("__uwd_UNBOUND__" ^ Int.toString n)) | 83 handle CjrEnv.UnboundNamed _ => string ("__uwd_UNBOUND__" ^ Int.toString n)) |
84 | TDatatype (Option, n, xncs) => | 84 | TDatatype (Option, n, xncs) => |
85 (case ListUtil.search #3 (!xncs) of | 85 (case ListUtil.search #3 (!xncs) of |
86 NONE => raise Fail "CjrPrint: TDatatype marked Option has no constructor with an argument" | 86 NONE => raise Fail "CjrPrint: TDatatype marked Option has no constructor with an argument" |
87 | SOME t => | 87 | SOME t => |
91 box [p_typ' par env t, | 91 box [p_typ' par env t, |
92 string "*"]) | 92 string "*"]) |
93 | TDatatype (Default, n, _) => | 93 | TDatatype (Default, n, _) => |
94 (box [string "struct", | 94 (box [string "struct", |
95 space, | 95 space, |
96 string ("__uwd_" ^ #1 (E.lookupDatatype env n) ^ "_" ^ Int.toString n ^ "*")] | 96 string ("__uwd_" ^ ident (#1 (E.lookupDatatype env n)) ^ "_" ^ Int.toString n ^ "*")] |
97 handle CjrEnv.UnboundNamed _ => string ("__uwd_UNBOUND__" ^ Int.toString n)) | 97 handle CjrEnv.UnboundNamed _ => string ("__uwd_UNBOUND__" ^ Int.toString n)) |
98 | TFfi (m, x) => box [string "uw_", p_ident m, string "_", p_ident x] | 98 | TFfi (m, x) => box [string "uw_", p_ident m, string "_", p_ident x] |
99 | TOption t => | 99 | TOption t => |
100 if isUnboxable t then | 100 if isUnboxable t then |
101 p_typ' par env t | 101 p_typ' par env t |