home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
clipper
/
nannws36.arc
/
SAY_XCMD.C
< prev
next >
Wrap
Text File
|
1989-05-01
|
2KB
|
90 lines
/* Program: SAY_XCMD.C */
/* Author: Michael Herman */
/* Copyright (c) 1989 Nantucket Corp. All Rights Reserved. */
#include <MacTypes.h>
typedef struct
{
short int paramCount;
Handle params[16];
Handle returnValue;
Boolean passFlag;
void (*entryPoint)();
short int request;
short int result;
long inArgs[8];
long outArgs[4];
} *XCmdBlockPtr;
/* The PASCAL types SpeechOn, Reader, MacinTalk and SpeechOff are
PASCAL functions of MACINTALK being called from within the C
program. Also the XCmdBlockPtr function is taking the place of
MAIN() since XCMDs have no header bytes. */
pascal int SpeechOn(char*, Handle*);
pascal int Reader(Handle, char*, long, Handle);
pascal int MacinTalk(Handle, Handle);
pascal void SpeechOff(Handle);
pascal void main(XCmdBlockPtr);
int Upper(char*);
void strcpy(char*, char*);
pascal void main(paramPtr)
XCmdBlockPtr paramPtr;
{
int err, len;
Handle theSpeech, Phonemes;
asm { move.l a0, a4 } /* So that we can properly access
globals and literals */
paramPtr->returnValue = NewHandle(256L);
if (paramPtr->paramCount > 0)
{
len = Upper(*paramPtr->params[0]);
err = SpeechOn("", &theSpeech);
if (err == 0)
{
Phonemes = NewHandle(0L);
err = Reader(theSpeech, (char*)(*paramPtr->params[0]),
(long) len,Phonemes);
if (err == 0)
{
err = MacinTalk(theSpeech, Phonemes);
if (err == 0)
strcpy((char*)(*paramPtr->returnValue), "Ok.");
else
strcpy((char*)(*paramPtr->returnValue),
"Error: MacinTalk.");
}
else
strcpy((char*)(*paramPtr->returnValue), "Error: Reader.");
DisposHandle(Phonemes);
SpeechOff(theSpeech);
}
else
strcpy((char*)(*paramPtr->returnValue), "Error: Can't load
MacinTalk.");
}
else
strcpy((char*)(*paramPtr->returnValue), "Error: Not enough
parameters.");
}
int Upper(str)
char *str;
{
int i=0;
while (str[i] != 0)
{
if (str[i] > 96 && str[i] < 123)
str[i] &= 0xdf;
i++;
}
return (i);
}
void strcpy(s1, s2)
char *s1, *s2;
{
int i=0;
while (s1[i] = s2[i])
i++;
}