Thanks. (I'm a lazy son of a gun!) Charles
-----Original Message----- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Walt Farrell Sent: Wednesday, July 18, 2018 6:50 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: New Metal C standalone product for z/OS On Tue, 17 Jul 2018 17:04:14 -0700, Charles Mills <charl...@mcn.org> wrote: >One annoying thing also is that it is non-trivial to use a text editor to find >and convert all > >char foo[8]; >to >uint64_t foo; > >It would be easier if the c syntax were char[8] foo; then getting to uint64_t >foo; would be trivial. > >I guess if I were handier with regex it would be a piece of cake. I should >just figure it out once and then I would have it. One possibility for a regex (only minimally tested): Search expression: char +(\w(\w|\d)*)\[8\]; Replace expression: uint64_t \1; That should search for: (a) the string "char" followed by 1 or more spaces (b) followed by a "word" character (things like a-z, A-Z, _) followed by 0 or more word characters or digits (c) followed by the string "[8];" The replacement is then the string "uint64_t " followed by whatever was matched in (b) followed by ";". The only questionable part I can think of is in (b), which needs to match all the legal characters in the variable name. Rather than trusting to the definition of \w one could instead use: ([a-zA-Z_][a-zA-z0-9_]*) And then one can add any additional characters between the [] that may be legal in variable names but that aren't covered in \w. Some might need to be escaped with \ if they happen to be significant in regular expressions. Also, some regex engines have somewhat differnt syntaxes, so the final version might depend on what your text editor implements, but something as basic as this one should be fairly robust. -- Walt