Open huangjs opened 11 years ago
It says in the specification:
field-id
specifies an index of serialized array
So, if you change all field ids to start at 0 instead of 1, it will work.
However, when mpidl encounters the nullable field flags in the first message, the C++ generator will fail, since it doesn't handle TNullable.
I installed msgpack-idl 0.2.0 using cabal, and tested it using the example in README, however the command quit with code 1 and message: "mpidl: Prelude.undefined".
I tested by outputting both cpp and python, but got same error.
Here's the log:
~/tmp> mpidl cpp -o cpp -n test foo.idl -p [MPMessage {msgName = "UserInfo", msgParam = [], msgFields = [Field {fldId = 1, fldType = TInt True 32, fldName = "uid", fldDefault = Nothing},Field {fldId = 2, fldType = TString, fldName = "name", fldDefault = Nothing},Field {fldId = 3, fldType = TNullable (TInt True 32), fldName = "flags", fldDefault = Just (LInt 1)}]},MPEnum {enumName = "Sites", enumMem = [(0,"SiteA"),(1,"SiteB"),(2,"SiteC")]},MPMessage {msgName = "LogInLog", msgParam = [], msgFields = [Field {fldId = 1, fldType = TUserDef "UserInfo" [], fldName = "user", fldDefault = Nothing},Field {fldId = 2, fldType = TUserDef "Sites" [], fldName = "site", fldDefault = Nothing}]},MPService {serviceName = "foo", serviceVersion = Nothing, serviceMethods = [Function {methodInherit = False, methodName = "login", methodRetType = TBool, methodArgs = [Field {fldId = 1, fldType = TUserDef "Sites" [], fldName = "site", fldDefault = Nothing},Field {fldId = 2, fldType = TUserDef "UserInfo" [], fldName = "user", fldDefault = Nothing}]}]}] mpidl: Prelude.undefined
Here's the foo.idl (there was an error on line 19 in the README example):
message UserInfo { 1: int uid 2: string name 3: int? flags = 1 }
enum Sites { 0: SiteA 1: SiteB 2: SiteC }
message LogInLog { 1: UserInfo user 2: Sites site }
service foo { bool login(1: Sites site, 2: UserInfo user) }
Best, Jianshi