SHELL uint editor() { char buf[80+1]; uint retcode; /* dbmsgout("ed_start"); */ ed.c='\0'; ed.fpe=op_temp("w+"); if (ed.fpe ==NULL) error(""); disp_text("editline"); retcode=TRUE; if (iscall()) { ch.frug.monitor=0; hcputs("--- 唯今 書き込み中 ---\r\n"); } for(;;) { /* dbprt("ed_main:",lpu(ftell(ed.fpe),0),"\n",NULL); */ /*dbmsgout("ed_main");*/ ed.c=getestr(buf); /* dbprintf("Editor:[%s]\n",buf);*/ if (iscntrl(ed.c)) ed.c='\0'; if (strchr(buf,'<')!=NULL) { sprt(where.param,"<verb>",buf,NULL); ed_write(); continue; } switch(*buf) { case '.': if (buf[1]=='\0' ||buf[1]=='.') { fclose(ed.fpe); goto ret; } continue; case '/': if (strlen(buf)<4) { switch(buf[1]) { case 'b': /* アーティクルにバイナリを付属する。*/ msgout(art.file!=ERROR?IC_err "一つのアーティクルに複数のファイルを付加できません。": pool_upload()? IC_ok "バイナリファイルをアップロードしました。" : IC_stop"バイナリの添付を中止しました。"); continue; case 'u': if (file_upload(ed.fpe)) msgout(IC_ok "テキストアップロードしました。"); fflush(ed.fpe); continue; case '/': fclose(ed.fpe); goto ret; case 'a': case 'q': /*dbmsgout("ed_abort");*/ fclose(ed.fpe); retcode=FALSE; goto ret; case 't': msgout("最初から読みだします。"); rewind(ed.fpe); while(fgets(buf,sizeof(buf),ed.fpe)) putz(buf); clearerr(ed.fpe); continue; case '?': disp_text("ed.hlp"); continue; } } case '\\': case '^': case '*': sprt(where.param,"<verb>",buf,NULL); ed_write(); continue; } strcpy(where.param,buf); ed_write(); } ret: if (iscall()) ch.frug.monitor=1; return retcode; }
void ed_make_word(CSTR_rast b, CSTR_rast e) { uchar *l,p; CSTR_rast c; UniVersions uni; int16_t k,i,n,h,wb; CSTR_rast_attr a; int16_t top,bottom,left,right; /* struct fragm_disk { uchar code; uchar fragm_numb; uint16_t depth; }; struct fragm_disk_descr { uchar code; uint16_t row; uint16_t col; uint16_t height; uint16_t w_width; char type; uchar kegl; uchar font; uchar language;//reserv; uchar type_underl; }; struct sheet_disk_descr { uchar code; char quant_fragm; uint16_t sheet_numb; uint16_t descr_lth; uchar byte_flag; uint16_t resolution; uint16_t incline; char tabl[13]; }; */ for(top=10000,bottom=0,left=10000,right=0,c=b;c&&c!=e;c=CSTR_GetNext(c)) { CSTR_GetAttr(c,&a); if( a.col<left ) left = a.col; if( a.col+a.w>right ) right = a.col+a.w; if( a.row<top ) top = a.row; if( a.row+a.h>bottom ) bottom = a.row+a.h; if( c==b ) { language=a.language; } } h = bottom-top-1; wb= (right-left-1+7)/8; // start sheet_disk_descr p =0x0a/*SS_SHEET_DESCR*//*f.code*/; ed_write((uchar*)&p,1); p =1/*f.quant_fragm*/; ed_write((uchar*)&p,1); n =0/*f.sheet_numb*/; ed_write((uchar*)&n,2); n =0x26/*f.descr_lth*/; ed_write((uchar*)&n,2); p =0/*f.byte_flag*/; ed_write((uchar*)&p,1); n =300/*f.resolution*/; ed_write((uchar*)&n,2); n =0/*f.incline*/; ed_write((uchar*)&n,2); p =0/*f.res1*/; ed_write((uchar*)&p,1); n =0/*f.res2-3*/; ed_write((uchar*)&n,2); n =0/*f.res4-5*/; ed_write((uchar*)&n,2); n =0/*f.res6-7*/; ed_write((uchar*)&n,2); n =0/*f.res8-9*/; ed_write((uchar*)&n,2); n =0/*f.res10-11*/; ed_write((uchar*)&n,2); n =0/*f.res12-13*/; ed_write((uchar*)&n,2); // start fragm_disk_descr p =0x0b/*SS_FRAGMENT*//*f.code*/; ed_write((uchar*)&p,1); n =0/*f.row*/; ed_write((uchar*)&n,2); n =0/*f.col*/; ed_write((uchar*)&n,2); n =h/*f.heigh*/; ed_write((uchar*)&n,2); n =wb/*f.w_width*/; ed_write((uchar*)&n,2); p =0/*FD_TYPE_TEXT*//*f.type*/; ed_write((uchar*)&p,1); p =10/*f.kegl*/; ed_write((uchar*)&p,1); p =0/*f.font*/; ed_write((uchar*)&p,1); p = language; ed_write((uchar*)&p,1); p =0/*f.type_underl*/; ed_write((uchar*)&p,1); // start fragm_disk p =0x0b/*SS_FRAGMENT*//*f.code*/; ed_write((uchar*)&p,1); p =0/*f.fragm_numb*/; ed_write((uchar*)&p,1); n =0/*f.depth*/; ed_write((uchar*)&n,2); for(c=b;c&&c!=e;c=CSTR_GetNext(c)) { CSTR_GetCollectionUni(c,&uni); if( uni.lnAltCnt && !uni.Alt[0].Code[0] ) continue; CSTR_GetAttr(c,&a); // start bitmap ref p =0/*SS_BITMAP_REF*/; ed_write((uchar*)&p,1); p =a.cpos; ed_write((uchar*)&p,1); n =a.r_row; ed_write((uchar*)&n,2); n =a.r_col; ed_write((uchar*)&n,2); n =a.h; ed_write((uchar*)&n,2); n =a.w; ed_write((uchar*)&n,2); // stop bitmap ref n=(int16_t)uni.lnAltCnt; if(n>7) n=7; if(n<1) n=1; for(k=i=0;k<n;) { p=uni.Alt[i].Prob; if( p&1 ) p--; if( !p ) p=2; // all odd propability for(l = &uni.Alt[i++].Code[0];*l && k<n;l++,k++) { // for ligas : strlen(uni.Alt[i].Code)>1 ed_write(l,1); if( k==n-1 ) p = p+1; // last even propability ed_write(&p,1); } } } return; }