/* file orth2key1.c */

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

#if !defined(LEX_COMPILE_ENVIRONMENT)
#include <plex/stdcenvf.h> /* phonlex compile environment for functions */
#endif

 void orth2key1(char *key, char *orth, int *perr)
/************************************************************/
/* Converts orthography (spelling) n *orth to lex key *key. */
/* On return, *perr > 0 signals an error.                   */
/************************************************************/
 {char *proc = "orth2key1";
  char *snor;
  char ccx[LONG_LINE], *caps = &ccx[0];
  char dcx[LONG_LINE], *diacritics = &dcx[0];
  int i;
/* coding */
 db_enter_msg(proc,0); /* debug only */
  *perr = 0;
  separate_orth(snor=key,caps,diacritics,orth);
 /* fill space with '=' in key, to make a token */
  str_encode(key," ","=");
 /* delete initial apostrophe in key */
  if (key[0] == '\'')
    for (i=0; i <= strlen(key); i++) key[i] = key[i+1]; 
 db_leave_msg(proc,0); /* debug only */
return;
 } /* end orth2key1 */
