From cab1bb8aed77efb6d637cb54b0c60c5c92317693 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 31 Jan 2022 19:18:46 -0500 Subject: [PATCH] Use BIND(C) for gen65.f90, and pass strings in/out as character*1 arrays. Please test on macOS! --- lib/gen65.f90 | 16 +++++++++++++--- widgets/mainwindow.cpp | 9 ++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/gen65.f90 b/lib/gen65.f90 index af036c2a9..2fd6495a7 100644 --- a/lib/gen65.f90 +++ b/lib/gen65.f90 @@ -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 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 8d1cc4c85..04ed1539e 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -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 (itone), &m_currentMessageType, (FCL)22, (FCL)22); - if(m_mode=="JT65") gen65_(message, &ichk, msgsent, const_cast (itone), - &m_currentMessageType, (FCL)22, (FCL)22); + if(m_mode=="JT65") gen65(message, &ichk, msgsent, const_cast (itone), + &m_currentMessageType); if(m_mode=="WSPR") genwspr_(message, msgsent, const_cast (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(itone0), &itype, (FCL)22, (FCL)22); + gen65(message, &ichk,msgsent, const_cast(itone0), &itype); msgsent[22]=0; bool text=false; bool shortMsg=false;