Please help, my WIN32::API script cant run after upgrading ActivePerl5.22 to 6.23 
Author Message
 Please help, my WIN32::API script cant run after upgrading ActivePerl5.22 to 6.23

Hi

I was really very troubled by this problem for few weeks.
Thanks to anyone who look into my post.

Last time I made a Text to Speech agent DLL and called it
by my Perl script, it worked fine (thanks to help of Tye McQueen),
but few days ago I just updated my ActivePerl5.22 to 6.23 and
ran the script again, a debug window poped out and with the
following message:

*****************WINDOW ERROR*******************
ERL caused an invalid page fault in
module PERL56.DLL at 017f:2803aa2a.
Registers:
EAX=0176f344 CS=017f EIP=2803aa2a EFLGS=00010246
EBX=0176f6fc SS=0187 ESP=0153fbd4 EBP=0153fc14
ECX=017cc644 DS=0187 ESI=00000001 FS=a97f
EDX=819177ec ES=0187 EDI=01779f60 GS=0000
Bytes at CS:EIP:
8b 3e 8b 4e 0c 8b 55 d8 8b c7 2b c1 42 c1 f8 02
Stack dump:
00000001 0176f344 00000000 0176f344 017cbbd8 00000004 00000000 0177979c
0153fc14 2803b31d 0176f344 017cbbd8 00000000 0176d8c8 0176f344 017cc644

The TTS DLL has 3 main functions: initialization, speak and termination
and they are defined as:
***************DLL FUNCTIONS DEFINITION**************
int initTTS(char *dataPath, short gender);
int spkTTS(char *string, double sentenceRate, short gender);
void termTTS(void);

My perl script can't even just unitialize the TTS, I ever put a die() after
initCTTS,
it just died without any "init ok, ready to go", and just poped out the
debug window.
But my initCTTS only takes into 2 simple parameters, should I look into my
initCTTS.cpp?

It is weird, why it could be ok at 5.22, but not 6.23, actually I have tried
some other
version of 6.XX, but it failed just as the same as 6.23.
Could anyone help me?
Any Clues?

Thanks very very much.

*********************MY PERL SCRIPT*********************
*********WORK FINE AT ACTIVEPERL5.22, but not 6.23**********
use Win32::API;

$the_string = "blah blah blah I am speaking";

