diff --git a/src/cli.c b/src/cli.c index cc1a9d9..a4cf48f 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * diff --git a/src/espeak.c b/src/espeak.c index 6f64901..135c6b5 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * diff --git a/src/espeakup.c b/src/espeakup.c index 3328d74..86b3a88 100644 --- a/src/espeakup.c +++ b/src/espeakup.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * @@ -28,7 +28,7 @@ #include "espeakup.h" -/* path to our pid file */ +// path to our pid file char *pidPath = "/var/run/espeakup.pid"; int debug = 0; @@ -60,7 +60,7 @@ int espeakup_start_daemon(void) exit(1); } if (pid) { - /* Parent, just wait for daemon */ + // Parent, just wait for daemon if (read(fds[0], &c, 1) < 0) { printf("Espeakup is already running!\n"); exit(1); @@ -68,14 +68,14 @@ int espeakup_start_daemon(void) exit(c); } - /* Child, create new session */ + // Child, create new session setsid(); pid = fork(); if (pid) - /* Intermediate child, just exit */ + // Intermediate child, just exit exit(0); - /* Child */ + // Child if (chdir("/") < 0) { c = 1; (void) write(fds[1], &c, 1); @@ -110,7 +110,7 @@ int espeakup_is_running(void) s[n] = 0; n = sscanf(s, "%d", &pid); if (n == 1 && (!kill(pid, 0) || errno != ESRCH)) { - /* Already running */ + // Already running close(pidFile); return 1; } @@ -153,13 +153,13 @@ int main(int argc, char **argv) return 2; } - /* set up the pipe used to wake the espeak thread */ + // set up the pipe used to wake the espeak thread if (pipe(self_pipe_fds) < 0) { perror("Unable to create pipe"); return 5; } - /* process command line options */ + // process command line options process_cli(argc, argv); if (!debug && espeakup_mode == ESPEAKUP_MODE_SPEAKUP) { @@ -179,7 +179,7 @@ int main(int argc, char **argv) close(devnull); } - /* create the signal processing thread here. */ + // create the signal processing thread here. err = pthread_create(&signal_thread_id, NULL, signal_thread, NULL); if (err != 0) { ret = 4; @@ -195,26 +195,26 @@ int main(int argc, char **argv) sigaddset(&sigset, SIGTERM); sigprocmask(SIG_BLOCK, &sigset, NULL); - /* Initialize espeak */ + // Initialize espeak if (initialize_espeak(&s) < 0) { ret = 2; goto out; } - /* open the softsynth */ + // open the softsynth if (open_softsynth() < 0) { ret = 2; goto out; } - /* Spawn our softsynth thread. */ + // Spawn our softsynth thread. err = pthread_create(&softsynth_thread_id, NULL, softsynth_thread, &s); if (err != 0) { ret = 4; goto out; } - /* Spawn our espeak-interacting thread. */ + // Spawn our espeak-interacting thread. err = pthread_create(&espeak_thread_id, NULL, espeak_thread, &s); if (err != 0) { ret = 4; @@ -224,7 +224,7 @@ int main(int argc, char **argv) if (!debug && espeakup_mode == ESPEAKUP_MODE_SPEAKUP) (void) write(fd, &ret, 1); - /* wait for the threads to shut down. */ + // wait for the threads to shut down. pthread_join(signal_thread_id, NULL); pthread_join(softsynth_thread_id, NULL); pthread_join(espeak_thread_id, NULL); @@ -239,8 +239,7 @@ out: unlink(pidPath); if (ret != 0) (void) write(fd, &ret, 1); - /* If ret was 0, the status byte was written before joining - * the threads. */ + // If ret was 0, the status byte was written before joining the threads. } return ret; } diff --git a/src/espeakup.h b/src/espeakup.h index 6629371..58d0f6e 100644 --- a/src/espeakup.h +++ b/src/espeakup.h @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * @@ -20,7 +20,7 @@ #ifndef __ESPEAKUP_H #define __ESPEAKUP_H -/* This was added for gcc 4.3 */ +// This was added for gcc 4.3 #include #include diff --git a/src/queue.c b/src/queue.c index 860ad94..63a5527 100644 --- a/src/queue.c +++ b/src/queue.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Note that these functions are meant to be used in either a single or * multi-threaded environment, so they know nothing about mutexes, etc. diff --git a/src/queue.h b/src/queue.h index a6a2a76..a1a2a99 100644 --- a/src/queue.h +++ b/src/queue.h @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * @@ -20,7 +20,7 @@ #ifndef __QUEUE_H #define __QUEUE_H -struct queue_t; /* An opaque type. */ +struct queue_t; // An opaque type. extern struct queue_t *new_queue(void); extern int queue_add(struct queue_t *q, void *entry); diff --git a/src/signal.c b/src/signal.c index f6a6a39..f0b4d57 100644 --- a/src/signal.c +++ b/src/signal.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * @@ -21,10 +21,11 @@ #include #include #include -#define STOP_MSG "s" #include "espeakup.h" +#define STOP_MSG "s" + /* * We install a dummy signal handler to let the o/s know that we * do not want the default action to be performed since we are @@ -41,7 +42,7 @@ void *signal_thread(void *arg) int sig; memset(&temp, 0, sizeof(struct sigaction)); - /* install dummy handlers for the signals we want to process */ + // install dummy handlers for the signals we want to process temp.sa_handler = dummy_handler; sigemptyset(&temp.sa_mask); sigaction(SIGINT, &temp, NULL); @@ -66,7 +67,7 @@ void *signal_thread(void *arg) pthread_mutex_lock(&queue_guard); } pthread_mutex_unlock(&queue_guard); - /* Tell the reader to stop, if it is in a select() call. */ + // Tell the reader to stop, if it is in a select() call. write(PIPE_WRITE_FD, STOP_MSG, strlen(STOP_MSG)); return NULL; } diff --git a/src/softsynth.c b/src/softsynth.c index 085582d..7d14708 100644 --- a/src/softsynth.c +++ b/src/softsynth.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs * @@ -29,15 +29,15 @@ #include "espeakup.h" #include "stringhandling.h" -/* max buffer size */ +// max buffer size static const size_t maxBufferSize = 16 * 1024 + 1; -/* synth flush character */ +// synth flush character static const int synthFlushChar = 0x18; static int softFD = 0; -/* Text accumulator: */ +// Text accumulator: char *textAccumulator; int textAccumulator_l; @@ -227,26 +227,26 @@ static void request_espeak_stop(void) { pthread_mutex_lock(&queue_guard); stop_requested = 1; - pthread_cond_signal(&runner_awake); /* Wake runner, if necessary. */ + pthread_cond_signal(&runner_awake); // Wake runner, if necessary. while (should_run && stop_requested) - pthread_cond_wait(&stop_acknowledged, - &queue_guard); /* wait for acknowledgement. */ + // wait for acknowledgement. + pthread_cond_wait(&stop_acknowledged, &queue_guard); pthread_mutex_unlock(&queue_guard); } int open_softsynth(void) { int rc = 0; - /* If we're in acsint mode, we read from stdin. No need to open. */ + // If we're in acsint mode, we read from stdin. No need to open. if (espeakup_mode == ESPEAKUP_MODE_ACSINT) { softFD = STDIN_FILENO; return 0; } - /* open the softsynth. */ + // open the softsynth. softFD = open("/dev/softsynthu", O_RDWR | O_NONBLOCK); if (softFD < 0 && errno == ENOENT) - /* Kernel without unicode support? Try without unicode. */ + // Kernel without unicode support? Try without unicode. softFD = open("/dev/softsynth", O_RDWR | O_NONBLOCK); if (softFD < 0) { perror("Unable to open the softsynth device"); diff --git a/src/stringhandling.c b/src/stringhandling.c index 1adf7ae..86ed965 100644 --- a/src/stringhandling.c +++ b/src/stringhandling.c @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2011 William Hubbs * @@ -75,9 +75,9 @@ void stringAndString(char **s, int *l, const char *t) oldlen = *l; newlen = oldlen + strlen(t); *l = newlen; - ++newlen; /* room for the 0 */ + ++newlen; // room for the 0 x = oldlen ^ newlen; - if (x > oldlen) { /* must realloc */ + if (x > oldlen) { // must realloc newlen |= (newlen >> 1); newlen |= (newlen >> 2); newlen |= (newlen >> 4); @@ -98,7 +98,7 @@ void stringAndBytes(char **s, int *l, const char *t, int cnt) *l = newlen; ++newlen; x = oldlen ^ newlen; - if (x > oldlen) { /* must realloc */ + if (x > oldlen) { // must realloc newlen |= (newlen >> 1); newlen |= (newlen >> 2); newlen |= (newlen >> 4); diff --git a/src/stringhandling.h b/src/stringhandling.h index a7d7cea..d138933 100644 --- a/src/stringhandling.h +++ b/src/stringhandling.h @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2011 William Hubbs * diff --git a/src/version.h.in b/src/version.h.in index 8c0038e..9ba36a9 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,5 +1,5 @@ /* - * espeakup - interface which allows speakup to use espeak + * espeakup - interface which allows speakup to use espeak-ng * * Copyright (C) 2008 William Hubbs *