Skip to content

Commit b44e3af

Browse files
authored
Merge pull request #52 from mohd-akram/fix-macos-speak
Fix building gspeak on macOS
2 parents b0a5dbb + cc971ca commit b44e3af

File tree

8 files changed

+103
-25
lines changed

8 files changed

+103
-25
lines changed

src/dapi/src/lts/l_gr_ru1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define MAXBUCH 50
4949
#define UMLMRK 16
5050

51-
extern ls_rule_show_phone(PHONE *, PHONE *, char *); // NAL warning removal
51+
extern int ls_rule_show_phone(PHONE *, PHONE *, char *); // NAL warning removal
5252
extern int ls_adju_is_cons(PHONE *); // NAL warning removal
5353

5454

src/dtalkml/src/dtalk_ml.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ unsigned int load_dectalk(char *lang)
462462
funcs->TextToSpeechOpenWaveOutFile = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechOpenWaveOutFile");
463463
funcs->TextToSpeechCloseWaveOutFile = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechCloseWaveOutFile");
464464
funcs->TextToSpeechGetStatus = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechGetStatus");
465-
funcs->TextToSpeechReset = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechReset");
465+
funcs->TextToSpeechReset = (MMRESULT ((_cdecl*)(LPTTS_HANDLE_T, BOOL))) GetProcAddress(funcs->mod,"TextToSpeechReset");
466466
funcs->TextToSpeechSync = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechSync");
467467
funcs->TextToSpeechGetRate = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechGetRate");
468468
funcs->TextToSpeechSetRate = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechSetRate");
@@ -487,10 +487,10 @@ unsigned int load_dectalk(char *lang)
487487

