//---------------------------------------------------------------------/ // File: zs.cpp Created: 5/31/99 / // from oe.cpp at 7:10am / // ...For processing files with... / // ...records of reclen < 80....... / // moded: 8/10/00 6:38am-> : am 10/14/00 1:35pm-> 2:00pm / // 10/15/00 7:05am-> 7:55am 10/16/00 1:45pm-> 2:20pm / // 10/17/00 1:43pm-> 2:15pm 10/18/00 7:35am-> 8:50am / // 10/18/00 1:50pm-> 2:45pm 10/19/00 7:30am-> 8:00am / // 10/23/00 7:48am-> 8:15am 10/28/00 11:30am->11:40am / // 11/11/00 8:45am-> 8:55am 11/13/00 10:32am->10:37am / // 11/26/00 8:25am-> 8:40am 1/12/01 1:22pm-> 2:00pm / // 1/ 6/01 10:40am->11:30am 4/ 7/01 8:10am-> 8:30am / // 4/ 8/01 6:30am-> 8:30am 4/ 9/01 8:00am-> 9:15am / // 4/ 9/01 1:35pm-> 2:25pm 4/10/01 6:10am-> 7:15am / // 4/10/01 9:40am->10:50am 4/11/01 6:30am-> 7:55am / // 4/12/01 6:15am-> 6:47am 4/13/01 2:00pm-> 2:30pm / // 4/14/01 6:20am->11:34am 4/15/01 8:20am-> 9:25am / // 4/16/01 6:25am-> 7:35am 4/17/01 6:40am-> 8:15am / // 6/ 8/01 10:00am->11:15am 6/ 9/01 6:05am-> 6:30am / // 6/21/01 7:08am-> 8:36am 6/21/01 10:00am->11:06am / // 6/21/01 2:05pm-> 2:25pm 6/22/01 7:30am-> 9:00am / // 6/23/01 8:05am-> 8:27am 6/24/01 7:58am-> 8:03am / // 7/18/01 8:42am-> 8:55am 7/18/01 10:45am->11:38am / // 7/19/01 6:09am-> : am 10/ 2/01 1:40pm-> 1:55pm / // 10/ 3/01 7:40am-> 8:15am 10/ 3/01 10:25am->11:20am / // 10/ 3/01 1:15pm-> 1:25pm 10/ 4/01 8:15am-> 8:55am / // 10/ 5/01 9:40am->10:00am 10/ 6/01 9:35am->10:00am / // / /01 : am-> : am / /01 : pm-> : pm / //---------------------------------------------------------------------/ // triplex_font, small_font, sansserif_font, gothic_font // TRIPLEX_FONT #1 SMALL_FONT #2 SANS_SERIF_FONT #3 GOTHIC_FONT #4 #include #include #include #include #include #include #include #include FILE *fle; struct text_info tscrn; struct find_t ffblk; long int gtc(char *msg, char *ch, int ff); void numseg(void); int ansichk(char *msg, char *ch, int f1); int seginf(int x); void getdir(void); void sort(int i, int j, int t, int s); void chgdir(void); void intrvl(void); void lead0(int x,char *rslt); void prtbx(int x, int y, int xr, int yl, int clr, int clr2, char *ms); char bs[81], xs[81], ys[81], zs[81], rrs[81], fnme[77], tms[15], mn[4], dy[4], yr[4], ld[4], tme[15], buf, *fdp, *spt, *cpt; char fbuf[25][77] = { "", "Tnfo", "TmpTsk", "d:\\", "f:\\smldos.log" }, crdr[77] = { " :\\" }, nmbrs = 1, trns[9] = { "ù " }, clrs[ 9] = { 1, 4, 6, 8, 10, 11, 12, 15, '\0' }, tpbx[81] = { "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" }, sdbx[81] = { "³ " " " }, btbx[80] = { "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" }, blks[80] = { " " " " }; int i, j, k, o, x, y, z, r, s, t, c, fc=4, sint, et, w1, xp, yp, ii, jj, ww, gbt, b=1, n, q=1, h=25, gw=2, gb, gpgm=9, gmod=2; int opbx, op=1, bxlc[5] = { 1, 14, 26, 40, 56 }; char opcds[5][10] = { "$i0¨bcx", "$esd)(/", "$p\\r l=", "$vuhft5" , "$mWSwaA" }, opnms[5][7][20] = { "", " Input ", " Output ", " Save & exit ", " 1st record ", " Last record ", " Exit ", "", " Edit ", " Swap ", " Delete ", " Shift rght ", " Shift left", " Prev edit ", "", " Position ", " Even page ", " Search ", " Line nmbrs ", " Lines/screen ", " Info bar ", "", " Directory scan ", " Sort recs ", " Graphics info ", " Graph recs ", " Clip portal", " Edit rtn info ", "", " Lines move ", " Max len move ", " String move ", " Min len move ", " De-seg lines", " Seg lines " }; //unsigned char Oc, cmma, opts, sn, po, swg = 0; unsigned char Oc, swN = 1, opts, po, sn, cr = 219, nsg, swg = 0; int long d=0, m, cskp, cmsd, sl, lskp, lmsd; int ROW=1400, COL=79; char huge ns[1401][81]; // int ROW=5200, COL=79; // char huge ns[5201][81]; //=========================================================// int main() { registerbgifont(triplex_font); registerbgidriver(EGAVGA_driver); if(_argv[1]) { strcpy(fnme, _argv[1]); fc = fc + 1; strcpy(fbuf[fc], fnme); goto inptstrt; } start: opts = 0; begin: textattr(112); window( 1, 1, 80, 25); // clear screen //- - - - - - - - - - - - - - - - - - - - - - - - - k = q; for (j=q; jROW ) { cprintf("\r"); goto blankit; } if (k999) { gotoxy( 77, wherey()); cprintf("%4i", k); } } else cprintf("\r\n"); k = k + 1; }//end main print j for loop //- - - - - - - - - - - - - - - - - - - - - - - - - //ÄÄÄÄoptn tbleÄÄÄÄ if (po) goto optbrnch; if (!opts || swg) goto getopt; prtbx( 4, 17, 71, 8, 1, 112, "ÄÄÄopts"); for (i=1;i<=6;i++) { for (j=0;j<=4;j++) { gotoxy( bxlc[j], i); cprintf("%s", opnms[j][i]); } } gotoxy( bxlc[opbx], op); textattr( 7); cprintf("%s", opnms[opbx][op]); mveopt: _setcursortype(0); i = getch(); if (i==0) i = getch() + 100; _setcursortype(2); textattr(112); switch (i) {case 180 : gotoxy( bxlc[opbx], op); cprintf("%s", opnms[opbx][op]); op = op + 1; if (op>6) op = 1; gotoxy( bxlc[opbx], op); textattr( 7); if (op==3 && opbx==0) textattr( 76); cprintf("%s", opnms[opbx][op]); goto mveopt; case 172 : gotoxy( bxlc[opbx], op); cprintf("%s", opnms[opbx][op]); op = op - 1; if (op<1) op = 6; gotoxy( bxlc[opbx], op); textattr( 7); if (op==3 && opbx==0) textattr( 76); cprintf("%s",opnms[opbx][op]); goto mveopt; case 177 : gotoxy( bxlc[opbx], op); cprintf("%s", opnms[opbx][op]); opbx = opbx + 1; if (opbx>4) opbx = 0; gotoxy( bxlc[opbx], op); textattr( 7); if (op==3 && opbx==0) textattr( 76); cprintf("%s", opnms[opbx][op]); goto mveopt; case 175 : gotoxy( bxlc[opbx], op); cprintf("%s", opnms[opbx][op]); opbx = opbx - 1; if (opbx<0) opbx = 4; gotoxy( bxlc[opbx], op); textattr( 7); if (op==3 && opbx==0) textattr( 76); cprintf("%s", opnms[opbx][op]); goto mveopt; case 13 : Oc = opcds[opbx][op]; if (Oc=='f') goto grph; po = 1; goto start; }// end swtch loop Oc = i; goto optbrnch; //---------------------------- // getopt: textattr(112); _setcursortype(0); if (swg==0) { i = getch(); if (i==0) i = getch() + 100; } Oc = i; _setcursortype(2); optbrnch: swg = 0; ww = 80; i = Oc; po = 0; window( 1, 1, 80, 25); switch (i) {case 160 : case 175 : q = q - h; goto start; case 161 : case 177 : q = q + h; goto start; case 9 : case 180 : q = q - 1; goto start; case 27 : case 172 : q = q + 1; goto start; }//end 1st swtch branch d = 0; for (j=b; j<=n; j++) d = d + strlen(ns[j]); sprintf( xs,"%c %i->%i %s", Oc, b, n, fnme); sprintf( ys,"Ä%c %i->%iÄ", Oc, b, n); switch (i) {case 'f' : goto grph; case '=' : prtbx( 4, 5, 72, 3, 8, 7, ""); ltoa(d, zs, 10); spt= fnme; x = strlen(fnme); if (x>25) spt = spt- 25 + x; cprintf(" %-25s %6s %4i->%-4i [%iX%i] zs" " %4i %-2i" , spt, zs, b, n, ROW, COL, q, h); //prnt info _setcursortype(0); prtbx( 51, 3, 14, 3, 8, 112, ""); fgretme: _strtime(tme); // °hh:mm:ss° <- tme str var if (tme[0]==48) tme[0] = 32; strcpy(bs, "am"); if (tme[0]==49 && tme[1]>49) { strcpy(bs, "pm"); tms[0] = tme[0]; tms[1] = tme[1]; tms[2] = 0; k = atoi(tms) - 12; sprintf(tms, "%2i", k); tme[0] = tms[0]; tme[1] = tms[1]; }//end pm block strcat(tme, bs); gotoxy( 1, 1); cprintf(" %s", tme); if (kbhit()==0) goto fgretme; goto hold; case 168 : goto ortn; case 47 : goto entredit; case 32 : nmbrs = (!nmbrs && 1); goto start; case 100 : strcat(ys, "Ädelete"); prtbx( 19, 10, 25, 4, 6, 116, ys); goto del; case ')' : strcat(ys, "Äright"); prtbx( 19, 10, 25, 4, 8, 112, ys); goto del; case '(' : strcat(ys, "Äleft"); prtbx( 19, 10, 25, 4, 8, 112, ys); goto del; case 't' : prtbx( 21, 6, 29, 5,-105, 7, "ÄÄÄ clipboard portal "); et = gtc(" start rec #:", bs, 0); c = 0; clrscr(); if (bs[0]==0) et = 1; cprintf(" portal is open\r\n" " can Paste at line %i\r\n" " press F12 to close portal", et); window( 1, 1, 80, 25); prtbx( 1, 11, 80, 6,-105, 7, xs); chrloop: i = getch(); if (i==0) i = getch() + 100; chkchr: if (i==234) goto start; if (i==13) { ns[et][c] = 0; c = 0; cprintf("%s\r\n", ns[et]); et = et + 1; if (et>=ROW) et = ROW; goto chrloop; } ns[et][c] = i; c = c + 1; if (c==COL) { ns[et][c] = 0; c = 0; cprintf("%s\r\n", ns[et]); et = et + 1; if (et>=ROW) et = ROW; i = getch(); if (i==13) goto chrloop; goto chkchr; } goto chrloop; case 48 : strcat(ys, "ÄÄfile output"); prtbx( 15, 8, 52, 6, 0, 116, ys); goto read; case 105 : strcat(ys, "ÄÄfile input"); prtbx( 15, 8, 52, 5, 0, 112, ys); goto read; case 'a' : strcat(ys, "ÄDesegment lines"); goto lnesegs; case 'A' : strcat(ys, "ÄSegment lines"); goto lnesegs; case 109 : strcat(ys, "Ämove"); prtbx( 16, 11, 22, 4, 8, 112, ys); goto move; case 'W' : strcat(ys, "ÄÄmax length move"); prtbx( 16, 9, 35, 5, 8, 112, ys); goto move; case 'w' : strcat(ys, "ÄÄmin length move"); prtbx( 16, 9, 35, 5, 8, 112, ys); goto move; case 'S' : strcat(ys, "ÄÄselect string move"); prtbx( 12, 9, 55, 5, 8, 112, ys); goto move; case 114 : strcat(xs, "ÄÄsearch"); prtbx( 3, 14, 74, 11, 1, 112, xs); goto srch; case 115 : strcat(ys, "ÄÄÄswap"); prtbx( 12, 7, 48, 7, 0, 113, ys); goto swap; case 'v' : strcat(ys, "ÄÄÄdirectory scan"); prtbx( 9, 11, 62, 5, 0, 113, ys); goto dir; case 'u' : strcat(ys, "ÄÄsort"); prtbx( 15, 9, 34, 5, 1, 112, ys); intrvl(); t = gtc(" sort position ", xs, 0); s = gtc("\r\n sort string length: ", xs, 0); sort( i, j, t, s); goto start; case 'h' : prtbx( 39, 5, 30, 12, -64, 63, "hÄÄ Graphics Screen Info"); cprintf(" Key Function\r\n"); cprintf(" ÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r\n"); cprintf(" dot expand\r\n"); cprintf(" comma compress\r\n"); cprintf(" -> move right\r\n"); cprintf(" <- move left \r\n"); cprintf(" 1-9 align on hundreds\r\n"); cprintf(" F1-F9 align on thousands\r\n"); cprintf(" space return to 0\r\n"); cprintf(" others exit graph"); goto hold; case '5' : prtbx( 9, 5, 30, 6, -64, 63, "5ÄÄ Edit Screen Info"); cprintf ("for option press Enter key,\r\n" "then press option code key:\r\n" " cùdùeùiùjùkùlùmùrùxùyùz\r\n" " spaceùEnter"); goto hold; case 92 : goto level; }//end 2nd swtch branch if (i>33) prtbx( 18, 10, 21, 3, 8, 113, xs); switch (i) {case 120 : return(0); case 'l' : cprintf("<%i> ", h); x = gtc("scrn len: ", xs, 0); if (x>0) h = x; goto start; case 112 : goto scrn_strt; case 98 : b = gtc("1st rec:", xs, 0); goto start; case 99 : n = gtc("last rec:", xs, 0); goto start; case 101 : goto edt; }//end 3rd swtch branch opts = (!opts && 1); goto begin; //===================================================// hold: textattr(112); opts = 1; goto getopt; //put scrn on rec// scrn_strt: q = gtc("rec #:", xs, 0); if (!xs[0]) q = 1; level: q = (q/h)*h + 1; goto start; //---dir rtn----// strchr("+-*/2", Oc)!=NULL dir: getdir(); gtc("scan directory: ", xs, 1); strcpy(zs, "\\*.*"); if (strchr(xs, '*')!=NULL) { for (i=strlen(xs);i>0;i--) if (xs[i]=='\\') break; k = 0; for (j=i;j<=strlen(xs);j++) { zs[k] = xs[j]; k = k + 1; } if (i==2) i = 3; xs[i] = 0; } if (xs[0]) { clrscr(); chgdir(); } strcpy(xs, crdr); if (strlen(xs)==3) xs[2] = 0; strcat(xs, zs); clrscr(); cprintf("scan directory: %s", xs); j = gtc("\r\nscan target: ", ys, 0); if (ys[0]==0) goto start; sprintf(ns[j], " %s", xs); j = j + 1; i = j; m = 0; d = _dos_findfirst(xs, 63, &ffblk); while (!d) { x = ffblk.attrib; ys[0] = 0; ltoa(ffblk.size, zs, 10); t = ffblk.wr_time / 2048; y = ffblk.wr_time - (t * 2048); y = y / 32; lead0(y, tms); s = ffblk.wr_date / 512; y = ffblk.wr_date - (s * 512); y = y / 32; lead0(y, mn); if (mn[0]==48) mn[0] = 32; y = ffblk.wr_date % 32; lead0(y, dy); y = s + 80; if (y>=100) y = y - 100; lead0(y, yr); if (x>=32) { strcat(ys, "a"); x = x - 32; } if (x>=16) { strcpy(zs, "Dir "); x = x - 16; m = m + 1; } if (x>= 8) { strcpy(zs, "Label "); x = x - 8; m = m + 1; } if (x>= 4) { strcat(ys, "s"); x = x - 4; } if (x>= 2) { strcat(ys, "h"); x = x - 2; } if (x>= 1) strcat(ys, "r"); sprintf(ns[j], "%-12s %-4s%9s %s-%s-%s %2i:%sa", ffblk.name, ys, zs, mn, dy, yr, t, tms); if (t>=12) ns[j][42] = 'p'; if (s>=20) ns[j][33] = '/'; d = _dos_findnext(&ffblk); if (j"); itoa( n, xs, 10); outtext(xs); setcolor(8); moveto( 0, 132); linerel( 639, 0); regrph: setviewport( 0, 133, 639, 479, 0); clearviewport(); setcolor(8); t = 640/gw; itoa( gb, xs, 10); outtextxy( 2, 326, xs); strtfile: moveto( 0, 317); //strt file grph for (x=0;x<=t;x++) { xp = x + gb; if (xp>ROW) goto nextrec; z = strlen(ns[xp]); for (y=0;y=640) break; if (xp%100==0 && x>0) { linerel( 0, 10); moverel( 0, -10); } linerel( gw, 0); } // end file graph loop itoa(xp, xs, 10); outtextxy( 600, 326, xs); if ((bt+gb && n>t+gb)) goto endfilechk; setcolor(15); if (gb<=b && b<=gb+t-1) { moveto( gw*(b-gb), 317); linerel( 0, 5); if (b>=n) { if (gb<=n && n<=gb+t-1) { moveto(gw*(n-gb), 317); linerel( 0, 5); } goto endfilechk; } if ((n-gb)*gw<=639) { linerel( (n-b)*gw, 0); linerel( 0,-5); } else linerel( 639-gw*(b-gb), 0); } //end if else { if (b>=n) { if (gb<=n && n<=gb+t-1) { moveto(gw*(n-gb), 317); linerel( 0, 5); } goto endfilechk; } moveto( 0, 322); if ((n-gb)*gw<=639) { linerel( gw*(n-gb), 0); linerel( 0,-5); } else linerel(639, 0); } //end 1st else endfilechk: i = getch(); if (i==0) i = getch() + 100; if (i==120) i=33; switch (i) {case '.' : gw = gw + 1; goto regrph; case ',' : gw = gw - 1; if (gw<1) { gw = 1; goto endfilechk; } goto regrph; case ' ' : gb = 0; gw = 1; gbt = 0; goto regrph; case 177 : if (gb==0) goto endfilechk; gb = gb - 24; if (gb<0) gb = 0; gbt = 1000 * (gb / 1000); goto regrph; case 175 : gb = gb + 24; gbt = 1000 * (gb / 1000); goto regrph; } //end swtch block if (48COL) y = COL; for (r=0;rCOL) x = COL - m; if (m==COL) x = 0; ys[x] = 0; strcpy(zs, ys); strcat(zs, ns[k]); strcpy(ns[k], zs); } if (Oc=='(') { if (y>=m) { ns[k][0] = 0; continue; } s=0; for (r=y;r<=m;r++) { ns[k][s] = ns[k][r]; s = s + 1; } } }//end loop goto start; //-line segments--// lnesegs: prtbx( 16, 11, 30, 4, 1, 112, ys); intrvl(); s = 1; if (Oc=='A' && xs[0]==0) goto start; for (k=i;k<=j;k++) { if (Oc=='a') ns[k][80] = 0; if (Oc=='A') ns[k][80] = s; s = s + 1; if (s>122) s = 1; } goto start; //-move file recs-// move: intrvl(); t = gtc(" trgt: ", xs, 0); if (!xs[0] || (i<=t && t<=j)) goto start; if (Oc=='W') jj = gtc("\r\nmax line length: ", xs, 0); if (Oc=='w') jj = gtc("\r\nmin line length: ", xs, 0); if (Oc=='S') gtc("\r\nstring:", xs, 1); if (!xs[0]) goto start; if (jt && seginf(t)>1) goto prtsegerr; if (seginf(i)==3 || seginf(j)==3 || seginf(t)==3) {prtsegerr: sprintf(ys, "Ä%i->%i==>%iÄ", i, j, t); prtbx( 16, 11, 22, 4, 6, 116, ys); cprintf("line segment error\r\n continue?(y):"); buf = getch(); if (buf!=121) goto start; } mventr: //------------------------- x = -1; //| 79 x=-1 if (jjj) ii = 1; if (Oc=='w') if (strlen(ns[k])", xs, 48); // if (!r) goto start; // s = ansichk("\r\nstr2>", ys, 48); // for (k=i;k<=j;k++) // {zs[0] = 0; z = 0; // strcpy(bs, ns[k]); // spt = bs; // strtswap: //-------------+ if (strlen(zs) + //| strlen(spt)+s-r>COL ) //| goto endswap; //| fdp = strstr(spt, xs); //| if (fdp==NULL) goto endswap; //| t = fdp - spt; //| y = 0; //| for (x=z;x", xs, 48); if (xs[0]==0) { cprintf("\rsegment search?(y):"); buf = getch(); cprintf("\r"); clreol(); if (buf!=121) cprintf("non-empty: "); else cprintf("segments: "); for (i=0;i<=ROW;i++) { if (buf!=121) { if (ns[i][0]) cprintf("%i ", i); } else if (ns[i][80]) cprintf("%i ", i); }//end i loop goto endsrch; }// end if block cprintf("\r<%s>: ", xs); clreol(); for (i=0;i 13,10 lskp = 0; cskp = 0; lmsd = 0; cmsd = 0; sint = n; newrec: buf = fgetc(fle); z = 0; c = 0; bs[0] = 0; bs[80] = 0; chkbuf: if (feof(fle)) goto endr; if (buf==13 && !sn) { buf = fgetc(fle); goto chkbuf; } if (buf==0 || buf==8 || buf==7) { buf = trns[buf]; sn = 1; } c = c + 1; if (buf==10) { buf = 32; if (!sn) { bs[c-1] = 0; goto fillrec; } if (sn && z) { if (c<2) c = 2; bs[c-2] = 0; goto fillrec; } } if (c>79) { bs[79] = 0; sl = sl - 1; if (sl<0) { if (n122) s = 1; bs[80] = s; } z = 0; if (buf==13) { buf = 32; z = 1; } bs[c-1] = buf; buf = fgetc(fle); goto chkbuf; fillrec: sl = sl - 1; if (sl<0) { if (n%-i %s\r\n %s", b, n, zs, fnme); if (!lskp && !lmsd) goto hold; } m = 0; for (j=sint+1; j<=n; j++) m = m + strlen(ns[j]); ltoa(m, zs, 10); if (lskp || lmsd) { prtbx( 8, 15, 47, 7, 1, 112, "ÄÄ***Caution - some file data was lost***"); cprintf(" Lines read: %i, Characters read: %6s\r\n", n-sint, zs); ltoa(cskp, zs, 10); ltoa(cmsd, xs, 10); ltoa(lskp, tms, 10); ltoa(lmsd, bs, 10); cprintf("Data lost:\r\n"); cprintf("---------- file lines characters\r\n"); cprintf("start of file %6s %6s\r\n", tms, zs); cprintf(" end of file %6s %6s", bs, xs); goto hold; } po = 1; Oc = '='; goto begin; ortn: _setcursortype(0); cprintf("\r..writing file..."); clreol(); if ((fle=fopen(fnme, "w"))==NULL) goto err; for (i=b;i<=n;i++) { for (k=0;k=0) { clreol(); cprintf("%s\r\n", ns[i]); } xp = wherex(); yp = wherey(); clreol(); cprintf("%s\r\n", bs); clreol(); for (i=et+1;i31) goto gdchr; switch (i) { case 160 : case 175: w1 = w1 - 1; if (w1<0) { w1 = 0; goto strte; } if (w1==78) { cprintf(" "); gotoxy( 79, -1+wherey()); } else cprintf(" \b\b"); goto strte; //end left movemnt case 161 : case 177: if (w1>=c) goto strte; w1 = w1 + 1; cprintf(" "); goto strte; //end right mvement case 9 : case 180: if (et0 ) { strcpy(ns[et], bs); ns[et][80] = bs[80]; et=et-1; goto redit; } goto strte; case 159 : case 13 : goto eopt; case 171: w1 = 0; cprintf("\r"); clreol(); goto strte; //strt of rec case 179: if (c) w1 = c - 1; else { w1 = 0; cprintf(" \r"); } goto endprtsgs; //end end of rec pos blck }//end sw blk goto strte; gdchr: if (w1>=c) goto addch; bs[w1] = Oc; w1 = w1 + 1; gotoxy(wherex(), wherey()-1); cprintf("%c", Oc); gotoxy(wherex(), wherey()+1); cprintf("\b "); goto strte; addch: if (w1+1>COL) goto strte; bs[w1] = Oc; w1 = w1 + 1; bs[w1] = 0; c = c + 1; gotoxy(wherex(), wherey()-1); cprintf("%c", Oc); gotoxy(wherex(), wherey()+1); cprintf("\b "); goto strte; eopt: cprintf("%c\b", 'O'); i = getch(); Oc = i; if (i==0) i = getch() + 100; switch (i) {case 0 : goto eopt; case 'x': numseg(); goto start; case 159: case 13: strcpy(ns[et], bs); ns[et][80] = bs[80]; goto entredit; case 39 : cprintf("%c\b", 68); goto insdel; case 92 : cprintf("%c\b", 73); insdel: z = gtc( "", zs, 232); if (Oc==39 || Oc=='k') { if (z+w1>c) z=c-w1; for (i=0;iCOL) { z = COL - c; zs[z] = 0; } strcpy(xs, bs); xs[w1] = 0; strcat(xs, zs); for (i=w1;i<=c;i++) xs[i+z] = bs[i]; strcpy(bs, xs); }//end insert block goto prntedit; //end insert/delete blck case 'c' : case 'y' : if (Oc=='y') { for (i=0;i", xs, 0); if (i>j) j = i; cprintf("\rintrvl: %i->%i \r\n", i, j); return; } //--num segs----// ns[i][160] && (ns[i][160]>=ns[i-1][160]) void numseg(void) { s = 1; for (i=1;i=ROW) break; } }//end k loop //end i loop return; } //------get strs for rtns------// long int gtc(char *msg, char *bs, int ff) { int w=0, c=0, i, mx, my, f=0, tc; bs[0] = 0; gettextinfo(&tscrn); tc = tscrn.attribute; if (ff>199) { tc = ff - 200; ff = 2; } if (ff>2) { tc = ff; ff = 1; } cprintf("%s", msg); mx = wherex(); my = wherey(); prntedit: gotoxy( mx, my); i = c - strlen(bs); if (i<0) i = 0; blks[i] = 0; textattr( tc); cprintf("%s", bs); textattr(tscrn.attribute); cprintf("%s", blks); blks[i] = 32; postn: if ( mx+w<=ww) gotoxy( mx+w, my); else gotoxy( mx+w-ww, my+1); strte: c = strlen(bs); textattr(tc); i = getch(); if (i==0) i = getch() + 100; switch (i) { case 160 : case 175: w = w - 1; if (w<0) { w = 0; goto strte; } if ( mx+w==ww) gotoxy( ww, wherey()-1); else gotoxy(wherex()-1, wherey() ); goto strte; //end left movemnt case 161 : case 177: if (w>=78) { goto strte; } if (w>=c) { goto strte; } w = w + 1; cprintf("%c", bs[w-1]); goto strte; //end right mvement case 162: w = 0; f = 0; bs[0] = 0; goto prntedit; case 159: case 13 : if ( (ff==1 && fc<23 && bs[0]!=0) && (f==0 || strcmp(bs, fbuf[f])!=0) ) { fc = fc + 1; strcpy(fbuf[fc], bs); } m = atoi(bs); if (m<0) m = 0; if (ff>0) m = c; textattr(tscrn.attribute); gotoxy( mx, my); cprintf("%s", bs); if (m>ROW) return(ROW); return(m); case 171: w = 0; goto postn; //end start of rec rtn case 179: w = c; goto postn; //end end of rec pos case 163: if (!ff || !f) goto prntedit; if (f=79) goto strte; for (i=c;i>=w;i--) bs[i+1] = bs[i]; bs[w] = 32; c = c + 1; goto prntedit; case 9 : case 180: if (!ff) goto prntedit; f = f + 1; if (f>fc) f = 0; strcpy(bs, fbuf[f]); w = 0; goto prntedit; case 27 : case 172: if (!ff) goto prntedit; f = f - 1; if (f<0) f = fc; strcpy(bs, fbuf[f]); w = 0; goto prntedit; }//end sw block if (i<32 || 128=c) goto addch; bs[w] = i; w = w + 1; cprintf("%c", i); goto strte; addch: if (w>77) goto strte; bs[w] = i; w = w + 1; bs[w] = 0; cprintf("%c", i); goto strte; } //end gtc() rtn //------------------// int ansichk(char *msg, char *ch, int f1) {gtc(msg, ch, f1); if (ch[0]==0) { cprintf("\rcode> "); clreol(); ch[0] = gtc("", ch, 0); ch[1] = 0; } return(strlen(ch)); } //--------------// void getdir(void) { crdr[0] = 'a' + getdisk(); getcurdir(0, crdr+3); cprintf("curr dir: %s\r\n", crdr); return; } //--------------// void chgdir(void) { setdisk(xs[0] - 97); chdir(xs); getdir(); return; } //------------------// void prtbx(int x, int y, int wd, int ht, int clr, int clr2, char *ms) { window( 1, 1, 80, 25); textattr(clr + 112); gotoxy( x+wd-1, y+ht-1); cprintf("%c", 217); window( x, y, x+wd-1, y+ht-1); strcpy(bs, tpbx); bs[wd-1] = 191; bs[wd] = 0; sdbx[wd-1] = 179; sdbx[wd] = 0; btbx[wd-1] = 0; for (ii=0;iistrlen(bs)-5) break; bs[ii+2] = ms[ii]; } cprintf("%s", bs); for (ii=0;iik) { strcpy(bs, ns[sk]); for (si=sk;si>k;si--) strcpy(ns[si], ns[si-1]); strcpy(ns[k], bs); } }//end if, end k for loop return; }//end sort rtn //------------------// void lead0(int x,char *rslt) { itoa(x, ld, 10); if (x<10) { ld[1] = ld[0]; ld[0] = 48; ld[2] = 0; } strcpy(rslt, ld); return; } //--chk for seg-----// int seginf(int x) { int s; s = ns[x][80]; if (s==0) return(0); if (s==1) { if (ns[x+1][80]==0 || ns[x+1][80]==1) return(0); return(1); } if (s>1) { if (ns[x+1][80]==0 || ns[x+1][80]==1) return(2); return(3); } }//end rtn block //------------------// //----------end of program---