
Dear macpaul@andestech.com,
In message 50FD90C65C53FB45BADEEBCD84FF07F202EC05C3@ATCPCS06.andestech.com you wrote:
Neither I ran the command
"tools/scripts/make-asm-offsets include/faraday/ftsmc020.h include/faraday/ftsmc020-genasm.h" nor I ran sed -ne "/^->/{s:->#(.*):/* \1 */:; \ s:^->([^ ]*) [$#]*([-0-9]*) (.*):#define \1 (\2) /* \3 */:; \ s:^->([^ ]*) [$#]*([^ ]*) (.*):#define \1 \2 /* \3 */:; \ s:->::; p;}" include/faraday/ftsmc020-genasm.h could be work.
I also tested file faraday/ftpmu010.h. It get the same output with output 'sed: -e expression #1, char 47: unknown command: `['.' Did I execute the script in wrong method? Is there a problem about this script?
There is no (known) problem with it, but you have to be careful about the context you are running in - the script as is is supposed to be run in "make" context, which means different $ expansion rules then when you try running directly under a shell.
Moreover, the structure of ftsmc020 was nested like struct ftsmc020 { struct { unsigned int cr; /* 0x00, 0x08, 0x10, 0x18 */ unsigned int tpr; /* 0x04, 0x0c, 0x14, 0x1c */ } bank[4]; unsigned int pad[8]; /* 0x20 - 0x3c */ unsigned int ssr; /* 0x40 */ };
I didn't see the sed script could support this kind of nested structure declaration. I guess the sed script could be applied to plain structure declareation. Maybe I have a diffcult here.
You could simply un-nest the structure declarations.
If the script is needed to be rewrote to adapt nested declaration, It might need have some complicaticity about parse difference kind of nested structure and array.
If I were in your situation I'd probably rather unnest the structs.
It seems I need to rewrite the structure to be adaptable to the sed script.
That seems straightforward to do, indeed.
Best regards,
Wolfgang Denk