summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/s_path.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
commit0d4560cb0305029fa5f0739670286176ab47cb65 (patch)
tree9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/s_path.c
parenteabeb928ddfdbe5fc6379efb87d9522803310649 (diff)
downloadrockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.bz2
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.xz
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_path.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/s_path.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_path.c b/apps/plugins/pdbox/PDa/src/s_path.c
index f40f1f6..da4fc94 100644
--- a/apps/plugins/pdbox/PDa/src/s_path.c
+++ b/apps/plugins/pdbox/PDa/src/s_path.c
@@ -14,6 +14,26 @@
#define DEBUG(x)
void readsf_banana( void); /* debugging */
+#ifdef ROCKBOX
+
+#include "plugin.h"
+#include "pdbox.h"
+
+#include "m_pd.h"
+#include "m_imp.h"
+#include "s_stuff.h"
+
+#define open rb->open
+#define close rb->close
+#define strcpy rb->strcpy
+#define strcat rb->strcat
+#define strlen rb->strlen
+#define strcmp rb->strcmp
+#define strncpy rb->strncpy
+#define strrchr rb->strrchr
+#define strncat rb_strncat
+
+#else /* ROCKBOX */
#include <stdlib.h>
#ifdef UNIX
#include <unistd.h>
@@ -29,6 +49,7 @@ void readsf_banana( void); /* debugging */
#include "s_stuff.h"
#include <stdio.h>
#include <fcntl.h>
+#endif /* ROCKBOX */
static t_namelist *pd_path, *pd_helppath;
@@ -85,6 +106,10 @@ t_namelist *namelist_append(t_namelist *listwas, const char *s)
char temp[MAXPDSTRING];
t_namelist *nl = listwas, *rtn = listwas;
+#ifdef ROCKBOX
+ (void) rtn;
+#endif
+
npos = s;
do
{
@@ -138,6 +163,10 @@ int open_via_path(const char *dir, const char *name, const char* ext,
int fd = -1;
char listbuf[MAXPDSTRING];
+#ifdef ROCKBOX
+ (void) bin;
+#endif
+
if (name[0] == '/'
#ifdef MSW
|| (name[1] == ':' && name[2] == '/')
@@ -191,6 +220,7 @@ int open_via_path(const char *dir, const char *name, const char* ext,
char *slash;
if (sys_verbose) post("tried %s and succeeded", dirresult);
sys_unbashfilename(dirresult, dirresult);
+
slash = strrchr(dirresult, '/');
if (slash)
{
@@ -199,7 +229,7 @@ int open_via_path(const char *dir, const char *name, const char* ext,
}
else *nameresult = dirresult;
- return (fd);
+ return (fd);
}
}
else
@@ -245,7 +275,9 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp)
else
#endif
{
+#ifndef ROCKBOX
char *slash;
+#endif
if (sys_verbose) post("tried %s and succeeded", dirresult);
sys_unbashfilename(dirresult, dirresult);
close (fd);
@@ -266,8 +298,12 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp)
search attempts. */
void open_via_helppath(const char *name, const char *dir)
{
+#ifdef ROCKBOX
+ t_namelist thislist, *listp;
+#else /*ROCKBOX */
t_namelist *nl, thislist, *listp;
int fd = -1;
+#endif /* ROCKBOX */
char dirbuf2[MAXPDSTRING], realname[MAXPDSTRING];
/* if directory is supplied, put it at head of search list. */
@@ -380,6 +416,10 @@ int sys_rcfile(void)
/* start an audio settings dialog window */
void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform)
{
+#ifdef ROCKBOX
+ (void) dummy;
+ (void) flongform;
+#else /* ROCKBOX */
char buf[MAXPDSTRING];
int i;
t_namelist *nl;
@@ -391,12 +431,19 @@ void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform)
sprintf(buf, "pdtk_path_dialog %%s\n");
gfxstub_new(&glob_pdobject, glob_start_path_dialog, buf);
+#endif /* ROCKBOX */
}
/* new values from dialog window */
void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
{
int i;
+
+#ifdef ROCKBOX
+ (void) dummy;
+ (void) s;
+#endif /* ROCKBOX */
+
namelist_free(pd_path);
pd_path = 0;
for (i = 0; i < argc; i++)
href='#n362'>362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
#!/usr/bin/perl -s
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$ 
#
# Copyright (C) 2007 Jonas Häggqvist
#
# All files in this archive are subject to the GNU General Public License.
# See the file COPYING in the source tree root for full license agreement.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.

use strict;
use warnings;
use File::Basename;
use File::Copy;
use vars qw($V $C $t $l $e $E $s $S $i $v);
use IPC::Open2;
use IPC::Open3;
use Digest::MD5 qw(md5_hex);
use DirHandle;
use open ':encoding(utf8)';
use open ':std';

sub printusage {
    print <<USAGE

Usage: voice.pl [options] [path to dir]
 -V
    Create voice file. You must also specify -t and -l.
 
 -C
    Create .talk clips.

 -t=<target>
    Specify which target you want to build voicefile for. Must include
    any features that target supports.
 
 -i=<target_id>
    Numeric target id. Needed for voice building.
 
 -l=<language>
    Specify which language you want to build. Without .lang extension.
 
 -e=<encoder>
    Which encoder to use for voice strings

 -E=<encoder options>
    Which encoder options to use when compressing voice strings. Enclose
    in double quotes if the options include spaces.
 
 -s=<TTS engine>
    Which TTS engine to use.
 
 -S=<TTS engine options>
    Options to pass to the TTS engine. Enclose in double quotes if the
    options include spaces.
 
 -v
    Be verbose
USAGE
;
}

# Initialize TTS engine. May return an object or value which will be passed
# to voicestring and shutdown_tts
sub init_tts {
    our $verbose;
    my ($tts_engine, $tts_engine_opts, $language) = @_;
    my %ret = ("name" => $tts_engine);
    # Don't use given/when here - it's not compatible with old perl versions
    if ($tts_engine eq 'festival') {
        print("> festival $tts_engine_opts --server\n") if $verbose;
        my $pid = open(FESTIVAL_SERVER, "| festival $tts_engine_opts --server > /dev/null 2>&1");
        my $dummy = *FESTIVAL_SERVER; #suppress warning
        $SIG{INT} = sub { kill TERM => $pid; print("foo"); panic_cleanup(); };