The ewoc structure for diff/status fileinfo is something like this:

Element is one of:
  (file dvc-status-fileinfo)
  (dir  dvc-status-fileinfo)
  (message \"<message>\")

In Ada, I would represent this with a discriminant record:

type Ewoc_Element_type (Label : ewoc_element_label_type)  is record
    case label is
    when file | dir =>
        file_dir_data : fileinfo_type;

    when message =>
        message_data : ada.strings.unbounded.unbounded_string;

    end case;
end record;

Then in code I would do:

declare
    Elem : ewoc_element_type := ewoc_data (ewoc_locate (ewoc));
begin
    case Elem.Label is
    when File =>
        ...
    when Dir =>
        ...
    when Message =>
        ...
    end case;
end;

Using Emacs CL ecase, I can get close to the code part, except for the
'Elem.Label'. And there is no structure similar to the declaration of
Ewoc_Element_type; just comments.

In C, this would be a union type, with a tag field that is present in
each case of the union.

Is there something similar in Emacs CL? I looked thru the CL manual in
Emacs info, and didn't see anything.

--
-- Stephe


_______________________________________________
Dvc-dev mailing list
[email protected]
https://mail.gna.org/listinfo/dvc-dev

Reply via email to