kopia lustrzana https://github.com/ag1le/morse-wip
v01 C++ decoders works now. Added decoding logic in transl.c
rodzic
7db951ee14
commit
de3bb04f54
|
@ -1,7 +1,12 @@
|
|||
(C) 2013 AG1LE Mauri Niininen
|
||||
|
||||
This software is a Morse decoder orinally created by Dr. E. L. Bell in 1977.
|
||||
The software was manually entered from Fortran program listings and later converted to C++.
|
||||
The software was manually entered from Fortran program listings and later converted to C++
|
||||
by AG1LE Mauri Niininen.
|
||||
|
||||
2013-SEP-02 Morse decoding works on C++ version. Added decoding struct TREE in transl.c
|
||||
and logic to translate incoming morse symbols. This is marked as version v01.
|
||||
|
||||
|
||||
2013-SEP-01 Initial version. Original Fortran sources compiled with
|
||||
gfortran -g *.f
|
||||
|
|
BIN
a.out
BIN
a.out
Plik binarny nie jest wyświetlany.
30
key.c
30
key.c
|
@ -60,19 +60,21 @@ static integer c__1 = 1;
|
|||
static integer nelm = 0;
|
||||
static integer n = 0;
|
||||
static integer nltr = 1;
|
||||
static integer morse[400] /* was [10][40] */ = { 1,3,2,0,0,0,0,0,0,0,2,
|
||||
3,1,3,1,3,1,0,0,0,2,3,1,3,2,3,1,0,0,0,2,3,1,3,1,0,0,0,0,0,1,0,0,0,
|
||||
0,0,0,0,0,0,1,3,1,3,2,3,1,0,0,0,2,3,2,3,1,0,0,0,0,0,1,3,1,3,1,3,1,
|
||||
0,0,0,1,3,1,0,0,0,0,0,0,0,1,3,2,3,2,3,2,0,0,0,2,3,1,3,2,0,0,0,0,0,
|
||||
1,3,2,3,1,3,1,0,0,0,2,3,2,0,0,0,0,0,0,0,2,3,1,0,0,0,0,0,0,0,2,3,2,
|
||||
3,2,0,0,0,0,0,1,3,2,3,2,3,1,0,0,0,2,3,2,3,1,3,2,0,0,0,1,3,2,3,1,0,
|
||||
0,0,0,0,1,3,1,3,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,3,1,3,2,0,0,0,0,
|
||||
0,1,3,1,3,1,3,2,0,0,0,1,3,2,3,2,0,0,0,0,0,2,3,1,3,1,3,2,0,0,0,2,3,
|
||||
1,3,2,3,2,0,0,0,1,3,1,3,2,3,2,3,2,0,1,3,1,3,1,3,2,3,2,0,1,3,1,3,2,
|
||||
3,2,3,2,0,1,3,1,3,1,3,2,3,2,0,1,3,1,3,1,3,1,3,2,0,1,3,1,3,1,3,1,3,
|
||||
1,0,2,3,1,3,1,3,1,3,1,0,2,3,2,3,1,3,1,3,1,0,2,3,2,3,2,3,1,3,1,0,2,
|
||||
3,2,3,2,3,2,3,1,0,2,3,2,3,2,3,2,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||
static integer morse[400] = {
|
||||
1,3,2,0,0,0,0,0,0,0, 2,3,1,3,1,3,1,0,0,0, 2,3,1,3,2,3,1,0,0,0, 2,3,1,3,1,0,0,0,0,0, // ABCD
|
||||
1,0,0,0,0,0,0,0,0,0, 1,3,1,3,2,3,1,0,0,0, 2,3,2,3,1,0,0,0,0,0, 1,3,1,3,1,3,1,0,0,0, // EFGH
|
||||
1,3,1,0,0,0,0,0,0,0, 1,3,2,3,2,3,2,0,0,0, 2,3,1,3,2,0,0,0,0,0, 1,3,2,3,1,3,1,0,0,0, // IJKL
|
||||
2,3,2,0,0,0,0,0,0,0, 2,3,1,0,0,0,0,0,0,0, 2,3,2,3,2,0,0,0,0,0, 1,3,2,3,2,3,1,0,0,0, // MNOP
|
||||
2,3,2,3,1,3,2,0,0,0, 1,3,2,3,1,0,0,0,0,0, 1,3,1,3,1,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0, // QRST
|
||||
1,3,1,3,2,0,0,0,0,0, 1,3,1,3,1,3,2,0,0,0, 1,3,2,3,2,0,0,0,0,0, 2,3,1,3,1,3,2,0,0,0, // UVWX
|
||||
2,3,1,3,2,3,2,0,0,0, 2,3,2,3,1,3,1,0,0,0, 1,3,2,3,2,3,2,3,2,0, 1,3,1,3,2,3,2,3,2,0, // YZ12
|
||||
1,3,1,3,1,3,2,3,2,0, 1,3,1,3,1,3,1,3,2,0, 1,3,1,3,1,3,1,3,1,0, 2,3,1,3,1,3,1,3,1,0, // 3456
|
||||
2,3,2,3,1,3,1,3,1,0, 2,3,2,3,2,3,1,3,1,0, 2,3,2,3,2,3,2,3,1,0, 2,3,2,3,2,3,2,3,2,0, // 7890
|
||||
0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 };
|
||||
|
||||
|
||||
// 6 morse symbols: 1=dot(.) 2=dash(-) 3=element space(^) 4=char space (~) 5=word space(W) 6=pause(P)
|
||||
|
||||
static integer ielm = 1;
|
||||
static struct {
|
||||
char e_1[24];
|
||||
|
@ -137,7 +139,7 @@ static integer c__1 = 1;
|
|||
/* IY=Y */
|
||||
/* LTR=IY+1 */
|
||||
++ltr;
|
||||
if (ltr >= 36) {
|
||||
if (ltr >= 38) {
|
||||
ltr = 1;
|
||||
}
|
||||
goto L100;
|
||||
|
|
26
morse.c
26
morse.c
|
@ -11,7 +11,8 @@
|
|||
*/
|
||||
|
||||
#include "f2c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Main program */ int MAIN__(void)
|
||||
{
|
||||
/* Initialized data */
|
||||
|
@ -19,17 +20,11 @@
|
|||
static real rn = .1f;
|
||||
static integer np = 0;
|
||||
|
||||
/* Format strings */
|
||||
static char fmt_4[] = "(\002MORSE:, X, PMAX, IPMAX, ELMHAT, ZSIG,RN,SPDH"
|
||||
"AT,ZDET\002)";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), e_wsfe(void);
|
||||
/* Subroutine */ int s_stop(char *, ftnlen);
|
||||
|
||||
/* Local variables */
|
||||
static integer n;
|
||||
static real x, z__;
|
||||
static real x, z;
|
||||
static integer n1, n2;
|
||||
static real s1[512], s2[512], s3[512], s4[512], px;
|
||||
static integer imax, xhat;
|
||||
|
@ -47,15 +42,12 @@
|
|||
static integer ltrhat;
|
||||
extern /* Subroutine */ int inputl_(void);
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___3 = { 0, 6, 0, fmt_4, 0 };
|
||||
|
||||
|
||||
/* CALL SRAND(86456) */
|
||||
initl_();
|
||||
inputl_();
|
||||
s_wsfe(&io___3);
|
||||
e_wsfe();
|
||||
|
||||
L1:
|
||||
for (n1 = 1; n1 <= 512; ++n1) {
|
||||
for (n2 = 1; n2 <= 18; ++n2) {
|
||||
|
@ -71,15 +63,15 @@ L1:
|
|||
noise_(&zdet, &rn, &zout);
|
||||
/* RN = RAND() */
|
||||
rn = .01f;
|
||||
proces_(&x, &rn, &xhat, &px, &elmhat, <rhat, &spdhat, &imax, &
|
||||
pmax);
|
||||
proces_(&x, &rn, &xhat, &px, &elmhat, <rhat, &spdhat, &imax, &pmax);
|
||||
L3:
|
||||
;
|
||||
}
|
||||
n = n1;
|
||||
/* PRINT 5, X, PMAX, IMAX, ELMHAT,ZSIG, RN, SPDHAT, ZDET */
|
||||
/* 5 FORMAT('MORSE:',2(F10.3,2X),2(I7,1X),4(F10.3,2X) ) */
|
||||
stats_(&zdet, &z__, &px, &xhat, s1, s2, s3, s4, &n);
|
||||
#ifdef DEBUG
|
||||
printf("\nMORSE: %f %f %d %d %f %f %f",x,pmax,imax,elmhat,zsig,rn,spdhat);
|
||||
#endif
|
||||
stats_(&zdet, &z, &px, &xhat, s1, s2, s3, s4, &n);
|
||||
/* L2: */
|
||||
}
|
||||
/* CALL DISPLA(S1,S2,S3,S4) */
|
||||
|
|
26
path.c
26
path.c
|
@ -45,17 +45,8 @@ static integer c__1 = 1;
|
|||
/* Subroutine */ int path_(integer *ip, integer *lambda, real *dur, integer *
|
||||
ilrate, integer *lamsav, real *dursav, integer *ilrsav)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_75[] = "(\002PATH:\002,3(i3,2x),2(f8.3,2x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, j, k, n, ixl, ixs, ilelm;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___8 = { 0, 6, 0, fmt_75, 0 };
|
||||
/* Local variables */
|
||||
static integer i, j, k, n, ixl, ixs, ilelm;
|
||||
|
||||
|
||||
|
||||
|
@ -82,10 +73,10 @@ static integer c__1 = 1;
|
|||
|
||||
/* Function Body */
|
||||
for (k = 1; k <= 6; ++k) {
|
||||
for (i__ = 1; i__ <= 5; ++i__) {
|
||||
for (i = 1; i <= 5; ++i) {
|
||||
/* STATE IDENTITY N: */
|
||||
|
||||
n = (i__ - 1) * 6 + k;
|
||||
n = (i - 1) * 6 + k;
|
||||
/* NEW PATH IDENTITY: */
|
||||
|
||||
j = (*ip - 1) * 30 + n;
|
||||
|
@ -109,16 +100,9 @@ L50:
|
|||
/* CALCULATE DURATION - ADD SAMPLE DURATION 5 ms FOR EACH VALID PATH */
|
||||
dursav[j] = *dur * (1 - ixs - ixl + (ixs << 1) * ixl) + 5.f;
|
||||
/* NEW DATA RATE: */
|
||||
ilrsav[j] = *ilrate + (i__ - 3) * blkrat_1.memdel[ilelm + k * 6 -
|
||||
ilrsav[j] = *ilrate + (i - 3) * blkrat_1.memdel[ilelm + k * 6 -
|
||||
7];
|
||||
goto L100;
|
||||
s_wsfe(&io___8);
|
||||
do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&ilrsav[j], (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&(*lambda), (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&(*dur), (ftnlen)sizeof(real));
|
||||
do_fio(&c__1, (char *)&dursav[j], (ftnlen)sizeof(real));
|
||||
e_wsfe();
|
||||
L100:
|
||||
;
|
||||
}
|
||||
|
|
205
proces.c
205
proces.c
|
@ -16,157 +16,8 @@
|
|||
|
||||
static integer c__1 = 1;
|
||||
|
||||
/* Subroutine */ int visarl_(char *nam, real *k, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_10[] = "(a3,25(i6,1x))";
|
||||
static char fmt_20[] = "(\002 :\002,25(f6.1,1x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___1 = { 0, 6, 0, fmt_10, 0 };
|
||||
static cilist io___3 = { 0, 6, 0, fmt_20, 0 };
|
||||
|
||||
|
||||
/* Parameter adjustments */
|
||||
--k;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___1);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 25; ++j) {
|
||||
do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
s_wsfe(&io___3);
|
||||
for (j = 1; j <= 25; ++j) {
|
||||
do_fio(&c__1, (char *)&k[j], (ftnlen)sizeof(real));
|
||||
}
|
||||
e_wsfe();
|
||||
return 0;
|
||||
} /* visarl_ */
|
||||
|
||||
/* Subroutine */ int visarr_(char *nam, integer *k, real *z__, integer *isave,
|
||||
integer *elmhat, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_20[] = "(f5.1,i3,\002 :\002,25(i6,1x))";
|
||||
|
||||
/* System generated locals */
|
||||
integer i__1;
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___4 = { 0, 6, 0, fmt_20, 0 };
|
||||
|
||||
|
||||
/* PRINT 10,NAM,(J,J=1,25) */
|
||||
/* 10 FORMAT(A3,25(I6,1x)) */
|
||||
/* Parameter adjustments */
|
||||
--k;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___4);
|
||||
do_fio(&c__1, (char *)&(*z__), (ftnlen)sizeof(real));
|
||||
do_fio(&c__1, (char *)&(*elmhat), (ftnlen)sizeof(integer));
|
||||
i__1 = *isave;
|
||||
for (j = 1; j <= i__1; ++j) {
|
||||
do_fio(&c__1, (char *)&k[j], (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
return 0;
|
||||
} /* visarr_ */
|
||||
|
||||
/* Subroutine */ int vis_(char *nam, real *p, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_10[] = "(a3,30(i7,1x))";
|
||||
static char fmt_20[] = "(i2,\002:\002,30(f7.2,1x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___6 = { 0, 6, 0, fmt_10, 0 };
|
||||
static cilist io___9 = { 0, 6, 0, fmt_20, 0 };
|
||||
|
||||
|
||||
/* Parameter adjustments */
|
||||
p -= 26;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___6);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 30; ++j) {
|
||||
do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
for (i__ = 1; i__ <= 25; ++i__) {
|
||||
s_wsfe(&io___9);
|
||||
do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
|
||||
for (j = 1; j <= 30; ++j) {
|
||||
do_fio(&c__1, (char *)&p[i__ + j * 25], (ftnlen)sizeof(real));
|
||||
}
|
||||
e_wsfe();
|
||||
/* L30: */
|
||||
}
|
||||
return 0;
|
||||
} /* vis_ */
|
||||
|
||||
/* Subroutine */ int visi_(char *nam, integer *h__, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_10[] = "(a3,30(i3,1x))";
|
||||
static char fmt_20[] = "(i2,\002:\002,30(i3,1x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___10 = { 0, 6, 0, fmt_10, 0 };
|
||||
static cilist io___13 = { 0, 6, 0, fmt_20, 0 };
|
||||
|
||||
|
||||
/* Parameter adjustments */
|
||||
h__ -= 26;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___10);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 30; ++j) {
|
||||
do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
for (i__ = 1; i__ <= 25; ++i__) {
|
||||
s_wsfe(&io___13);
|
||||
do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
|
||||
for (j = 1; j <= 30; ++j) {
|
||||
do_fio(&c__1, (char *)&h__[i__ + j * 25], (ftnlen)sizeof(integer))
|
||||
;
|
||||
}
|
||||
e_wsfe();
|
||||
/* L30: */
|
||||
}
|
||||
return 0;
|
||||
} /* visi_ */
|
||||
|
||||
/* Subroutine */ int proces_(real *z__, real *rn, integer *xhat, real *px,
|
||||
/* Subroutine */ int proces_(real *z, real *rn, integer *xhat, real *px,
|
||||
integer *elmhat, integer *ltrhat, real *spdhat, integer *imax, real *
|
||||
pmax)
|
||||
{
|
||||
|
@ -339,10 +190,10 @@ static integer c__1 = 1;
|
|||
5,5,5 };
|
||||
|
||||
/* System generated locals */
|
||||
integer i__1;
|
||||
integer i1;
|
||||
|
||||
/* Local variables */
|
||||
static integer i__;
|
||||
static integer i;
|
||||
static real pin[750] /* was [25][30] */, lkhd[750];
|
||||
extern /* Subroutine */ int path_(integer *, integer *, real *, integer *,
|
||||
integer *, real *, integer *);
|
||||
|
@ -406,25 +257,14 @@ static integer c__1 = 1;
|
|||
/* TRANSITION PROBABILITY TO NEW STATE (TRPROB); */
|
||||
/* IDENTITY OF EACH NEW PATH EXTENDED (PATH); */
|
||||
/* LIKELIHOOD OF EACH STATE EXTENSION (LIKHD); */
|
||||
for (i__ = 1; i__ <= 750; ++i__) {
|
||||
/* P(I) = 1.0 */
|
||||
/* L110: */
|
||||
}
|
||||
i__1 = isave;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
ipath = i__;
|
||||
trprob_(&ipath, &lambda[i__ - 1], &dur[i__ - 1], &ilrate[i__ - 1],
|
||||
pin);
|
||||
/* CALL VISARL('DR1',DUR) */
|
||||
path_(&ipath, &lambda[i__ - 1], &dur[i__ - 1], &ilrate[i__ - 1],
|
||||
lamsav, dursav, ilrsav);
|
||||
/* CALL VIS('DRS', DURSAV) */
|
||||
/* CALL VISARR('LBD',LAMBDA) */
|
||||
/* CALL VIS('PIN', PIN) */
|
||||
likhd_(z__, rn, &ipath, &lambda[i__ - 1], &dur[i__ - 1], &ilrate[i__
|
||||
- 1], pin, lkhd);
|
||||
/* CALL VIS('LKH',LKHD) */
|
||||
/* L100: */
|
||||
|
||||
|
||||
i1 = isave;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
ipath = i;
|
||||
trprob_(&ipath, &lambda[i - 1], &dur[i - 1], &ilrate[i - 1], pin);
|
||||
path_(&ipath, &lambda[i - 1], &dur[i - 1], &ilrate[i - 1],lamsav, dursav, ilrsav);
|
||||
likhd_(z, rn, &ipath, &lambda[i - 1], &dur[i - 1], &ilrate[i- 1], pin, lkhd);
|
||||
}
|
||||
/* HAVING OBTAINED ALL NEW PATHS, COMPUTE: */
|
||||
/* POSTERIOR PROBABILITY OF EACH NEW PATH(PROBP); */
|
||||
|
@ -432,37 +272,22 @@ static integer c__1 = 1;
|
|||
/* CONDITIONAL MEAN ESTIMATE OF SPEED(SPROB); */
|
||||
probp_(p, pin, &isave, lkhd);
|
||||
sprob_(p, &isave, ilrsav, &pelm, elmhat, spdhat, px);
|
||||
/* CALL VISI('ILR', ILRSAV) */
|
||||
/* CALL VIS('P1:',P) */
|
||||
/* PRINT 111, Z, PX, SPDHAT, ELMHAT */
|
||||
/* 111 FORMAT('PROCES:',3(3X,F15.9), 3X,I3) */
|
||||
|
||||
*xhat = 0;
|
||||
if (*px > .5f) {
|
||||
*xhat = 1;
|
||||
}
|
||||
/* SAVE THE PATHS WITH HIGHEST PROBABILITY, AND */
|
||||
/* STORE THE VALUES CORRESPONDING TO THESE PATHS: */
|
||||
/* CALL VISI('ILS',ILRSAV) */
|
||||
|
||||
savep_(p, pathsv, &isave, imax, lamsav, dursav, ilrsav, lambda, dur,
|
||||
ilrate, sort, pmax);
|
||||
/* CALL VISARR('LBD',LAMBDA,Z,ISAVE,ELMHAT) */
|
||||
/* CALL VIS('P2:',P) */
|
||||
/* CALL VISARL('DR2',DUR) */
|
||||
/* CALL VISARR('ILR',ILRATE) */
|
||||
/* GOTO 900 */
|
||||
|
||||
|
||||
/* DO 900 INL=1, ISAVE */
|
||||
/* PRINT 112, INL, P(INL), PATHSV(INL), LAMBDA(INL), DUR(INL), */
|
||||
/* &ILRATE(INL), LKHD(SORT(INL)) */
|
||||
/* 112 FORMAT(1X, I3, 2X, F10.7, 2X, I3, 2X, I3, 2X,F6.1, 2X, I3, 2X, */
|
||||
/* &F10.5) */
|
||||
/* 2 F10.7) */
|
||||
/* L900: */
|
||||
/* UPDATE TRELLIS WITH NEW SAVED NODES, AND */
|
||||
/* OBTAIN LETTER STATE ESTIMATE: */
|
||||
|
||||
trelis_(&isave, pathsv, lambda, imax, &ipmax);
|
||||
/* L200: */
|
||||
|
||||
return 0;
|
||||
} /* proces_ */
|
||||
|
||||
|
|
150
transl.c
150
transl.c
|
@ -1,17 +1,72 @@
|
|||
/* transl.f -- translated by f2c (version 20100827).
|
||||
You must link the resulting object file with libf2c:
|
||||
on Microsoft Windows system, link with libf2c.lib;
|
||||
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
|
||||
or, if you install libf2c.a in a standard place, with -lf2c -lm
|
||||
-- in that order, at the end of the command line, as in
|
||||
cc *.o -lf2c -lm
|
||||
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
|
||||
|
||||
http://www.netlib.org/f2c/libf2c.zip
|
||||
*/
|
||||
|
||||
#include "f2c.h"
|
||||
|
||||
struct TREE {
|
||||
int dit,dah;
|
||||
char chr[5];
|
||||
} tree[] = {
|
||||
//dit,dah, chr
|
||||
{1,2, '*'}, // null state
|
||||
{3,4, 'E'}, // .
|
||||
{5,6, 'T'}, // -
|
||||
{7,8, 'I'}, // ..
|
||||
{9,10,'A'}, // .-
|
||||
{11,12,'N'}, // -.
|
||||
{13,14,'M'}, // --
|
||||
{15,16,'S'}, // ...
|
||||
{17,18,'U'}, // ..-
|
||||
{19,20,'R'}, // .-.
|
||||
{21,22,'W'}, // .--
|
||||
{23,24,'D'}, // -..
|
||||
{25,26,'K'}, // -.-
|
||||
{27,28,'G'}, // --.
|
||||
{29,30,'O'}, // ---
|
||||
{31,32,'H'}, // ....
|
||||
{33,34,'V'}, // ...-
|
||||
{35,36,'F'}, // ..-.
|
||||
{37,38,'Ü'}, // ..--
|
||||
{39,40,'L'}, // .-..
|
||||
{41,42,'Ä'}, // .-.-
|
||||
{43,44,'P'}, // .--.
|
||||
{45,46,'J'}, // .---
|
||||
{47,48,'B'}, // -...
|
||||
{49,50,'X'}, // -..-
|
||||
{51,52,'C'}, // -.-.
|
||||
{53,54,'Y'}, // -.--
|
||||
{55,00,'Z'}, // --..
|
||||
{57,00,'Q'}, // --.-
|
||||
{54,00,'Ö'}, // ---.
|
||||
{56,57,'Š'}, // ----
|
||||
{00,00,'5'}, // .....
|
||||
{00,00,'4'}, // ....-
|
||||
{00,00,'*'}, // ...-.
|
||||
{00,00,'3'}, // ...--
|
||||
{00,00,'É'}, // ..-..
|
||||
{00,00,'*'}, // ..-.-
|
||||
{00,00,'*'}, // ..--. D?
|
||||
{00,00,'2'}, // ..---
|
||||
{00,00,'*'}, //
|
||||
{00,00,'È'}, //
|
||||
{00,00,'+'}, //
|
||||
{00,00,'*'}, //
|
||||
{00,00,'*'}, //
|
||||
{00,00,'*'}, // J ?
|
||||
{00,00,'*'}, // .----
|
||||
{00,00,'1'},
|
||||
{00,00,'6'},
|
||||
{00,00,'/'},
|
||||
{00,00,'*'},
|
||||
{00,00,'Ç'},
|
||||
{00,00,'*'},
|
||||
{00,00,'Ĥ'},
|
||||
{00,00,'Ṅ'},
|
||||
{00,00,'8'},
|
||||
{00,00,'7'},
|
||||
{00,00,'9'},
|
||||
{00,00,'0'}
|
||||
};
|
||||
|
||||
/* Common Block Declarations */
|
||||
|
||||
struct {
|
||||
|
@ -38,7 +93,7 @@ static integer c__1 = 1;
|
|||
static char ispace[1] = " ";
|
||||
static integer spflag = 0;
|
||||
static integer nchar = 0;
|
||||
static integer lstltr = 5;
|
||||
static integer lstltr = 0;
|
||||
static integer ixlast = 0;
|
||||
static integer lstelm = 6;
|
||||
|
||||
|
@ -55,15 +110,17 @@ static integer c__1 = 1;
|
|||
static char fmt_1600[] = "(/,10x)";
|
||||
|
||||
/* System generated locals */
|
||||
integer i__1;
|
||||
integer i1;
|
||||
|
||||
/* Builtin functions */
|
||||
/* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, ixl, nblank, elmhat, ltrhat;
|
||||
static integer i, ixl, nblank, elmhat, ltrhat;
|
||||
static char ltrout[1];
|
||||
static int curstate = 0;
|
||||
static int newstate = 0;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___13 = { 0, 6, 0, fmt_5000, 0 };
|
||||
|
@ -80,6 +137,10 @@ static integer c__1 = 1;
|
|||
static cilist io___24 = { 0, 6, 0, fmt_1000, 0 };
|
||||
static cilist io___25 = { 0, 6, 0, fmt_1600, 0 };
|
||||
|
||||
/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
|
||||
/* .^ .~ .w .p -^ -~ -w -p ^. ^- ~. ~- w. w- p. p- */
|
||||
/* K=1 DIT, K=2 DAH, K=3 E-SPC, K=4 CHR-SPC, K=5 WRD-SPC, K=6 PAUSE */
|
||||
|
||||
|
||||
|
||||
/* THIS SUBROUTINE PRODUCES THE OUTPUT TEXT ON A CRT. */
|
||||
|
@ -91,34 +152,69 @@ static integer c__1 = 1;
|
|||
elmhat = blklam_1.ilami[(1600 + (0 + (blklam_1.ielmst[(0 + (0 + (*ltr - 1
|
||||
<< 2))) / 4] - 1 << 2)) - 1600) / 4];
|
||||
ixl = blklam_1.ilamx[elmhat - 1];
|
||||
/* PRINT 5, LTR, LSTLTR, IXL */
|
||||
/* 5 FORMAT('TRANSL LTR, LSTLTR, IXL:', I12, I12, I12) */
|
||||
|
||||
/* NO CHANGE FROM LAST - CONTINUE */
|
||||
|
||||
if (ixl == ixlast) {
|
||||
goto L700;
|
||||
}
|
||||
|
||||
// printf("\nltr: %d", *ltr);
|
||||
switch (*ltr)
|
||||
{
|
||||
/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
|
||||
/* .^ .~ .w .p -^ -~ -w -p ^. ^- ~. ~- w. w- p. p- */
|
||||
case 11: // ~.
|
||||
case 9: // ^.
|
||||
newstate = tree[curstate].dit;
|
||||
break;
|
||||
case 12: // ~-
|
||||
case 10: // ^-
|
||||
newstate = tree[curstate].dah;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
printf("%s",tree[curstate].chr);
|
||||
newstate = 0;
|
||||
break;
|
||||
default:
|
||||
// ltrhat = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
curstate = newstate;
|
||||
|
||||
/* KEYSTATE = 1 AND LAST ELEMENT WAS CSP, WSP OR PAUSE => PRINT LETTER */
|
||||
|
||||
if (ixl == 1 && lstelm >= 4) {
|
||||
goto L10;
|
||||
}
|
||||
|
||||
/* KEYSTATE = 0 AND LAST ELEMENT WAS DIT OR DAH => SAVE LETTER STATE */
|
||||
|
||||
if (ixl == 0 && lstelm <= 2) {
|
||||
goto L700;
|
||||
}
|
||||
goto L700;
|
||||
|
||||
/* LETTER OUT WILL BE LAST LETTER SAVED */
|
||||
L10:
|
||||
ltrhat = lstltr;
|
||||
i__ = blktrn_1.ltrmap[ltrhat - 1];
|
||||
s_copy(ltrout, blktrn_1.ialph + (i__ - 1), (ftnlen)1, (ftnlen)2);
|
||||
i = blktrn_1.ltrmap[ltrhat - 1];
|
||||
s_copy(ltrout, blktrn_1.ialph + (i - 1), (ftnlen)1, (ftnlen)2);
|
||||
nblank = blktrn_1.iblank[ltrhat - 1];
|
||||
elmhat = blklam_1.ilami[blklam_1.ielmst[ltrhat - 1] - 1];
|
||||
goto L40;
|
||||
// goto L40;
|
||||
goto L700;
|
||||
|
||||
s_wsfe(&io___13);
|
||||
do_fio(&c__1, (char *)&elmhat, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&nchar, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&i, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)&(*ltr), (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, (char *)<rhat, (ftnlen)sizeof(integer));
|
||||
do_fio(&c__1, ltrout, (ftnlen)1);
|
||||
|
@ -167,8 +263,8 @@ L100:
|
|||
}
|
||||
spflag = 1;
|
||||
/* PRINT ANY SPACES IN IBLANK BUFFER */
|
||||
i__1 = nblank;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
i1 = nblank;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
++nchar;
|
||||
s_wsfe(&io___16);
|
||||
do_fio(&c__1, ispace, (ftnlen)1);
|
||||
|
@ -188,8 +284,8 @@ L200:
|
|||
goto L211;
|
||||
}
|
||||
spflag = 1;
|
||||
i__1 = nblank;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
i1 = nblank;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
++nchar;
|
||||
s_wsfe(&io___18);
|
||||
do_fio(&c__1, ispace, (ftnlen)1);
|
||||
|
@ -208,8 +304,8 @@ L300:
|
|||
if (nblank == 0) {
|
||||
goto L311;
|
||||
}
|
||||
i__1 = nblank;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
i1 = nblank;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
++nchar;
|
||||
s_wsfe(&io___20);
|
||||
do_fio(&c__1, ispace, (ftnlen)1);
|
||||
|
@ -245,8 +341,8 @@ L550:
|
|||
goto L561;
|
||||
}
|
||||
spflag = 1;
|
||||
i__1 = nblank;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
i1 = nblank;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
++nchar;
|
||||
s_wsfe(&io___24);
|
||||
do_fio(&c__1, ispace, (ftnlen)1);
|
||||
|
|
233
trelis.c
233
trelis.c
|
@ -11,6 +11,9 @@
|
|||
*/
|
||||
|
||||
#include "f2c.h"
|
||||
#include <stdio.h>
|
||||
|
||||
//#define DEBUG 1
|
||||
|
||||
/* Common Block Declarations */
|
||||
|
||||
|
@ -24,103 +27,6 @@ struct {
|
|||
|
||||
static integer c__1 = 1;
|
||||
|
||||
/* Subroutine */ int visbuf_(char *nam, integer *buf, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_3[] = "(a3,\002:\002,65(i3,1x))";
|
||||
static char fmt_1[] = "(i3,\002:\002,65(i3,1x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___1 = { 0, 6, 0, fmt_3, 0 };
|
||||
static cilist io___4 = { 0, 6, 0, fmt_1, 0 };
|
||||
|
||||
|
||||
/* Parameter adjustments */
|
||||
buf -= 201;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___1);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 65; ++j) {
|
||||
do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
for (i__ = 1; i__ <= 25; ++i__) {
|
||||
s_wsfe(&io___4);
|
||||
do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
|
||||
for (j = 1; j <= 65; ++j) {
|
||||
do_fio(&c__1, (char *)&buf[j + i__ * 200], (ftnlen)sizeof(integer)
|
||||
);
|
||||
}
|
||||
e_wsfe();
|
||||
/* L2: */
|
||||
}
|
||||
return 0;
|
||||
} /* visbuf_ */
|
||||
|
||||
/* Subroutine */ int visbui_(char *nam, integer *k, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_5[] = "(a3,\002:\002,25(i6,1x))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___5 = { 0, 6, 0, fmt_5, 0 };
|
||||
|
||||
|
||||
/* PRINT 4,NAM,(J,J=1,25) */
|
||||
/* 4 FORMAT(A3,25(I6,1x)) */
|
||||
/* Parameter adjustments */
|
||||
--k;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___5);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 25; ++j) {
|
||||
do_fio(&c__1, (char *)&k[j], (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
return 0;
|
||||
} /* visbui_ */
|
||||
|
||||
/* Subroutine */ int visbua_(char *nam, integer *k, ftnlen nam_len)
|
||||
{
|
||||
/* Format strings */
|
||||
static char fmt_6[] = "(a3,\002:\002,200(i2))";
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer j;
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___7 = { 0, 6, 0, fmt_6, 0 };
|
||||
|
||||
|
||||
/* Parameter adjustments */
|
||||
--k;
|
||||
|
||||
/* Function Body */
|
||||
s_wsfe(&io___7);
|
||||
do_fio(&c__1, nam, (ftnlen)3);
|
||||
for (j = 1; j <= 200; ++j) {
|
||||
do_fio(&c__1, (char *)&k[j], (ftnlen)sizeof(integer));
|
||||
}
|
||||
e_wsfe();
|
||||
return 0;
|
||||
} /* visbua_ */
|
||||
|
||||
/* Subroutine */ int trelis_(integer *isave, integer *pathsv, integer *lambda,
|
||||
integer *imax, integer *ipmax)
|
||||
|
@ -450,39 +356,22 @@ static integer c__1 = 1;
|
|||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0 };
|
||||
|
||||
/* Format strings */
|
||||
static char fmt_2000[] = "(\002AVG # OF PATHS SAVED:\002,f4.2,\002 AVG D"
|
||||
"ECODE DELAY:\002,f4.2)";
|
||||
static char fmt_330[] = "(\002PERCENT OF TIME PATHS = 25: \002,f3.2,\002"
|
||||
" PERCENT OF TIME DELAY = 200: \002,f3.2)";
|
||||
static char fmt_2001[] = "(a1)";
|
||||
static char fmt_1000[] = "(\002SAME DELAY AS LAST:\002,i3)";
|
||||
static char fmt_1100[] = "(\002REVERSE ORDER:\002,i3)";
|
||||
static char fmt_1200[] = "(\002HIGHEST PROB:\002,i3)";
|
||||
|
||||
/* System generated locals */
|
||||
integer i__1;
|
||||
integer i1;
|
||||
|
||||
/* Builtin functions */
|
||||
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void),
|
||||
s_rsfe(cilist *), e_rsfe(void);
|
||||
|
||||
/* Local variables */
|
||||
static integer i__, k, ip, ieq, ltr, ndel;
|
||||
static int i, k, ip, ieq, ltr, ndel;
|
||||
static char wait[1];
|
||||
static integer isavg;
|
||||
static int isavg;
|
||||
static real xsavg, xmmax, xnmax;
|
||||
static integer ndlavg;
|
||||
static int ndlavg;
|
||||
static real xdlavg;
|
||||
extern /* Subroutine */ int transl_(integer *);
|
||||
|
||||
/* Fortran I/O blocks */
|
||||
static cilist io___24 = { 0, 6, 0, fmt_2000, 0 };
|
||||
static cilist io___25 = { 0, 6, 0, fmt_330, 0 };
|
||||
static cilist io___28 = { 0, 5, 0, fmt_2001, 0 };
|
||||
static cilist io___36 = { 0, 6, 0, fmt_1000, 0 };
|
||||
static cilist io___37 = { 0, 6, 0, fmt_1100, 0 };
|
||||
static cilist io___38 = { 0, 6, 0, fmt_1200, 0 };
|
||||
extern /* Subroutine */ int transl_(int *);
|
||||
|
||||
|
||||
|
||||
|
@ -510,17 +399,10 @@ static integer c__1 = 1;
|
|||
isavg = xsavg;
|
||||
ndlavg = xdlavg;
|
||||
blkend_1.iend = 0;
|
||||
s_wsfe(&io___24);
|
||||
do_fio(&c__1, (char *)&xsavg, (ftnlen)sizeof(real));
|
||||
do_fio(&c__1, (char *)&xdlavg, (ftnlen)sizeof(real));
|
||||
e_wsfe();
|
||||
s_wsfe(&io___25);
|
||||
do_fio(&c__1, (char *)&xmmax, (ftnlen)sizeof(real));
|
||||
do_fio(&c__1, (char *)&xnmax, (ftnlen)sizeof(real));
|
||||
e_wsfe();
|
||||
s_rsfe(&io___28);
|
||||
do_fio(&c__1, wait, (ftnlen)1);
|
||||
e_rsfe();
|
||||
|
||||
printf("\nAVG # OF PATHS SAVED:%4.2f,AVG DECODE DELAY:%4.2f)", xsavg, xdlavg);
|
||||
printf("\nPERCENT OF TIME PATHS = 25: %3.2f, PERCENT OF TIME DELAY = 200: %3.2f", xmmax, xnmax);
|
||||
|
||||
L10:
|
||||
xsavg = (xsavg * (ncall - 1) + *isave) / ncall;
|
||||
xdlavg = (xdlavg * (ncall - 1) + ndel) / ncall;
|
||||
|
@ -544,17 +426,17 @@ L30:
|
|||
if (n == ndelay + 1) {
|
||||
n = 1;
|
||||
}
|
||||
i__1 = *isave;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
pthtrl[n + i__ * 200 - 201] = pathsv[i__];
|
||||
lmdsav[n + i__ * 200 - 201] = lambda[i__];
|
||||
i1 = *isave;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
pthtrl[n + i * 200 - 201] = pathsv[i];
|
||||
lmdsav[n + i * 200 - 201] = lambda[i];
|
||||
/* L100: */
|
||||
}
|
||||
/* PERFORM DYNAMIC PROGRAM ROUTINE TO FIND CONVERGENT PATH: */
|
||||
k = 0;
|
||||
i__1 = *isave;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
ipnod[i__ - 1] = i__;
|
||||
i1 = *isave;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
ipnod[i - 1] = i;
|
||||
/* L180: */
|
||||
}
|
||||
L190:
|
||||
|
@ -563,13 +445,13 @@ L190:
|
|||
goto L700;
|
||||
}
|
||||
/* IF IP EQUALS INDEX OF HIGHEST PROBABILITY NODE, STORE NODE TO IPMAX */
|
||||
i__1 = *isave;
|
||||
for (ip = 1; ip <= i__1; ++ip) {
|
||||
i__ = n - k + 1;
|
||||
if (i__ <= 0) {
|
||||
i__ = ndelay + i__;
|
||||
i1 = *isave;
|
||||
for (ip = 1; ip <= i1; ++ip) {
|
||||
i = n - k + 1;
|
||||
if (i <= 0) {
|
||||
i = ndelay + i;
|
||||
}
|
||||
ipnod[ip - 1] = pthtrl[i__ + ipnod[ip - 1] * 200 - 201];
|
||||
ipnod[ip - 1] = pthtrl[i + ipnod[ip - 1] * 200 - 201];
|
||||
if (ip == *imax) {
|
||||
*ipmax = ipnod[ip - 1];
|
||||
}
|
||||
|
@ -577,8 +459,8 @@ L190:
|
|||
}
|
||||
/* CALL VISBUI('IPN',IPNOD) */
|
||||
/* IF ALL NODES ARE EQUAL,THEN PATHS CONVERGE: */
|
||||
i__1 = *isave;
|
||||
for (ieq = 2; ieq <= i__1; ++ieq) {
|
||||
i1 = *isave;
|
||||
for (ieq = 2; ieq <= i1; ++ieq) {
|
||||
if (ipnod[0] != ipnod[ieq - 1]) {
|
||||
goto L190;
|
||||
}
|
||||
|
@ -595,14 +477,14 @@ L190:
|
|||
if (ndel != ndelst) {
|
||||
goto L350;
|
||||
}
|
||||
i__ = n - ndel + 1;
|
||||
if (i__ <= 0) {
|
||||
i__ = ndelay + i__;
|
||||
i = n - ndel + 1;
|
||||
if (i <= 0) {
|
||||
i = ndelay + i;
|
||||
}
|
||||
ltr = lmdsav[i__ + ipnod[0] * 200 - 201];
|
||||
s_wsfe(&io___36);
|
||||
do_fio(&c__1, (char *)<r, (ftnlen)sizeof(integer));
|
||||
e_wsfe();
|
||||
ltr = lmdsav[i + ipnod[0] * 200 - 201];
|
||||
#ifdef DEBUG
|
||||
printf("\nSAME DELAY AS LAST: %d",ltr);
|
||||
#endif
|
||||
transl_(<r);
|
||||
goto L800;
|
||||
/* OTHERWISE,POINT OF CONVERGENCE HAS OCCURED */
|
||||
|
@ -612,26 +494,26 @@ L190:
|
|||
L350:
|
||||
kd = 0;
|
||||
ip = ipnod[0];
|
||||
i__1 = ndelst;
|
||||
for (k = ndel; k <= i__1; ++k) {
|
||||
i1 = ndelst;
|
||||
for (k = ndel; k <= i1; ++k) {
|
||||
++kd;
|
||||
i__ = n - k + 1;
|
||||
if (i__ <= 0) {
|
||||
i__ = ndelay + i__;
|
||||
i = n - k + 1;
|
||||
if (i <= 0) {
|
||||
i = ndelay + i;
|
||||
}
|
||||
ltrsv[kd - 1] = lmdsav[i__ + ip * 200 - 201];
|
||||
ip = pthtrl[i__ + ip * 200 - 201];
|
||||
ltrsv[kd - 1] = lmdsav[i + ip * 200 - 201];
|
||||
ip = pthtrl[i + ip * 200 - 201];
|
||||
/* L400: */
|
||||
}
|
||||
/* REVERSE ORDER OF DECODED LETTERS, SINCE THEY */
|
||||
/* WERE OBTAINED FROM THE TRELLIS IN REVERSE; */
|
||||
/* TRANSLATE EACH: */
|
||||
i__1 = kd;
|
||||
for (i__ = 1; i__ <= i__1; ++i__) {
|
||||
ltr = ltrsv[kd - i__];
|
||||
s_wsfe(&io___37);
|
||||
do_fio(&c__1, (char *)<r, (ftnlen)sizeof(integer));
|
||||
e_wsfe();
|
||||
i1 = kd;
|
||||
for (i = 1; i <= i1; ++i) {
|
||||
ltr = ltrsv[kd - i];
|
||||
#ifdef DEBUG
|
||||
printf("\nIN REVERSE ORDER: %d",ltr);
|
||||
#endif
|
||||
transl_(<r);
|
||||
/* L500: */
|
||||
}
|
||||
|
@ -641,18 +523,18 @@ L700:
|
|||
/* DELAY, SO TRANSLATE WHAT IS ON HIGHEST */
|
||||
/* PROBABILITY PATH: */
|
||||
ndel = ndelay;
|
||||
i__ = n - ndelay + 1;
|
||||
if (i__ <= 0) {
|
||||
i__ = ndelay + i__;
|
||||
i = n - ndelay + 1;
|
||||
if (i <= 0) {
|
||||
i = ndelay + i;
|
||||
}
|
||||
ltr = lmdsav[i__ + *ipmax * 200 - 201];
|
||||
s_wsfe(&io___38);
|
||||
do_fio(&c__1, (char *)<r, (ftnlen)sizeof(integer));
|
||||
e_wsfe();
|
||||
ltr = lmdsav[i + *ipmax * 200 - 201];
|
||||
#ifdef DEBUG
|
||||
printf("\nHIGHEST PROB: %d", ltr);
|
||||
#endif
|
||||
transl_(<r);
|
||||
/* PRUNE AWAY NODES WHICH ARE NOT ON THIS PATH: */
|
||||
i__1 = *isave;
|
||||
for (k = 1; k <= i__1; ++k) {
|
||||
i1 = *isave;
|
||||
for (k = 1; k <= i1; ++k) {
|
||||
if (ipnod[k - 1] == *ipmax) {
|
||||
goto L750;
|
||||
}
|
||||
|
@ -662,9 +544,6 @@ L750:
|
|||
}
|
||||
L800:
|
||||
ndelst = ndel;
|
||||
/* CALL VISBUA('LTR', LTRSV) */
|
||||
/* CALL VISBUF('LMD', LMDSAV) */
|
||||
/* CALL VISBUF('PTH', PTHTRL) */
|
||||
return 0;
|
||||
} /* trelis_ */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue