Use BIND(C) for gen65.f90, and pass strings in/out as character*1 arrays. Please test on macOS!

This commit is contained in:
Joe Taylor 2022-01-31 19:18:46 -05:00
parent 22b580af56
commit cab1bb8aed
2 changed files with 17 additions and 8 deletions

View File

@ -1,9 +1,10 @@
subroutine gen65(msg0,ichk,msgsent,itone,itype)
subroutine gen65(msg00,ichk,msgsent0,itone,itype) BIND(c)
! Encodes a JT65 message to yieild itone(1:126)
! Temporarily, does not implement EME shorthands
use packjt
character*1 msg00(23),msgsent0(23)
character*22 msg0
character*22 message !Message to be generated
character*22 msgsent !Message as it will be received
@ -21,6 +22,10 @@ subroutine gen65(msg0,ichk,msgsent,itone,itype)
1,1,1,1,1,1/
save
do i=1,22
msg0(i:i)=msg00(i)
enddo
if(msg0(1:1).eq.'@') then
read(msg0(2:5),*,end=1,err=1) nfreq
go to 2
@ -48,7 +53,7 @@ subroutine gen65(msg0,ichk,msgsent,itone,itype)
call unpackmsg(dgen,msgsent) !Unpack to get message sent
msgsent(20:22)=cok
call fmtmsg(msgsent,iz)
if(ichk.ne.0) go to 999 !Return if checking only
if(ichk.ne.0) go to 900 !Return if checking only
call rs_encode(dgen,sent) !Apply Reed-Solomon code
call interleave63(sent,1) !Apply interleaving
@ -79,5 +84,10 @@ subroutine gen65(msg0,ichk,msgsent,itone,itype)
endif
endif
999 return
900 do i=1,22
msgsent0(i)=msgsent(i:i)
enddo
msgsent0(23)=char(0)
return
end subroutine gen65

View File

@ -135,8 +135,7 @@ extern "C" {
void genmsk_128_90_(char* msg, int* ichk, char* msgsent, int itone[], int* itype,
fortran_charlen_t, fortran_charlen_t);
void gen65_(char* msg, int* ichk, char* msgsent, int itone[],
int* itext, fortran_charlen_t, fortran_charlen_t);
void gen65(char* msg, int* ichk, char msgsent[], int itone[], int* itext);
void genq65_(char* msg, int* ichk, char* msgsent, int itone[],
int* i3, int* n3, fortran_charlen_t, fortran_charlen_t);
@ -4041,8 +4040,8 @@ void MainWindow::guiUpdate()
&m_currentMessageType, (FCL)22, (FCL)22);
if(m_mode=="JT9") gen9_(message, &ichk, msgsent, const_cast<int *> (itone),
&m_currentMessageType, (FCL)22, (FCL)22);
if(m_mode=="JT65") gen65_(message, &ichk, msgsent, const_cast<int *> (itone),
&m_currentMessageType, (FCL)22, (FCL)22);
if(m_mode=="JT65") gen65(message, &ichk, msgsent, const_cast<int *> (itone),
&m_currentMessageType);
if(m_mode=="WSPR") genwspr_(message, msgsent, const_cast<int *> (itone),
(FCL)22, (FCL)22);
if(m_mode=="MSK144" or m_mode=="FT8" or m_mode=="FT4"
@ -5780,7 +5779,7 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
QByteArray s=t.toUpper().toLocal8Bit();
ba2msg(s,message);
int ichk=1,itype=0;
gen65_(message, &ichk,msgsent, const_cast<int*>(itone0), &itype, (FCL)22, (FCL)22);
gen65(message, &ichk,msgsent, const_cast<int*>(itone0), &itype);
msgsent[22]=0;
bool text=false;
bool shortMsg=false;