demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Demexp-dev] XDR file compilation issue


From: David MENTRE
Subject: Re: [Demexp-dev] XDR file compilation issue
Date: Sun, 17 Apr 2005 17:52:25 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Hello Thomas,

Thomas Petazzoni <address@hidden> writes:

>   enum { b = 1, c = 1 } mytype;

Ok, let's try to match above entry with the grammar (cf. §5.3 in RFC).

      specification:
        definition *

        definition:
         type-def

         type-def:
          | "enum" identifier enum-body ";"

So your above "enum { b = 1, c = 1 } mytype;" is not matched by the
grammar. So I would said it is not valid.

You should write "enum mytype { b = 1, c = 1 } ;".

I suppose mytype is correctly defined for the following.

>   struct blabla {
>     enum mytype m;
>   };
>
>   struct toto {
>     struct blabla meuh;
>   };

      specification:
        definition *

        definition:
         type-def

         type-def:
          | "struct" identifier struct-body ";"

               struct-body:
                "{"
                    ( declaration ";" )
                    ( declaration ";" )*
                "}"

                      declaration:
                        type-specifier identifier

                        type-specifier:
                         | enum-type-spec

                           enum-type-spec:
                             "enum" enum-body

                                    enum-body:
                                     "{"
                                        ( identifier "=" value )
                                        ( "," identifier "=" value )*
                                     "}"

In the case we want do define the enum there. This is not the case in
your example.

Or, we consider we reuse an identifier.

                       type-specifier:
                        | identifier

In that case, I think you're right. We should write "mytype" instead of
"enum mytype" and "blabla" instead of "struct blabla" in the struct
declarations.




> First of all, I thought it was a bug of my RPC Generator. In fact, after
> reading RFC 1014 (http://ietf.org/rfc/rfc1014.txt), I think the problem
> is a laxism in the Ocaml RPC Generator : «struct blabla meuh» should not
> be allowed.

I think you're right within the context of a struct definition.

> The correct syntax seems to be :
>   struct blabla {
>     mytype m;
>   };

I agree.

> In this case, the «type-specifier» is simply «identifier», and it works.
>
> Similarly, one should write :
>
>   struct toto {
>     blabla meuh;
>   };

ditto.

> I am not completely sure of this, since I'm not a BNF expert, but it
> seems to be confirmed by the example in section 6 of the RFC. In this
> example, a «union filetype» is defined, and then used directly as
> «filetype» in the definition of «struct file».

I'm not an expert myself but applying by hand the grammar seems to match
your example.

> The attached dpatch fixes the problem. The XDR file still compiles with
> ocamlrpcgen, and DemExp still compiles with it. And my RPC Generator
> also compiles it ! ;-)

Ok, patch queued (or more exactly, your next email ;). As long as the
patch doesn't request a change for ocamlrpcgen, is fine for me.

> If I'm right, it may be a good idea to report a bug to the developers of
> ocamlrpcgen to tell them that their RPC generator is too laxist.

You'd better contact Gerd Stolpman yourself (feel free to reuse part of
my email if necessary). You'll find his email at this end of his page:
http://www.ocaml-programming.de/packages/documentation/rpc/

I would suggest tell him to print a warning if a current XDR def matches
the too laxist definition.

Yours,
d.
-- 
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A





reply via email to

[Prev in Thread] Current Thread [Next in Thread]