diff --git a/tools/nuke_format b/tools/nuke_format index d492a4c12..362d9ea56 100755 --- a/tools/nuke_format +++ b/tools/nuke_format @@ -1,12 +1,17 @@ # usage nuke_format format_name SED=$(which gsed) -EDITOR="${EDITOR:-vim}" +EDITOR="${EDITOR:-vim}" + +# $1 = format $2 = file in all functions + -# $1 = format $2 = file remove_word() { # git add $2 - $SED -i "s/$1//g" $2 +set -x + # This uses a GNU extension ? for zero or more, letting us match with last + # entry in a line which has no following whitespace + $SED -i "s/$1\s*//g" $2 } remove_line_containing() { @@ -27,14 +32,17 @@ remove_word $1.h GPSBabel.pro remove_manually $1 reference/help.txt -remove_line_containing $1 reference/format0.txt -remove_line_containing $1 reference/format1.txt -remove_line_containing $1 reference/format2.txt -remove_manually $1 reference/format3.txt +# Take out the boilerplate entries in vecs.h ... remove_line_containing extern.*$1 vecs.h remove_line_containing Format.*$1 vecs.h remove_line_containing include.*$1 vecs.h -remove_manually $1 reference/format3.txt +# ... then let a human nerd snip3 the actual table entry awy +remove_manually $1 vecs.h + +remove_line_containing $1 reference/format0.txt +remove_line_containing $1 reference/format1.txt +remove_line_containing $1 reference/format2.txt +# This breaks these, but at least it leaves a clue in version history. remove_line_containing $1 msvc/GPSBabel.vcxproj remove_line_containing $1 msvc/GPSBabel.vcxproj.filters @@ -42,7 +50,7 @@ git rm -f reference/$1* git rm -f xmldoc/formats/$1.xml git rm -f xmldoc/formats/options/$1.xml git rm -f testo.d/$1.test -git rm -f $1.cc -git rm -f $1.h +git mv $1.cc deprecated/ +git mv $1.h deprecated/ # make && ./testo diff --git a/tools/reset_nuke b/tools/reset_nuke new file mode 100755 index 000000000..2080fc0f3 --- /dev/null +++ b/tools/reset_nuke @@ -0,0 +1,30 @@ +# Temporary script to undo what + +rm reference/format?.txt reference/help.txt +# git rm reference/format?.txt reference/help.txt +git reset reference/format?.txt reference/help.txt +git checkout reference/format0.txt +git checkout reference/format1.txt +git checkout reference/format2.txt +git checkout reference/format3.txt reference/help.txt + +rm GPSBabel.pro vecs.h vecs.cc +# git rm GPSBabel.pro vecs.h +#git reset GPSBabel.pro +#git reset vecs.h +git checkout GPSBabel.pro vecs.h vecs.cc + +# This part of the code devalues almot immediately once pushed upstream +echo "Now re-killing formats to exercise the script. ^C to cancel. to ontinue" +read x + +for f in compegps cst destinator g7to2in gopal gpsutil jtr maggeo mapsend nm4 pcx pocketfms skyforce stmsdf stmwpp tiger vpl wfff yahoo +do + git checkout $f.cc $f.h + tools/nuke_format $f +done + +# nuke_format is also believed to work on: +# gpsutil destinator exif gopal gpsutil jogmap jtr maggeo +# mapsend pcx skyforce stmsdf stmwpp tiger vidaone vpl yahoo +