/* file addstres.c */

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

void add_default_stress_prot(PROTECTED_INT_STR *nsx, pcodeset *pcdp,int i_default_stress)
/****************************************************************/
/* Adds the default stress mark <i_default_stress> before those */
/* syllabic segments in nsx->str that aren't already marked     */
/* for lexical stress, according to phoneset *pcdp.             */
/****************************************************************/
 {char *proc = "add_default_stress_prot";
  int i;
  PROTECTED_INT_STR *nsy;
  boolean stress_mark_precedes;
db_enter_msg(proc,2);
  nsy = create_prot_int_str(133);
  stress_mark_precedes = F;
  for (i=1; i <= nsx->str[0]; i++)
    {if (syllabic(nsx->str[i],pcdp) && (!stress_mark_precedes))
       {nstrcat_prot_i(nsy,i_default_stress);
       }
     nstrcat_prot_i(nsy,nsx->str[i]);
     if (stress_mark(nsx->str[i],pcdp)) stress_mark_precedes = T;
     else                               stress_mark_precedes = F;
    }
  dealloc_prot_int_str_guts(nsx);
  nsx->str = nsy->str;
  nsx->len = nsy->len;
  free(nsy);
db_leave_msg(proc,2);
  return;
 }
