vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.04k stars 554 forks source link

Unable to get content in regionExtension J2735 example #253

Open vkooistra opened 6 years ago

vkooistra commented 6 years ago

For some reason I can't seem to be able to get regional extension open types to work. Or perhaps the open types in general i'm not sure.

Looking at issue #121 I tried compiling with the example (using J2735_201603.asn1). While it all seems so compile just fine I keep ending up with an empty ext_value union in the regionextension.h. I would expect to see the extension types there but I could be wrong for sure (for example RestrictionUserType-addGrpC or something like that along with the present flag which also remains empty).

Is there a way to fix this? Or a workaround in which the padding remains OK when encoding to UPER.

A noteworthy warning could be this one. It's a warning I didn't get using another compiler (on which I did get the regionalextensions to work.)

WARNING: Parameterized type REG-EXT-ID-AND-TYPE expected for REG-EXT-ID-AND-TYPE at line 125 in ../J2735_201603.asn1

edit: the above was performed at the master branch of the post date

brchiu commented 6 years ago

hi, @vkooistra,

Could you have a trial to merge #234 ?

In that pull request, I have a commit https://github.com/vlm/asn1c/pull/234/commits/988f64776f97c14cadf6e586728a157336721a69 which tries to solve some problems I found. You can ignore the last commit of this pull request because it will change name of some generated structures.

vkooistra commented 6 years ago

After merging the pull request the largest part it is working fine (except from my old crappy compiler not liking empty unions, but that's ok).

There is one particular case what does give problems. That is if I use a regional extension containing another regional extension. This seems to end up in not defined structs (probably due to circular references).

While I don't actually need the nested extensions and can just edit them out, it is obviously worth mentioning as it can occur.

brchiu commented 6 years ago

@vkooistra, there is a command line option of asn1c called -findirect-choice which perhaps can solve this circular reference problem, though with the price that application code need access choice type fields through pointer, that's why called indirect-choice.

qswawrq commented 6 years ago

@brchiu Hi. I am also trying to add some regional extension on J2735. I use your commit 988f647, but I still have an empty union for choice in the struct RegionalExtension_99P0 of RegionalExtension.h. And my warnings are something like:

WARNING: Parameterized type REG-EXT-ID-AND-TYPE expected for REG-EXT-ID-AND-TYPE at line 100 in .../J2735_201603.asn1

or

WARNING: Parameterized type PARTII-EXT-ID-AND-TYPE expected for PARTII-EXT-ID-AND-TYPE at line 127 in .../J2735_201603.asn1
vkooistra commented 6 years ago

I had the same warnings. After a while I figured they occur when an extension is compiler which leads to a stub. So in my case the issue (well not realy an issue, just a warning) was asn1 file sided

qswawrq commented 6 years ago

@vkooistra Thank you for your response, but I am not sure I follow. Back to the problem of empty RegionalExtension, we should expect to see some enums in RegionalExtension.h, right?

typedef enum RegionalExtension_99P0__regExtValue_PR {
    RegionalExtension_99P0__regExtValue_PR_NOTHING, /* No components present */

} RegionalExtension_99P0__regExtValue_PR;

Since the message frame and regional extension were defined in a very similar way, I expect to see some types just as I saw different message type in the enum of MessageFrame.h. I only know a little in ASN1, so let me know if I misunderstand anything.