void skip_letter_in_line(struct segm *segm_ptr,int16_t x) /* This procedure sets up to SPQ.ns_symb adrress of letter with given x-coordinate in line. segm_ptr - adrress of some segment in line. x - x-coordinate. SPQ.ns_segm will be address of segment containing *SPQ.ns_symb. SPQ.skip_line_x - actual x-coordinate. */ { int16_t i; int16_t max; uchar *symb, *c; struct segm *segm_c; SPQ.end_l=NO; segm_ptr=cur_line(FRAGM,segm_ptr); symb=segm_ptr->string; i=1; if (*symb < 20) i=0; if (x == LAST_LETTER) max=MAX_LINE_LTH; else max=x; for (; i <= max; i++) { segm_c=segm_ptr; c=symb; symb=next_symb(YES,YES,YES,segm_ptr,symb); segm_ptr=SPQ.ns_segm; if (symb == NULL) { if (x == LAST_LETTER) if (c != NULL && *c > 20) { symb=c; SPQ.ns_segm=segm_c; } else { if (c != NULL) symb=c+define_lth(c); } SPQ.end_l=YES; break; } } SPQ.ns_symb=symb; SPQ.skip_line_x=i-1; if (SPQ.skip_line_x < 0) SPQ.skip_line_x=0; }
/* ********************************************************************** */ int16_t shift_left(int16_t v_s,struct segm * cur_segm, char * cur_symb) { char *c; /*int16_t l;*/ char *from; char *to; char *end; c=cur_symb; if (c == NULL) return(OK); /* end=(char *)cur_segm; end+=sizeof(struct segm)+cur_segm->busy_lth-1; */ end=&cur_segm ->string[cur_segm->busy_lth]; end+=0; from=(char *)cur_symb; to=from-v_s; while (from < end) *to++=*from++; cur_segm->busy_lth -=v_s; /***************************************************** if(cur_segm == SPQ.ns_segm) // THIS IS WRONG SPQ.ns_symb-= v_s; *****************************************************/ if(cur_segm == SPQ.ns_segm) { if (cur_segm->busy_lth+v_s == SPQ.ns_symb-(uchar *)cur_segm->string+2) { uchar *symb; /* Set SPQ.ns_symb onto the last line position */ skip_letter_in_line (cur_segm,-1) ; /* Set SPQ.ns_symb onto the last alt of the last pos */ do symb=SPQ.ns_symb; while((SPQ.ns_symb=next_symb(YES,NO,YES,SPQ.ns_segm,SPQ.ns_symb))!= NULL); SPQ.ns_symb=symb; } else SPQ.ns_symb -= v_s; } return(OK); }
char * find_byte_flag() { struct segm * sgm; char * b_f; sgm= SPQ.tab_ptr->tab_sheet_descr[SPQ.cur_sheet].first_segm; b_f=sgm->string; while(*b_f!=SS_SHEET_DESCR) { b_f=next_symb(NO,YES,YES,sgm,b_f); if(b_f==NULL) { #ifdef SYSPR_ERROR PRINTF("Dont make such a production,wrong file"); #endif ErrorExit(RLING_ERROR_WRONG_ED_FILE); } } SPQ.h_sheet_disk_descr_ptr=(struct sheet_disk_descr *)b_f; b_f=&SPQ.h_sheet_disk_descr_ptr->byte_flag; return(b_f); }
////////////////////////////////////////////////////////////////////////////////////////////////// //This procedure creats new stack. void create_new_stack(void) { int16_t i; char * symb; struct segm * segm; symb=SPQ.ns_symb; check_free_mem(); segm = SPQ.st.cur_segm; SPQ.stack = (struct state_stack_elem *)(SPQ.end_alloc_mem - sizeof(struct state_stack_elem)); stack_to_null(); SPQ.st.stack_level = 0; SPQ.st.cur_segm = SPQ.tab_ptr->tab_sheet_descr[SPQ.cur_sheet].first_segm; SPQ.ns_symb = SPQ.st.cur_segm->string; while (*SPQ.ns_symb != SS_SHEET_DESCR) { if(SPQ.ns_symb == NULL) { #ifdef SYSPR_ERROR PRINTF("Wrong file...\n"); #endif ErrorExit(RLING_ERROR_WRONG_ED_FILE); } SPQ.ns_symb = next_symb(NO,YES,NO,SPQ.ns_segm,SPQ.ns_symb); } SPQ.h_fragm_disk_descr_ptr = (struct fragm_disk_descr *)(SPQ.ns_symb + sizeof(struct sheet_disk_descr)); for (i=0; i < SPQ.cur_fragm; i++) SPQ.h_fragm_disk_descr_ptr++; SPQ.stack->kegl = SPQ.h_fragm_disk_descr_ptr->kegl; SPQ.stack->font = SPQ.h_fragm_disk_descr_ptr->font; SPQ.stack->language = SPQ.h_fragm_disk_descr_ptr->language;//03-29-94 02:54pm,Pit SPQ.stack->font_type = SPQ.h_fragm_disk_descr_ptr->font_type; SPQ.ns_symb = symb; SPQ.st.cur_segm = segm; }