summaryrefslogtreecommitdiff
path: root/regen/HeaderParser.pm
Commit message (Collapse)AuthorAgeFilesLines
* regen/HeaderParser.pm - improved expression formatting and wrappingYves Orton2023-04-051-64/+285
| | | | | | | | | | | | | | | Karl complained about some of the wrapping logic we use for expressions. This tweaks the rules in a number of different ways in an attempt to produce more legible expressions. For instance if we have a complex expression with different parenthesized sub expressions, then try to put each sub expression on its own line. A previous patch ensures that we put shorter sub expressions first, and this patch builds on that to put each sub expression on its own line. We also use different logic to wrap the expressions, with the end result that each line should have the same number of defined() operations on it (with the exception of the last). We also try harder to line up logical operators and defined() functions.
* regen/HeaderParser.pm - remove comments from elif/else/endif when the ↵Yves Orton2023-04-051-32/+68
| | | | | | | | | contents is short it is a bit "noisy" to have comments that duplication the conditions when the original line with the condition is visible on the screen at the same time. this patch changes the rules so we only add these comments when the clause is 10 lines or more from its prior
* regen/HeaderParser.pm - with multi-term expressions put least firstYves Orton2023-04-051-1/+10
| | | | | if we have defined(X) && (defined(Y) || defined(Z)) put the defined(X) first because it has less operations in it.
* embed.pl - sort and dedupe flags in embef.fnc as part of tidyYves Orton2023-02-191-2/+16
| | | | | | | | | | | | | | | | | | | This ensures we use a canonical string for each possible flag variant, which makes it easier to search for flags with a given flag signature. It also exposed a mutex bug in flag handling which caused PerlEnv_putenv to be improperly marked as static, when it is in fact static inline. To validate there aren't any issues like this remaining in the script I set it up so the flags were shuffled during processing and ran embed.pl in a loop for a while and none of the output files changed, so I assume there are no further such issues. This patch also includes some basic validation of the flags so that if someone misses a line continuation the following lines are not treated as a new definition without any flags. I also ran perltidy on it according to the rules contained within the file.
* regen/embed_lib.pl - don't add integer to reference and fixup source dataYves Orton2023-01-041-1/+7
| | | | | | | Dave noticed there was a bug where I was adding a reference to an integer. That did not make any sense. This patch fixes up the data so the source of the line is more clear. I will do a further follow up to improve this more, this is just to get the bug out of the way.
* regen/HeaderParser.pm - A module to parse our header filesYves Orton2022-12-241-0/+1553
Consistent proper header file parsing with an OO interface. There are various traps and zaps parsing header files, such as line continuations, and multiline comments acting as a line continuation. There are also issues that the naive may overlook such as indented preprocessor directives, and such things. There are also some specialized tasks which we perform to construct header files from other header files, such as grouping content under similar guard clauses together, normalizing guard clauses, and the like. HeaderParser provides an API to handle these issues. The code which needs to read header files, or write header files, can use the HeaderParser to group and normalize the content they are reading or writing. This also frees the code generators from needing to worry about indentation, or such artifacts, HeaderParser normalizes it all away. This patch includes migrating everything to use the new infra, but it does not include some of the changes that would come with that new infra, so it would not pass test on THIS commit. Running make regen should "fix" this, although it is deliberate to make rebasing the branch easier. One of the notable changes in this commit is that embed.fnc is now under control of `make regen` (even though it is an input to `make regen`) and any changes will be automatically tied by running it, even if those changes also trigger other changes. HeaderParser sits underneath it all, so there is no chicken and egg problem that would require running `make regen` twice, the output of processing the modified embed.fnc would be identical to the output of processing the original. fixup