$initCTTS = new Win32::API("cutalk", "initCTTS", [P, I], I) || die("NEW Init
failed");
$spkCanton = new Win32::API("cutalk", "spkCanton", [P, N,N, I], I) ||
die("NEW Spk failed");
$termCTTS = new Win32::API("cutalk", "termCTTS", [], V) || die("NEW Term
failed");

if ($initCTTS->Call('e:\\ctts_dll\\datafile',1)  == 1 ){
 print "init ok, ready to go\n";

Quote:
}

else {die("Init failed");}

my $val =2.0;
my $buf =pack("d", $val);
my $addr= 0 + \$buf;


 print "SpkCanton returned 1";}
else {
 print "SpkCanton returned 0";

Quote:
}

$termCTTS->Call();

*************************************************
*****************My initctts.cpp********************
*************************************************

#include <stdio.h>
#include <string.h>
#include "extractsent.h"
#include "xscript2parameter.h"
#include "pause.h"
#include "uvdur.h"
#include "psola.h"

#define IN_DLL
#define DllExport extern "C" __declspec( dllexport )
#define MAX_LENGTH_PER_SENTENCE 2048

char fileDirCTTS[1024];

PAUSE_LIST pauses; file://for "cusent_copause.txt"
DURATION_LIST pause_durations; // for "cusent_uvdur.txt"

unsigned long DICT_SIZE; // size of dict.txt
char **dict_chn;
char **dict_pron;

extern void load_all_symbols();
extern int load_pron_dict_file(char *path);
int load_sylpause();
int load_duration();

// female
DATA_IDX *voice1_idx; // voice1 index
short *voice1_dat;  // voice1 data
long *voice1_pm;  // voice1 pitch mark
long VOICE1_IDX_SIZE;

// male
DATA_IDX *voice2_idx; // voice2 index
short *voice2_dat;  // voice2 data
long *voice2_pm;  // voice2 pitch mark
long VOICE2_IDX_SIZE;

int load_voice1(char *path);
int load_voice2(char *path);

DllExport int initCTTS(char *dataPath, short gender){

 if (dataPath==NULL){
  strcpy(fileDirCTTS, "");
 }
 else{
  strcpy(fileDirCTTS, dataPath);
  strcat(fileDirCTTS, "\\");
 }

 load_all_symbols();
 if( load_pron_dict_file(fileDirCTTS)==0 ){
     printf("error: load lexicon\n");
     return 0;
 }

 if( load_sylpause()==0 ) {
     printf("Error: Load Syllable Pause\n");
     return 0;
 }

 if( load_duration()==0 ){
  printf("Error: Load Duratio\n");
  return 0;
 }

 switch(gender){
 case 2: // M_VOICE
  if( load_voice2(dataPath)==0 ){
   printf("Error: Load Voice1\n");
   return 0;
  }
  break;
 case 3: // M_VOICE|F_VOICE
  if( load_voice2(dataPath)==0 ){
   printf("Error: Load Voice1\n");
   return 0;
  }
 default: // F_VOICE
  if( load_voice1(dataPath)==0 ){
   printf("Error: Load Voice1\n");
   return 0;
  }
 }
 return 1;

Quote:
}

DllExport void termCTTS(void){

 if(voice1_idx)
  free(voice1_idx);
 if(voice1_dat)
  free(voice1_dat);
 if(voice1_pm)
  free(voice1_pm);

 if(voice2_idx)
  free(voice2_idx);
 if(voice2_dat)
  free(voice2_dat);
 if(voice2_pm)
  free(voice2_pm);

Quote:
}

int load_sylpause(void){

 file://int i;
 pauses.num_pause = PAUSE_CO;

 pauses.pause = cu_pause;

 return pauses.num_pause;

Quote:
}

int load_duration(void){

 file://int i;
 pause_durations.num_duration = (long) DURATION_UV;

 pause_durations.duration = UVDuration;

 return 1;

Quote:
}

file://female
int load_voice1(char *path){

 FILE *fpdata, *fpidx;
 char buf[1024];
 long size_idx;
 file://long i;
 long ttl_size; file://total size of data file (*.dat)

 // voice1.idx
 strcpy(buf, path);
 if( strlen(path)>0 ){
  strcat(buf, "\\");
  strcat(buf, "voice1.idx");
 }
 else{
  strcpy(buf, "voice1.idx");
 }
 fpidx=fopen(buf, "rb");
 if(fpidx==NULL){
  printf("error: fpidx\n");
  return 0;
 }
 fseek(fpidx, 0, SEEK_END);
 size_idx=ftell(fpidx)/sizeof(DATA_IDX);
 VOICE1_IDX_SIZE=size_idx;
 voice1_idx=(DATA_IDX*)malloc(VOICE1_IDX_SIZE*sizeof(DATA_IDX));
 if(voice1_idx==NULL){
  printf("error: voice1_idx\n");
  return 0;
 }
 rewind(fpidx);
 fread(voice1_idx, sizeof(DATA_IDX), VOICE1_IDX_SIZE, fpidx);
 fclose(fpidx);

 // voice1.dat
 strcpy(buf, path);
 if( strlen(path)>0 ){
  strcat(buf, "\\");
  strcat(buf, "voice1.dat");
 }
 else{
  strcpy(buf, "voice1.dat");
 }
 fpdata=fopen(buf, "rb");
 if(fpdata==NULL){
  printf("error: fpdata\n");
  return 0;
 }
 fseek(fpdata, 0, SEEK_END);
 ttl_size=ftell(fpdata);
 rewind(fpdata);

 voice1_dat=(short*)malloc(voice1_idx[0].ptPM);
 if(voice1_dat==NULL){
  printf("error: voice1_dat\n");
  return 0;
 }
 fread(voice1_dat, sizeof(short), voice1_idx[0].ptPM/sizeof(short), fpdata);

 voice1_pm=(long*)malloc(ttl_size-voice1_idx[0].ptPM);
 if(voice1_pm==NULL){
  printf("error: voice1_pm\n");
  return 0;
 }
 fread(voice1_pm, sizeof(long), (ttl_size-voice1_idx[0].ptPM)/sizeof(long),
fpdata);
 fclose(fpdata);

 return 1;

Quote:
}

file://male
int load_voice2(char *path){

 FILE *fpdata, *fpidx;
 char buf[1024];
 long size_idx;
 file://long i;
 long ttl_size; file://total size of data file (*.dat)

 // voice2.idx
 strcpy(buf, path);
 if( strlen(path)>0 ){
  strcat(buf, "\\");
  strcat(buf, "voice2.idx");
 }
 else{
  strcpy(buf, "voice2.idx");
 }
 fpidx=fopen(buf, "rb");
 if(fpidx==NULL){
  printf("error: fpidx\n");
  return 0;
 }
 fseek(fpidx, 0, SEEK_END);
 size_idx=ftell(fpidx)/sizeof(DATA_IDX);
 VOICE2_IDX_SIZE=size_idx;
 voice2_idx=(DATA_IDX*)malloc(VOICE2_IDX_SIZE*sizeof(DATA_IDX));
 if(voice2_idx==NULL){
  printf("error: voice2_idx\n");
  return 0;
 }
 rewind(fpidx);
 fread(voice2_idx, sizeof(DATA_IDX), VOICE2_IDX_SIZE, fpidx);
 fclose(fpidx);

 // voice2.dat
 strcpy(buf, path);
 if( strlen(path)>0 ){
  strcat(buf, "\\");
  strcat(buf, "voice2.dat");
 }
 else{
  strcpy(buf, "voice2.dat");
 }
 fpdata=fopen(buf, "rb");
 if(fpdata==NULL){
  printf("error: fpdata\n");
  return 0;
 }
 fseek(fpdata, 0, SEEK_END);
 ttl_size=ftell(fpdata);
 rewind(fpdata);

 voice2_dat=(short*)malloc(voice2_idx[0].ptPM);
 if(voice2_dat==NULL){
  printf("error: voice2_dat\n");
  return 0;
 }
 fread(voice2_dat, sizeof(short), voice2_idx[0].ptPM/sizeof(short), fpdata);

 voice2_pm=(long*)malloc(ttl_size-voice2_idx[0].ptPM);
 if(voice2_pm==NULL){
  printf("error: voice2_pm\n");
  return 0;
 }
 fread(voice2_pm, sizeof(long), (ttl_size-voice2_idx[0].ptPM)/sizeof(long),
fpdata);
 fclose(fpdata);

 return 1;

Quote:
}



Tue, 29 Jul 2003 23:40:24 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Please help, my WIN32::API script cant run after upgrading ActivePerl5.22 to 6.23

2. Please Help:My script runs on win32, it won't run on Unix

3. Please Help: My script runs on win32, it won't run on Unix

4. GD installation on IRIX 6.2 successfull but scripts wont run

5. Cant run perl scripts on Apache server on NT

6. cant run cgi script

7. Win32:API Printer call - Can anyone fix this (PLEASE READ)

8. Win32:API Printer call - Can anyone fix this (PLEASE READ)

9. Win32:API Printer call - Can anyone fix this (PLEASE READ)

10. Running MacPerl CGI script -- Please Help !

11. Please help re cgi script on FreeBSD running Apache

 

 
Powered by phpBB® Forum Software