From d8ecf18ed744609166f44e6f64be5b121ff16ca6 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Wed, 8 Aug 2012 09:30:17 +0200 Subject: [PATCH] Corrected errors in tables2scripts.praat introduced by blindly copying a different version --- sgc2.praat | 5 +++-- tables2scripts.praat | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sgc2.praat b/sgc2.praat index 60cf2e7..57e3e59 100644 --- a/sgc2.praat +++ b/sgc2.praat @@ -1221,6 +1221,7 @@ endproc # Load local tables if present. Else load # build-in scripted tables procedure loadTable .tableName$ + .tableVariableName$ = replace_regex$(.tableName$, "[^\w]", "_", 0); # Search for the table in local, preference, and global directories if fileReadable("'localTableDir$'/'.tableName$'.Table") Read from file... 'localTableDir$'/'.tableName$'.Table @@ -1229,8 +1230,8 @@ procedure loadTable .tableName$ elsif fileReadable("'globaltablelists$'/'.tableName$'.Table") Read from file... 'globaltablelists$'/'.tableName$'.Table # Load them from script - elsif variableExists("procCreate'.tableName$'$") - call Create'.tableName$' + elsif variableExists("procCreate'.tableVariableName$'$") + call Create'.tableVariableName$' else exit '.tableName$' cannot be found endif diff --git a/tables2scripts.praat b/tables2scripts.praat index 5195bcf..d281a97 100644 --- a/tables2scripts.praat +++ b/tables2scripts.praat @@ -31,6 +31,10 @@ source_directory$ = "Data" target_file$ = "CreateTables.praat" call tables2scripts "'source_directory$'" 'target_file$' +source_directory$ = "wordlists" +target_file$ = "CreateWordlists.praat" +call tables2scripts "'source_directory$'" 'target_file$' + # Definitions procedure tables2scripts .sourceDir$ .targetFile$ # Iterate over all tables in the directory @@ -117,10 +121,11 @@ procedure table2procedure .tableName$ .targetFile$ .numberOfRows = Get number of rows # Set name of procedure as variable - fileappend '.targetFile$' 'newline$'procCreate'.tableName$'$ = "'.tableName$'"'newline$' + .tableVariableName$ = replace_regex$(.tableName$, "[^\w]", "_", 0); + fileappend '.targetFile$' 'newline$'procCreate'.tableVariableName$'$ = "'.tableName$'"'newline$' # Start output - fileappend '.targetFile$' procedure Create'.tableName$''newline$' + fileappend '.targetFile$' procedure Create'.tableVariableName$''newline$' # Create table with columns fileappend '.targetFile$' 'tab$'Create Table with column names... '.tableName$' '.numberOfRows''newline$' fileappend '.targetFile$' 'tab$'... -- 2.11.4.GIT