diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | tools/extract-api.sh | 26 | ||||
-rw-r--r-- | tools/sed-functions | 6 |
3 files changed, 19 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a841388 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tools/api* diff --git a/tools/extract-api.sh b/tools/extract-api.sh index 9fa7320..406c033 100755 --- a/tools/extract-api.sh +++ b/tools/extract-api.sh @@ -1,9 +1,11 @@ #! /bin/bash # -# TODO : use pkg-config -# +CURRENT=$(dirname $0)/api +PREV=$(dirname $0)/api-prev INCLUDE=$(pkg-config --libs ecore |gawk '{ print substr($1,3) }' | sed s/lib/include/) # +[ ! -d $PREV ] && mkdir $PREV +[ ! -d $CURRENT ] && mkdir $CURRENT rm *-diff 2>/dev/null # for header in \ @@ -22,16 +24,18 @@ for header in \ DIR=$(dirname $header) FILE=$(basename $header) # - [ -f $FILE ] && mv $FILE $FILE.prev + mv $CURRENT/$FILE-* $PREV/ 2>/dev/null # - cat $header | sed -n -f sed-functions > $FILE - cat $header | sed -r -n -f sed-enums > $FILE-enum - cat $header | sed -r -n -f sed-structs > $FILE-structs + cat $header | sed -r -n -f sed-functions > $CURRENT/$FILE-funcs + cat $header | sed -r -n -f sed-enums > $CURRENT/$FILE-enums + cat $header | sed -r -n -f sed-structs > $CURRENT/$FILE-structs # - if [ -f $FILE.prev ]; then - diff -u0 $FILE.prev $FILE > $FILE-diff - N=$(cat $FILE-diff | wc -l) - [ $N -eq 0 ] && rm $FILE-diff - fi + for F in $FILE-funcs $FILE-enums $FILE-structs ; do + if [ -f $PREV/$F ]; then + diff -u0 $PREV/$F $CURRENT/$F > $F-diff + N=$(cat $F-diff | wc -l) + [ $N -eq 0 ] && rm $F-diff + fi + done # done diff --git a/tools/sed-functions b/tools/sed-functions index bcd57d0..9438459 100644 --- a/tools/sed-functions +++ b/tools/sed-functions @@ -1,8 +1,8 @@ # if return type on single line, append next line -/EAPI.*[^;] *$/ { N; s/\n/ / } +/EAPI.*[^;]\s*$/ { N; s/\n/ / } # while unfinished argument list, append next line :loop /,$/ { N; s/\n/ /; t loop } -s/ \{2,\}/ /g -s/^ *EAPI/EAPI/p +s/ {2,}/ /g +s/^\s*EAPI/EAPI/p |