488488
funcs->TextToSpeechVersion = (ULONG ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechVersion");
489489
// CAB Removed warnings 6/24/02
490-
funcs->TextToSpeechTyping = (VOID ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechTyping");
490+
funcs->TextToSpeechTyping = (VOID ((_cdecl*)(LPTTS_HANDLE_T, unsigned char))) GetProcAddress(funcs->mod,"TextToSpeechTyping");
491491

492492
funcs->TextToSpeechGetLastError = (ULONG ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechGetLastError");
493-
funcs->TextToSpeechReserved1 = (ULONG ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechReserved1");
493+
funcs->TextToSpeechReserved1 = (ULONG ((_cdecl*)(unsigned char*, U8, BOOL, BOOL))) GetProcAddress(funcs->mod,"TextToSpeechReserved1");
494494
// CAB Removed warnings 6/24/02
495495
funcs->TextToSpeechReserved2 = (ULONG ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechReserved2");
496496

@@ -504,9 +504,9 @@ unsigned int load_dectalk(char *lang)
504504
funcs->TextToSpeechSetSpeakerParams = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechSetSpeakerParams");
505505

506506
// CAB Removed warnings 6/24/02
507-
funcs->TextToSpeechDictionaryHit = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechDictionaryHit");
507+
funcs->TextToSpeechDictionaryHit = (int ((_cdecl*)(LPTTS_HANDLE_T, struct dic_entry *))) GetProcAddress(funcs->mod,"TextToSpeechDictionaryHit");
508508
funcs->TextToSpeechDumpDictionary = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechDumpDictionary");
509-
funcs->TextToSpeechUserDictionaryHit = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechUserDictionaryHit");
509+
funcs->TextToSpeechUserDictionaryHit = (int ((_cdecl*)(LPTTS_HANDLE_T, struct dic_entry *))) GetProcAddress(funcs->mod,"TextToSpeechUserDictionaryHit");
510510
funcs->TextToSpeechDumpUserDictionary = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechDumpUserDictionary");
511511
funcs->TextToSpeechAddUserEntry = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechAddUserEntry");
512512
funcs->TextToSpeechDeleteUserEntry = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechDeleteUserEntry");
@@ -515,7 +515,7 @@ unsigned int load_dectalk(char *lang)
515515
funcs->TextToSpeechConvertToPhonemes = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechConvertToPhonemes");
516516
/* MGS added TextToSpeechTuning 12/03/1998 */
517517
funcs->TextToSpeechTuning = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechTuning");
518-
funcs->TextToSpeechGetPhVdefParams = (DWORD ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechGetPhVdefParams");
518+
funcs->TextToSpeechGetPhVdefParams = (short *((_cdecl*)(LPTTS_HANDLE_T, UINT))) GetProcAddress(funcs->mod,"TextToSpeechGetPhVdefParams");
519519

520520
funcs->TextToSpeechSetVolume = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechSetVolume");
521521
funcs->TextToSpeechGetVolume = (MMRESULT ((_cdecl*)())) GetProcAddress(funcs->mod,"TextToSpeechGetVolume");

src/samplosf/src/dtsamples/dtmemory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static void usage()
210210
** None
211211
**
212212
**************************************************************************/
213-
main( int argc, char *argv[] )
213+
int main( int argc, char *argv[] )
214214
{
215215
int devNo = (int)WAVE_MAPPER;
216216
int speaker_id = -1;

src/samplosf/src/speak/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ GSPEAK_ALL_OBJS= $(GSPEAK_OBJS) $(GSPEAK_DEMO_OBJS)
7171
#all: $(OUTPUT_DIR_2)/speak $(OUTPUT_DIR_2)/speak.uid
7272
all: $(SPEAK_ALL)
7373

74-
$(OUTPUT_DIR_2)/gspeak:$(GSPEAK_OBJS) ../../../dtalkml/build/$(OS_VERSION)/$(LANG_CODE)/$(ML_OUT)/libtts.so
74+
$(OUTPUT_DIR_2)/gspeak:$(GSPEAK_OBJS) ../../../dtalkml/build/$(OS_VERSION)/$(LANG_CODE)/$(ML_OUT)/$(ML_SONAME)
7575
$(RM) $@
7676
$(CC) -o $@ $(GSPEAK_OBJS) $(GLINK_FLAGS) $(G_DT_LIB) $(GLIBS)
7777

@@ -89,7 +89,7 @@ $(OUTPUT_DIR_2)/link/gspeak.o:gspeak.c
8989
$(OUTPUT_DIR_2)/link/gspeakdem_$(LANG_CODE).o:gspeak.c
9090
$(CC) -c -DDEMO -D$(LANGUAGE) $(GCFLAGS) -o $@ $<
9191

92-
$(OUTPUT_DIR_2)/speak:$(SPEAK_OBJS) ../../../dtalkml/build/$(OS_VERSION)/$(LANG_CODE)/$(ML_OUT)/libtts.so
92+
$(OUTPUT_DIR_2)/speak:$(SPEAK_OBJS) ../../../dtalkml/build/$(OS_VERSION)/$(LANG_CODE)/$(ML_OUT)/$(ML_SONAME)
9393
$(RM) $@
9494
$(CC) -o $@ $(SPEAK_OBJS) $(LINKFLAGS) $(XLIBS) $(DT_LIB) $(LIBS) $(MMELIBS)
9595

src/samplosf/src/speak/gspeak.c

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,18 @@ int main (int argc, char *argv[])
762762
if (config_file==NULL)
763763
{
764764
char p[PATH_MAX] = {};
765-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
765+
#if defined(__linux__)
766+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
767+
#elif defined(__APPLE__)
768+
char ep[PATH_MAX] = {};
769+
uint32_t size = sizeof(ep);
770+
ssize_t count = -1;
771+
if (_NSGetExecutablePath(ep, &size) == 0) {
772+
if (realpath(ep, p) != NULL) {
773+
count = strlen(p);
774+
}
775+
}
776+
#endif
766777
if (count != -1) {
767778
char *cfg;
768779
cfg = dirname(p);
@@ -779,7 +790,18 @@ int main (int argc, char *argv[])
779790
if (config_file==NULL)
780791
{
781792
char p[PATH_MAX] = {};
782-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
793+
#if defined(__linux__)
794+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
795+
#elif defined(__APPLE__)
796+
char ep[PATH_MAX] = {};
797+
uint32_t size = sizeof(ep);
798+
ssize_t count = -1;
799+
if (_NSGetExecutablePath(ep, &size) == 0) {
800+
if (realpath(ep, p) != NULL) {
801+
count = strlen(p);
802+
}
803+
}
804+
#endif
783805
if (count != -1) {
784806
char *cfg;
785807
cfg = dirname(p);
@@ -821,7 +843,18 @@ int main (int argc, char *argv[])
821843
#if defined __linux || defined (__APPLE__)
822844
if (exe_path && (bitmap_path[0] != '/')) {
823845
char p[PATH_MAX] = {};
824-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
846+
#if defined(__linux__)
847+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
848+
#elif defined(__APPLE__)
849+
char ep[PATH_MAX] = {};
850+
uint32_t size = sizeof(ep);
851+
ssize_t count = -1;
852+
if (_NSGetExecutablePath(ep, &size) == 0) {
853+
if (realpath(ep, p) != NULL) {
854+
count = strlen(p);
855+
}
856+
}
857+
#endif
825858
if (count != -1) {
826859
char *bmp;
827860
bmp = dirname(p);
@@ -1951,7 +1984,18 @@ void HelpAboutCallback(GtkWidget *w, gpointer data)
19511984
if (config_file==NULL)
19521985
{
19531986
char p[PATH_MAX] = {};
1954-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
1987+
#if defined(__linux__)
1988+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
1989+
#elif defined(__APPLE__)
1990+
char ep[PATH_MAX] = {};
1991+
uint32_t size = sizeof(ep);
1992+
ssize_t count = -1;
1993+
if (_NSGetExecutablePath(ep, &size) == 0) {
1994+
if (realpath(ep, p) != NULL) {
1995+
count = strlen(p);
1996+
}
1997+
}
1998+
#endif
19551999
if (count != -1) {
19562000
char *cfg;
19572001
cfg = dirname(p);
@@ -1965,7 +2009,18 @@ void HelpAboutCallback(GtkWidget *w, gpointer data)
19652009
if (config_file==NULL)
19662010
{
19672011
char p[PATH_MAX] = {};
1968-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
2012+
#if defined(__linux__)
2013+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
2014+
#elif defined(__APPLE__)
2015+
char ep[PATH_MAX] = {};
2016+
uint32_t size = sizeof(ep);
2017+
ssize_t count = -1;
2018+
if (_NSGetExecutablePath(ep, &size) == 0) {
2019+
if (realpath(ep, p) != NULL) {
2020+
count = strlen(p);
2021+
}
2022+
}
2023+
#endif
19692024
if (count != -1) {
19702025
char *cfg;
19712026
cfg = dirname(p);
@@ -2006,7 +2061,18 @@ void HelpAboutCallback(GtkWidget *w, gpointer data)
20062061
#if defined __linux || defined (__APPLE__)
20072062
if ((access(bitmap_path, R_OK) == -1) && (bitmap_path[0] != '/')) {
20082063
char p[PATH_MAX] = {};
2009-
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
2064+
#if defined(__linux__)
2065+
ssize_t count = readlink("/proc/self/exe", p, PATH_MAX);
2066+
#elif defined(__APPLE__)
2067+
char ep[PATH_MAX] = {};
2068+
uint32_t size = sizeof(ep);
2069+
ssize_t count = -1;
2070+
if (_NSGetExecutablePath(ep, &size) == 0) {
2071+
if (realpath(ep, p) != NULL) {
2072+
count = strlen(p);
2073+
}
2074+
}
2075+
#endif
20102076
if (count != -1) {
20112077
char *bmp;
20122078
bmp = dirname(p);

src/samplosf/src/windict/compile_dict.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
#include <sys/stat.h>
106106
#include <stdio.h>
107107
#include <time.h>
108-
#include <malloc.h>
108+
#include <string.h>
109109
#include "port.h"
110110
#include "cmd.h"
111111

@@ -263,6 +263,15 @@ void pushEntry();
263263
unsigned char nonWhite();
264264
unsigned char getAlpha();
265265
int look_for_prefix(char, char);
266+
int get_entry(char*);
267+
int parseString(char*);
268+
void scan_entry();
269+
void sort_entry();
270+
void scan_error(char*);
271+
int legal_alpha(char);
272+
int validatePrefixStr(char*);
273+
int validatePostfixStr(char*);
274+
int skipBlanks(char*);
266275

267276

268277
/*
@@ -305,7 +314,7 @@ unsigned char case_upper[] = {
305314
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
306315
};
307316

308-
compile_dictonary(char *DictFile, char *text, char *errStr)
317+
void compile_dictonary(char *DictFile, char *text, char *errStr)
309318
{
310319

311320
char fnam_d[80];
@@ -393,7 +402,7 @@ compile_dictonary(char *DictFile, char *text, char *errStr)
393402
*/
394403

395404

396-
sort_entry()
405+
void sort_entry()
397406
{
398407
unsigned char *ct,*dt;
399408
unsigned int *blink,next;
@@ -438,7 +447,7 @@ sort_entry()
438447
* <entry> {1 char phonemes}
439448
*/
440449

441-
scan_entry()
450+
void scan_entry()
442451
{
443452
unsigned char c;
444453

@@ -691,7 +700,7 @@ int lookupArpabet(p1,p2)
691700
* of the user dictionary ...
692701
*/
693702

694-
scan_error(es)
703+
void scan_error(es)
695704
char *es;
696705
{
697706
int i;
@@ -725,11 +734,11 @@ unsigned char getAlpha()
725734
if(line[curr_char] == ' ' || line[curr_char] == '\t')
726735
return(' ');
727736
scan_error("Unknown alphabetic character");
728-
return;
737+
return('\0');
729738
}
730739

731740
unsigned char legal_graphs[] = "_-()&@*!\\/";
732-
legal_alpha(c)
741+
int legal_alpha(c)
733742
char c;
734743
{
735744
int i;
@@ -832,7 +841,9 @@ int validatePrefixStr( char * prefixStr )
832841
(prefixStr[idx] != ' ') &&
833842
(prefixStr[idx] != 0) )
834843
{
835-
scan_error("Not alpha numeric 0x%x\n", prefixStr[idx]);
844+
char err[32];
845+
sprintf(err, "Not alpha numeric 0x%x\n", prefixStr[idx]);
846+
scan_error(err);
836847
validStr = FALSE;
837848
break;
838849
}

src/samplosf/src/windict/windic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void Error(char*, int);
9494
void CheckFileExtension(int, char *);
9595
void SaveMsg(void);
9696
char *strip_filename(gchar *);
97+
void compile_dictonary(char *, char *, char *);
9798

9899

99100

src/udicunix/src/udic_com.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ unsigned int arpabet_lang_fonts[] = {
155155
int look_for_prefix(char p1, char p2);
156156

157157

158-
main(int argc,char *argv[])
158+
int main(int argc,char *argv[])
159159

160160
{
161161
#if defined __linux__ || defined __osf__ || defined __ppc__ || defined (__APPLE__)

0 commit comments

Comments
 (0)