From 11f65822b753868c5d8cc6490faa4acca5cc712c Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Tue, 23 Nov 2010 11:54:58 +0100 Subject: [PATCH] Using patch to adapt stock Praat distribution --- praat_module/adaptPraat.patch | 50 +++++++++++++++++++++++++++++++++++++++++++ praat_module/makePraat.sh | 25 ++++++++++++++-------- 2 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 praat_module/adaptPraat.patch diff --git a/praat_module/adaptPraat.patch b/praat_module/adaptPraat.patch new file mode 100644 index 0000000..7160a3a --- /dev/null +++ b/praat_module/adaptPraat.patch @@ -0,0 +1,50 @@ +diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/fon/praat_TextGrid_init.c demo_praat_sources/fon/praat_TextGrid_init.c +--- praat_sources/fon/praat_TextGrid_init.c 2010-08-10 09:18:22.145443134 +0200 ++++ demo_praat_sources/fon/praat_TextGrid_init.c 2010-09-08 14:12:37.273770594 +0200 +@@ -682,7 +682,7 @@ static void cb_TextGridEditor_publish (A + } + } + DIRECT (TextGrid_edit) +- if (theCurrentPraatApplication -> batch) { ++ if (theCurrentPraatApplication -> batch == 1) { + return Melder_error1 (L"Cannot edit a TextGrid from batch."); + } else { + WHERE (SELECTED && CLASS == classTextGrid) { +@@ -695,7 +695,7 @@ DIRECT (TextGrid_edit) + END + + DIRECT (TextGrid_LongSound_edit) +- if (theCurrentPraatApplication -> batch) { ++ if (theCurrentPraatApplication -> batch == 1) { + return Melder_error1 (L"Cannot edit a TextGrid from batch."); + } else { + LongSound longSound = NULL; +@@ -710,7 +710,7 @@ DIRECT (TextGrid_LongSound_edit) + END + + DIRECT (TextGrid_SpellingChecker_edit) +- if (theCurrentPraatApplication -> batch) { ++ if (theCurrentPraatApplication -> batch == 1) { + return Melder_error1 (L"Cannot edit a TextGrid from batch."); + } else { + SpellingChecker spellingChecker = NULL; +@@ -725,7 +725,7 @@ DIRECT (TextGrid_SpellingChecker_edit) + END + + DIRECT (TextGrid_LongSound_SpellingChecker_edit) +- if (theCurrentPraatApplication -> batch) { ++ if (theCurrentPraatApplication -> batch == 1) { + return Melder_error1 (L"Cannot edit a TextGrid from batch."); + } else { + LongSound longSound = NULL; +diff -Naurp -x '*.[oah]' -x '.git*' -x praat praat_sources/sys/praat.c demo_praat_sources/sys/praat.c +--- praat_sources/sys/praat.c 2010-11-02 09:30:25.285982433 +0100 ++++ demo_praat_sources/sys/praat.c 2010-11-02 08:56:44.875259518 +0100 +@@ -1368,6 +1368,7 @@ void praat_run (void) { + + if (Melder_batch) { + if (thePraatStandAloneScriptText != NULL) { ++ theCurrentPraatApplication -> batch = 2; + praat_executeScriptFromText (thePraatStandAloneScriptText); + praat_exit (0); + } else if (doingCommandLineInterface) { diff --git a/praat_module/makePraat.sh b/praat_module/makePraat.sh index 5103653..85378c9 100755 --- a/praat_module/makePraat.sh +++ b/praat_module/makePraat.sh @@ -21,25 +21,32 @@ elif [[ -d ../../praat_sources ]]; then PRAATSOURCES=../../praat_sources fi -cd ${PRAATSOURCES}/main -rm demopraatapplication.h +# Patch Praat +cd ${PRAATSOURCES} +if [[ -s ${CURRENTWORKINGDIR}/adaptPraat.patch ]]; then + patch --strip=1 < ${CURRENTWORKINGDIR}/adaptPraat.patch +fi + +# Add demopraatapplication.h +cd ./main +rm -f demopraatapplication.h ln -s ${CURRENTWORKINGDIR}/${APPLICATIONNAME}expanded.h ./demopraatapplication.h touch main_Praat.c -# Patch main +# Patch main_Praat if [[ -s ${CURRENTWORKINGDIR}/main_Praat.patch ]]; then - patch -b main_Praat.c ${CURRENTWORKINGDIR}/main_Praat.patch + patch main_Praat.c ${CURRENTWORKINGDIR}/main_Praat.patch fi cd ../ ${MAKECMD} 2>&1 -# Undo patch +# Undo patches +patch -R --strip=1 < ${CURRENTWORKINGDIR}/adaptPraat.patch + cd ./main -if [[ -s main_Praat.c.orig ]]; then - echo Removing patched file - mv main_Praat.c.orig main_Praat.c - touch main_Praat.c +if [[ -s ${CURRENTWORKINGDIR}/main_Praat.patch ]]; then + patch -R main_Praat.c ${CURRENTWORKINGDIR}/main_Praat.patch fi cd - -- 2.11.4.GIT