Modifications to allow get_wspr_channel_symbols to be called repeatedly.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5610 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2015-06-14 20:02:03 +00:00
parent 9231696718
commit d10a46d147

View File

@ -52,12 +52,18 @@ long unsigned int pack_call(char *callsign) {
} }
if( isdigit(*(callsign+2)) ) { if( isdigit(*(callsign+2)) ) {
for (i=0; i<6; i++) { for (i=0; i<6; i++) {
call6[i]=*(callsign+i); if( callsign[i] == 0 ) {
call6[i]=32;
} else {
call6[i]=*(callsign+i);
}
} }
} else if( isdigit(*(callsign+1)) ) { } else if( isdigit(*(callsign+1)) ) {
for (i=0; i<5; i++) { for (i=0; i<6; i++) {
if( callsign[i] != 0 ) { if( i==0 || callsign[i-1]==0 ) {
call6[i+1]=*(callsign+i); call6[i]=32;
} else {
call6[i]=*(callsign+i-1);
} }
} }
} }
@ -158,7 +164,7 @@ void interleave(unsigned char *sym)
} }
} }
int get_wspr_channel_symbols(char* message, unsigned char* symbols) { int get_wspr_channel_symbols(char* rawmessage, unsigned char* symbols) {
int m=0, n=0, ntype=0; int m=0, n=0, ntype=0;
int i, j, ihash; int i, j, ihash;
unsigned char pr3[162]= unsigned char pr3[162]=
@ -173,7 +179,14 @@ int get_wspr_channel_symbols(char* message, unsigned char* symbols) {
0,0}; 0,0};
int nu[10]={0,-1,1,0,-1,2,1,0,-1,1}; int nu[10]={0,-1,1,0,-1,2,1,0,-1,1};
char *callsign, *grid, *powstr; char *callsign, *grid, *powstr;
char grid4[5]; char grid4[5], message[23];
memset(message,0,sizeof(char)*23);
i=0;
while ( rawmessage[i] != 0 && i<23 ) {
message[i]=rawmessage[i];
i++;
}
int i1=strcspn(message," "); int i1=strcspn(message," ");
int i2=strcspn(message,"/"); int i2=strcspn(message,"/");
@ -192,7 +205,6 @@ int get_wspr_channel_symbols(char* message, unsigned char* symbols) {
grid = strtok(NULL,s); grid = strtok(NULL,s);
powstr = strtok(NULL,s); powstr = strtok(NULL,s);
int power = atoi(powstr); int power = atoi(powstr);
n = pack_call(callsign); n = pack_call(callsign);
for (i=0; i<4; i++) { for (i=0; i<4; i++) {