/* file mbalint_prot.c */

#if !defined(COMPILE_ENVIRONMENT)
#include <gp/stdcenvf.h> /* std compile environment for functions */
#endif

void make_basic_int_al_prot(ALIGNMENT_INT_PROT *alnx)
/********************************************************************/
/* Reduces nsa and nsb to strings of non-zero, non-aux words. */
/********************************************************************/
{char *proc = "make_basic_int_al_prot";
 int i,iaux;
 PROTECTED_INT_STR *nsx;
db_enter_msg(proc,0); /* debug only */
/* remove null elements */
 remove_zeros(alnx->nsa->str);
 remove_zeros(alnx->nsb->str);
 alnx->aligned = F;
 /* expand aux symbols */
 if (alnx->naux > 0)
   {nsx = create_prot_int_str(10);
   /* expand A string aux symbols */
    nstrcpy_prot_p(nsx,alnx->nsa);
    alnx->nsa->str[0]=0;
    for (i = 1; i <= nsx->str[0]; i++)
      {if (nsx->str[i] > alnx->pcset->pctab_length)
         {/* word defined in aux tab */
          iaux = nsx->str[i] - alnx->pcset->pctab_length;
          if (iaux > alnx->naux)
            {fprintf(stderr,"*ERR:%s: iaux=%d,naux=%d\n",proc,iaux,alnx->naux);
             continue;
            }
          nstrcat_prot_p(alnx->nsa,alnx->auxtab[iaux]);
         }
       else nstrcat_prot_i(alnx->nsa,nsx->str[i]); /* regular word */
      }
   /* expand B string aux symbols */
    nstrcpy_prot_p(nsx,alnx->nsb);
    alnx->nsb->str[0]=0;
    for (i = 1; i <= nsx->str[0]; i++)
      {if (nsx->str[i] > alnx->pcset->pctab_length)
         {/* word defined in aux tab */
          iaux = nsx->str[i] - alnx->pcset->pctab_length;
          if (iaux > alnx->naux)
            {fprintf(stderr,"*ERR:%s: iaux=%d,naux=%d\n",proc,iaux,alnx->naux);
             continue;
            }
          nstrcat_prot_p(alnx->nsb,alnx->auxtab[iaux]);
         }
       else nstrcat_prot_i(alnx->nsb,nsx->str[i]); /* regular word */
      }
    destroy_prot_int_str(nsx);
   }
db_leave_msg(proc,0); /* debug only */
 return;
}
