Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000463OCamlCamlIDLpublic2001-07-31 13:522002-01-15 16:28
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000463: camlidl: union-name in the discriminated union declaration
DescriptionHere is the patch adding support for optional "union-name" parameter in IDL
union definition according to Microsoft specs:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/midl/hh/midl/mi-laref_76i6.asp [^]

[---cut---]
Index: compiler/parse_aux.ml
===================================================================
RCS file: /caml/bazar-ocaml/camlidl/compiler/parse_aux.ml,v
retrieving revision 1.13
diff -u -r1.13 parse_aux.ml
--- compiler/parse_aux.ml 2001/07/30 14:45:40 1.13
+++ compiler/parse_aux.ml 2001/07/31 09:36:03
@@ -263,14 +263,14 @@
 let make_fields attrs tybase decls =
   List.map (make_field attrs tybase) decls
 
-let make_discriminated_union name switch_name switch_type body =
+let make_discriminated_union name union_name switch_name switch_type body =
   let ty_union =
     Type_union({ud_name = ""; ud_mod = ""; ud_stamp = 0; ud_cases = body},
                {discriminant = Expr_ident switch_name}) in
   { sd_name = name; sd_mod = ""; sd_stamp = 0;
     sd_fields = [ {field_name = switch_name; field_mlname = switch_name;
                    field_typ = switch_type};
- {field_name = "u"; field_mlname = "u";
+ {field_name = union_name; field_mlname = union_name;
                    field_typ = ty_union} ] }
 
 let type_names =
Index: compiler/parse_aux.mli
===================================================================
RCS file: /caml/bazar-ocaml/camlidl/compiler/parse_aux.mli,v
retrieving revision 1.8
diff -u -r1.8 parse_aux.mli
--- compiler/parse_aux.mli 2001/06/29 13:30:00 1.8
+++ compiler/parse_aux.mli 2001/07/31 09:36:53
@@ -58,6 +58,7 @@
 val make_discriminated_union :
   string ->
   string ->
+ string ->
   idltype -> union_case list -> struct_decl
     (* Convert a union switch(...) into a struct encapsulating an union *)
 val type_names : StringSet.t ref
Index: compiler/parser_midl.mly
===================================================================
RCS file: /caml/bazar-ocaml/camlidl/compiler/parser_midl.mly,v
retrieving revision 1.16
diff -u -r1.16 parser_midl.mly
--- compiler/parser_midl.mly 2001/06/29 13:30:00 1.16
+++ compiler/parser_midl.mly 2001/07/31 09:37:00
@@ -333,12 +333,18 @@
 
 /* Struct declaration and discriminated unions */
 
+union_name:
+ ident
+ { $1 }
+ | /* empty */
+ { "u" }
+;
 struct_declarator:
     STRUCT opt_ident LBRACE field_declarators RBRACE
         { {sd_name = $2; sd_mod = ""; sd_stamp = 0; sd_fields = $4} }
- | UNION opt_ident SWITCH LPAREN simple_type_spec ident RPAREN
+ | UNION opt_ident SWITCH LPAREN simple_type_spec ident RPAREN union_name
     LBRACE union_body RBRACE
- { make_discriminated_union $2 $6 $5 (List.rev $9) }
+ { make_discriminated_union $2 $8 $6 $5 (List.rev $10) }
 ;
 field_declarators:
     field_declarator
[---cut---]

Microsoft uses that intensively (see also my last followup to PR 0000410)

Hope to hear from you soon,
Dmitry


TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000067)
administrator (administrator)
2002-01-15 16:28

Suggested patch applied 2002-01-15 by XL

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker