[chirp_devel] bitwise struct syntax error
I'm trying to define a block of memory that contains 5 pairs of VFO scan limits (low-high ranges). The storage is the same for the regular 750 channel memories, even though the freq field is the only significant one for the VFO scan limits..
struct channel { bbcd freq[4]; bbcd offset[4]; u8 unknownA:4, tune_step:4; ... u8 unknown24:4, scramble:4; char name[7]; ul16 custtone; }; ... #seekto 0x2000; struct channel memory[750]; ... #seekto 0x7DC0; struct { channel low_limit; channel high_limit; } vfo_scan_limits[5];
This gets me:
File "c:\proj\proj_chirp\chirp\chirp\bitwise_grammar.py", line 134, in parse return pypeg_parse(_language, FakeFileInput()) File "c:\proj\proj_chirp\chirp\chirp\pyPEG.py", line 388, in parse raise SyntaxError("syntax error in " + u(file) + ":" + File "<string>", line None SyntaxError: syntax error in input:116: channel low_limit;
Is this just a bug in the grammar? Or, is my definition of five pairs too complicated for bitwise?
Should I stick to an array of 10 scalars, and do the odd/even math in my code? Easy enough, but not nearly as elegant.
#seekto 0x7DC0; struct channel vfo_scan_limits[10];
Thanks
struct { channel low_limit; channel high_limit; } vfo_scan_limits[5];
I think your problem is that this should be "struct channel low_limit" like you do above for the memory array. In C parlance, there's no typedef of 'struct channel' to 'channel'.
Is this just a bug in the grammar? Or, is my definition of five pairs too complicated for bitwise? Should I stick to an array of 10 scalars, and do the odd/even math in my code? Easy enough, but not nearly as elegant.
I *think* you should be good (with the above) but yeah it might be pushing the limits.
--Dan
Works. Thanks.
On 6/1/2023 4:26 PM, Dan Smith via chirp_devel wrote:
struct { channel low_limit; channel high_limit; } vfo_scan_limits[5];
I think your problem is that this should be "struct channel low_limit" like you do above for the memory array. In C parlance, there's no typedef of 'struct channel' to 'channel'.
Is this just a bug in the grammar? Or, is my definition of five pairs too complicated for bitwise? Should I stick to an array of 10 scalars, and do the odd/even math in my code? Easy enough, but not nearly as elegant.
I *think* you should be good (with the above) but yeah it might be pushing the limits.
--Dan _______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
participants (2)
-
Craig Jones
-
Dan Smith