/* ********************************************************************** */ int16_t checkart1 (SOBJ * obj, int16_t pi1, int16_t pi2, struct artstr * a) { int16_t type; switch (a->cond_sr1) { case BAD_S : if(obj->pos[pi1].orig.attr>PROB_TO_BRK) return(No); break; case DEL_S: if((type=symcode((char *)&(obj->pos[pi1].orig.code))) !=E_DL)if(type!=_APF) return(No); break; } switch(a->cond_sr2) { case BAD_S : if(obj->pos[pi2].orig.attr>PROB_TO_BRK) return(No); break; case DEL_S: if(type=symcode((char *)&(obj->pos[pi2].orig.code)) !=E_DL) if(type!=_APF)return(No); break; // Le + Vova 01-24-94 03:45pm case WID_S: if (!(MEMCHR(wide_let, *((char *)&(obj->pos[pi2].orig.code)) ,sizeof wide_let )) || language != LANG_RUSSIAN ) return (No); break; } switch(a->cond_sr12) { case EMB_S : if((int16_t)obj->pos[pi2].tif_ref.col- (int16_t)obj->pos[pi1].tif_ref.col - (int16_t)obj->pos[pi1].tif_ref.width>1) return(No); break; case FAX_M : if (!fax1x2) return(No); break; } /* The following euristic prevents merging of last 's' with previous low-attribute symbol. 08/06/92 03:15pm, L. */ if ( a->sr2) if( ( (obj -> pos[pi2].orig.code == 'S') || (obj ->pos[pi2].orig.code == 's') ) && ( pi2 == obj->part -> lth) && (obj ->pos[pi2].orig.attr >= PROB_TO_BRK) ) return NO; return(Ok); }
int16_t setart_new (SOBJ * obj, int16_t * pa, uchar code, uchar type) { int16_t posn, stdn; int16_t i; LT * lt; char * pc; uchar c; // Valdemar+Lepik for russian if (!code) goto Ok_setart_new; /* code=0 => nothing to do */ posn = obj->art_minpos; /* curr pos-buf used to construct new pos */ if (posn <= obj->pos_part[obj->pos_part_nmb]) /* obj->pos[] & []pos<-obj */ { /* ? overlapped ? */ #ifdef SYSPR_ERROR PRINTF( /* Yes: */ "\n SYSTEM ERROR (SPELLART.SETPART_NEW): No buf for pos to change !\n"); #endif goto No_setart_new; } posn--; memset (&(obj->pos[posn]),0,sizeof(SPOS)); obj->pos[posn].type_art = obj->type_art; /* it's art pos */ if (code==BLANK) /* blank ? */ { /* Yes: */ obj->pos[posn].type_sp|= (T_BLANK|T_MYBLANK); /* it's blank pos */ obj->pos[posn]. orig.code = BLANK; obj->pos[posn].alt[0].orig.code = BLANK; obj->pos[posn]. lt = (LT *)&(std.stdlt[0]); obj->pos[posn].alt[0].lt = (LT *)&(std.stdlt[0]); for (i=0, lt=(LT *)&(std.stdlt[0]); i<ABCSize; i++,lt++) /* set all possible alts A-Z: */ obj->pos[posn].alt[i].lt = lt; /* all ltrs in std */ } else /* No: certain alternative */ { obj->pos[posn]. orig.code = code; obj->pos[posn].alt[0].orig.code = code; obj->pos[posn]. orig.attr = PROB_ALLOWED; obj->pos[posn].alt[0].orig.attr = PROB_ALLOWED; obj->pos[posn]. type = type; obj->pos[posn].alt[0].type = type; c = code; pc = &c; if (symcode(pc)==_DIG) /* digit ? */ { /* Yes */ obj->pos[posn]. lt = (LT *)&(stddig[c-'0']); obj->pos[posn].alt[0].lt = (LT *)&(stddig[c-'0']); } else { c = _2cap(code); stdn = getstdn(pc); if (std.stdlt[stdn].code == c) /* letter ? */ { /* Yes */ obj->pos[posn]. lt = (LT *)&(std.stdlt[stdn]); obj->pos[posn].alt[0].lt = (LT *)&(std.stdlt[stdn]); } else { #ifdef SYSPR_ERROR PRINTF ( "\n SYSTEM ERROR (SPELLART.SETART_NEW): alt not found in std!!!\n"); #endif goto No_setart_new; } } } obj->part->posn[*pa] = (uchar)posn; (*pa)++; obj->art_minpos = posn ; /* curr pos-buf used to construct new pos */ Ok_setart_new: return (Ok); No_setart_new: return (No); }
int16_t check_compound (SOBJ * obj, LTIMG ** wrddef, struct dict_state * dict, user_voc voc_array[], int16_t voc_no ) {int16_t insect, depth= 0, prob = 1024; int16_t wordlth; int16_t lth; char save_word [sizeof(obj->wordchar)+1]; int16_t beg=0, loclth=0; char *out; SWORD *wrd; wrd = obj -> word; lth = wrd -> lth; wordlth = lth - 1; if ( wrd->voc_prob = check_art_dict (obj->wordchar, &wordlth, &(wrd->voc_kind)) ) { obj -> nmb_wrdfound++; obj -> lthok = wordlth; return Ok ; } memcpy (save_word, obj-> wordchar, sizeof (obj->wordchar)); out = obj -> wordchar; save_word[lth] = '.'; for ( insect = 0; insect <= lth; insect++) switch ( symcode((char *) (save_word + insect))) { case E_DL: case _TRM: if (!loclth) { depth++; beg++; out = obj -> wordchar; continue; } *out = 0; wrd -> lth = loclth; wrd -> voc_prob = 0; check_dict_voc (obj, wrddef + beg, dict, voc_array, voc_no); depth += obj -> lthok; if ( wrd -> voc_prob < prob) prob = wrd -> voc_prob; if ( !prob) { if ( obj -> lthok + 1 == loclth) depth++; goto GetOut; } /* The following line has been substituted to cover Satisfaction/Ouality not founding Le, 02.10.93. Moscow. */ /* depth ++; */ depth += 2; loclth = 0; beg = insect + 1; out = obj -> wordchar; continue; default: *(out++) = *(obj -> wordchar +insect); loclth ++; continue; } GetOut: memcpy (obj-> wordchar,save_word, lth); wrd -> voc_prob = prob; wrd -> lth = lth; if ( depth >= lth ) depth = lth -1; obj -> lthok = (( wrd -> lth < 6) && !( wrd -> type_sp & T_BLANK)) ? lth -1 : depth; return ( wrd -> voc_prob) ? Ok : No; }