[PATCH] gdbadmin/ss/gdb_ari.sh modify editCase/UCASE rules

Pierre Muller muller@ics.u-strasbg.fr
Mon Apr 20 16:01:00 GMT 2009


  Following Eli's suggestion
I rewrote the editCase/UCASE awk script
to only catch real function implementations.

  It seems to only catch real cases, at least for editCase.
The only risk is that it doesn't find function, if the
do not follow the rule of having the open brace at next line.


Pierre Muller
Pascal language support maintainer for GDB
trying to improve the gdb ARI script.

PS: tell me if I am wrong, but I had to use
/complicated pattern/ {
  instructions for match
}
! /same complicated pattern/ {
  instructions if no match
}

"else" does not seem to accepted at that level in gawk.

Committed patch:

Index: gdb_ari.sh
===================================================================
RCS file: /cvs/gdbadmin/ss/gdb_ari.sh,v
retrieving revision 1.88
diff -r1.88 gdb_ari.sh
181a182,183
>     possible_UCASE = 0
>     possible_editCase = 0
466,468c468,479
< /^[A-Z][[:alnum:]_]*[[:space:]]*\(/ {
<    if (is_yacc_or_lex == 0) {
<       fail("UCASE function")
---
> /^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*\)[[:space:]]*$/ {
>     possible_UCASE = 1
>     possible_FNR = FNR
> }
> ! /^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*\)[[:space:]]*$/ {
>     if (possible_UCASE == 1) {
>       if (($0 ~ /^\{/) && (is_yacc_or_lex == 0)) {
>           store_FNR = FNR
>           FNR = possible_FNR
>           fail("UCASE function")
>           FNR = store_FNR
>       }
469a481
>     possible_UCASE = 0
476,478c488,499
< /^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\(/ {
<    if (is_yacc_or_lex == 0) {
<      fail("editCase function")
---
> /^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\([^()]*\)[[:space:]]*$/ {
>    possible_editCase = 1
>    possible_FNR = FNR
> }
> ! /^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\([^()]*\)[[:space:]]*$/
{
>    if (possible_editCase == 1) {
>       if (($0 ~ /^\{/) && (is_yacc_or_lex == 0)) {
>           store_FNR = FNR
>           FNR = possible_FNR
>           fail("editCase function")
>           FNR = store_FNR
>       }
479a501
>    possible_editCase = 0



More information about the Gdb-patches mailing list