00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "setup.h"
00032
00033 #if EMACS_EDITOR && ! RUN_TIME
00034
00035 #define _EDMISC_SOURCE_
00036 #include "ed.h"
00037 #include "cstrcpsr.h"
00038
00039 static int tabsize;
00040
00041
00042
00043
00044
00045
00046 #if VAX_VMS
00047 #define EFN 0
00048
00049 #include <ssdef.h>
00050 #include <stsdef.h>
00051 #include <descrip.h>
00052 #include <iodef.h>
00053
00054 extern int oldmode[2];
00055 extern int newmode[2];
00056 extern short iochan;
00057 #endif
00058
00059 #if WIN_MVC || WIN_BTC || WIN_GCC
00060 #include <dos.h>
00061 #endif
00062
00063 #if UNIX_7 || UNIX_V || LINUX || DARWIN
00064
00065
00066
00067 #include <unistd.h>
00068 #include <signal.h>
00069 #endif
00070
00071
00072
00073
00074
00075
00076 #define MAX_COMPILE_LINE 161
00077
00078 static int cur_col;
00079 static long region_size;
00080 static LINE *linep;
00081 static int loffs;
00082 static int CompileSuccess = 1;
00083 static char CompileLine[MAX_COMPILE_LINE];
00084 static int CompileLineIndex = 0;
00085
00086
00087
00088
00089
00090 #if WIN_BTC
00091 #pragma argsused
00092 #endif
00093 globle int compile_region(
00094 void *theEnv,
00095 int f,
00096 int n)
00097 {
00098 register int s;
00099 REGION region;
00100
00101 if (curbp == CompileBufferp)
00102 {
00103 mlwrite("Cannot compile this region!");
00104 return(0);
00105 }
00106 cur_col = 20;
00107
00108
00109
00110 if (( s = getregion(®ion)) != TRUE)
00111 return(s);
00112 if ((lastflag&CFKILL) == 0)
00113 kdelete(theEnv);
00114 thisflag |= CFKILL;
00115 linep = region.r_linep;
00116 loffs = region.r_offset;
00117 region_size = region.r_size;
00118 if (region_size == 0)
00119 {
00120 mlwrite(" Region is empty ");
00121 return(0);
00122 }
00123
00124 mlwrite("Compiling Region...");
00125
00126
00127
00128 EnvAddRouter(theEnv,"emacs_region",90,region_fnd,
00129 NULL,region_getc,region_ungetc,NULL);
00130
00131
00132
00133 if (get_compile(theEnv,"emacs_region","Emacs_region") == 0)
00134 mlwrite("Error while forming compilation buffer!");
00135 else
00136 mlwrite("Compilation done.");
00137 return (TRUE);
00138 }
00139
00140
00141
00142
00143
00144
00145 #if WIN_BTC
00146 #pragma argsused
00147 #endif
00148 globle int compile_file(
00149 void *theEnv,
00150 int f,
00151 int n)
00152 {
00153 if (curbp == CompileBufferp)
00154 {
00155 mlwrite("Cannot compile this buffer!");
00156 return(0);
00157 }
00158
00159 cur_col = 27;
00160 mlwrite("Compiling Current Buffer...");
00161 linep = lforw(curbp->b_linep);
00162 loffs = 0;
00163
00164
00165
00166 EnvAddRouter(theEnv,"emacs_file",90,buffer_fnd,
00167 NULL,buffer_getc,buffer_ungetc,NULL);
00168
00169
00170
00171 if (get_compile(theEnv,"emacs_file","Emacs_buffer") == 0)
00172 mlwrite("Error while forming compilation buffer!");
00173 else
00174 mlwrite("Compilation done.");
00175 return (TRUE);
00176 }
00177
00178
00179
00180
00181
00182 globle int get_compile(
00183 void *theEnv,
00184 char *str1,
00185 char *str2)
00186 {
00187 #if (! RUN_TIME) && (! BLOAD_ONLY)
00188 register WINDOW *wp;
00189 register BUFFER *bp;
00190
00191 CompileSuccess = 1;
00192 CompileBufferp->b_flag &= ~BFCHG;
00193 if (bclear(theEnv,CompileBufferp) != TRUE)
00194 return (0);
00195 CompileLineIndex = 0;
00196 CompileLine[0] = '\0';
00197
00198 EnvActivateRouter(theEnv,str1);
00199 EnvActivateRouter(theEnv,"cmp_router");
00200 SetPrintWhileLoading(theEnv,TRUE);
00201 LoadConstructsFromLogicalName(theEnv,str2);
00202 DestroyPPBuffer(theEnv);
00203
00204 if (CompileLineIndex != 0)
00205 addline(theEnv,CompileBufferp,CompileLine);
00206 EnvDeactivateRouter(theEnv,str1);
00207 EnvDeactivateRouter(theEnv,"cmp_router");
00208 SetPrintWhileLoading(theEnv,FALSE);
00209 EnvDeleteRouter(theEnv,str1);
00210
00211 genstrcpy(CompileBufferp->b_fname, "");
00212 if (CompileBufferp->b_nwnd == 0) {
00213 if ((wp=wpopup(theEnv)) == NULL)
00214 return (0);
00215 bp = wp->w_bufp;
00216 if (--bp->b_nwnd == 0) {
00217 bp->b_dotp = wp->w_dotp;
00218 bp->b_doto = wp->w_doto;
00219 bp->b_markp = wp->w_markp;
00220 bp->b_marko = wp->w_marko;
00221 }
00222 wp->w_bufp = CompileBufferp;
00223 ++CompileBufferp->b_nwnd;
00224 }
00225 wp = wheadp;
00226 while (wp != NULL) {
00227 if (wp->w_bufp == CompileBufferp) {
00228 wp->w_linep = lforw(CompileBufferp->b_linep);
00229 wp->w_dotp = lforw(CompileBufferp->b_linep);
00230 wp->w_doto = 0;
00231 wp->w_markp = NULL;
00232 wp->w_marko = 0;
00233 wp->w_flag |= WFMODE|WFHARD;
00234 }
00235 wp = wp->w_wndp;
00236 }
00237 return(CompileSuccess);
00238 #else
00239 return(0);
00240 #endif
00241 }
00242
00243
00244
00245
00246
00247
00248 globle int region_fnd(
00249 void *theEnv,
00250 char *log_name)
00251 {
00252 if (strcmp("Emacs_region",log_name)== 0)
00253 { return(TRUE); }
00254 return(FALSE);
00255 }
00256
00257
00258
00259
00260
00261
00262 #if WIN_BTC
00263 #pragma argsused
00264 #endif
00265 globle int region_getc(
00266 void *theEnv,
00267 char *log_name)
00268 {
00269 int c;
00270
00271 if (region_size <= 0)
00272 return(EOF);
00273 if (loffs == llength(linep))
00274 {
00275 c = '\n';
00276 linep = lforw(linep);
00277 loffs = 0;
00278 }
00279 else
00280 c = lgetc(linep,loffs++);
00281
00282 region_size--;
00283 return(c);
00284 }
00285
00286
00287
00288
00289
00290 #if WIN_BTC
00291 #pragma argsused
00292 #endif
00293 globle int region_ungetc(
00294 void *theEnv,
00295 int c,
00296 char *log_name)
00297
00298 {
00299 if (c == EOF)
00300 return(1);
00301 if (loffs <= 0)
00302 {
00303 linep = lback(linep);
00304 loffs = llength(linep);
00305 }
00306 else
00307 loffs--;
00308 region_size++;
00309 return(1);
00310 }
00311
00312
00313
00314
00315
00316
00317
00318 globle int buffer_fnd(
00319 void *theEnv,
00320 char *log_name)
00321 {
00322 if(strcmp("Emacs_buffer",log_name)== 0)
00323 return(TRUE);
00324 return(FALSE);
00325 }
00326
00327
00328
00329
00330
00331
00332
00333 #if WIN_BTC
00334 #pragma argsused
00335 #endif
00336 globle int buffer_getc(
00337 void *theEnv,
00338 char *log_name)
00339 {
00340 int c;
00341 if (linep == curbp->b_linep)
00342 return(EOF);
00343 if (loffs == llength(linep))
00344 {
00345 linep = lforw(linep);
00346 if (linep == curbp->b_linep)
00347 return(EOF);
00348 loffs = 0;
00349 c = '\n';
00350 }
00351 else
00352
00353 c = lgetc(linep,loffs++);
00354
00355 return(c);
00356 }
00357
00358
00359
00360
00361
00362 #if WIN_BTC
00363 #pragma argsused
00364 #endif
00365 globle int buffer_ungetc(
00366 void *theEnv,
00367 int c,
00368 char *logical_name)
00369 {
00370 if (c == EOF)
00371 return(1);
00372 if (loffs == 0)
00373 {
00374 linep = lback(linep);
00375 loffs = llength(linep);
00376 }
00377 else
00378 loffs--;
00379 return(1);
00380 }
00381
00382 globle int query_cmp(
00383 void *theEnv,
00384 char *logName)
00385 {
00386 if((strcmp(logName,"wdialog") == 0) ||
00387 (strcmp(logName,"wtrace") == 0) ||
00388 (strcmp(logName,"wwarning") == 0) ||
00389 (strcmp(logName,"werror") == 0))
00390 return(TRUE);
00391 else
00392 return(FALSE);
00393 }
00394
00395 globle int print_cmp(
00396 void *theEnv,
00397 char *logName,
00398 char *str)
00399 {
00400 register int i;
00401
00402 if (CompileSuccess == 0)
00403 return(1);
00404 for (i = 0 ; str[i] != '\0' ; i++)
00405 {
00406 if ((str[i] == '\n') || (str[i] == '\r'))
00407 {
00408 addline(theEnv,CompileBufferp,CompileLine);
00409 CompileLineIndex = 0;
00410 CompileLine[0] = '\0';
00411 }
00412 else if (CompileLineIndex < (MAX_COMPILE_LINE-1))
00413 {
00414 CompileLine[CompileLineIndex++] = str[i];
00415 CompileLine[CompileLineIndex] = '\0';
00416 }
00417 else
00418 {
00419 addline(theEnv,CompileBufferp,CompileLine);
00420 CompileLineIndex = 1;
00421 CompileLine[0] = str[i];
00422 CompileLine[1] = '\0';
00423 }
00424 }
00425 return(1);
00426 }
00427
00428 globle void init_cmp_router(
00429 void *theEnv)
00430 {
00431 EnvAddRouter(theEnv,"cmp_router",
00432 20,
00433 query_cmp,
00434 print_cmp,
00435 NULL,
00436 NULL,
00437 NULL
00438 );
00439 }
00440
00441 globle void kill_cmp_router(
00442 void *theEnv)
00443 {
00444 EnvDeleteRouter(theEnv,"cmp_router");
00445 }
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455 #if WIN_BTC
00456 #pragma argsused
00457 #endif
00458 globle int setfillcol(
00459 void *theEnv,
00460 int f,
00461 int n)
00462 {
00463 fillcol = n;
00464 return(TRUE);
00465 }
00466
00467
00468
00469
00470
00471
00472 #if WIN_BTC
00473 #pragma argsused
00474 #endif
00475 globle int showcpos(
00476 void *theEnv,
00477 int f,
00478 int n)
00479 {
00480 register int cline;
00481 register int col;
00482 register int tline;
00483
00484 col = getccol(FALSE);
00485 cline = getcline();
00486 tline = cntlines();
00487 mlwrite("MicroEMACS Version %s col: %d line: %d of %d"
00488 ,VERSION_NUM, col+1, cline, tline);
00489 return (TRUE);
00490 }
00491
00492
00493
00494
00495 globle int getccol(
00496 int bflg)
00497 {
00498 register int c, i, col;
00499 col = 0;
00500 for (i=0; i< curwp->w_doto; ++i) {
00501 c = lgetc(curwp->w_dotp, i);
00502 if (c!=' ' && c!='\t' && bflg)
00503 break;
00504 if (c == '\t')
00505 col |= 0x07;
00506 else if (c<0x20 || c==0x7F)
00507 ++col;
00508 ++col;
00509 }
00510 return(col);
00511 }
00512
00513
00514
00515
00516 globle int getcline()
00517 {
00518 int i;
00519 struct LINE *clp;
00520
00521 i = 0;
00522 clp = curbp->b_linep;
00523 while(clp != curwp->w_dotp) {
00524 i++;
00525 clp = lforw(clp);
00526 }
00527 if (i == 0)
00528 return(cntlines());
00529 return(i);
00530 }
00531
00532
00533
00534
00535 globle int cntlines()
00536 {
00537 int i;
00538 struct LINE *clp;
00539
00540 i = 1;
00541 clp = lforw(curbp->b_linep);
00542 while( clp != curbp->b_linep) {
00543 i++;
00544 clp = lforw(clp);
00545 }
00546
00547 return(i);
00548 }
00549
00550
00551
00552
00553 #if WIN_BTC
00554 #pragma argsused
00555 #endif
00556 globle int gotoline(
00557 void *theEnv,
00558 int f,
00559 int n)
00560 {
00561 register int line;
00562 char buf[5];
00563 register int i;
00564 register int s;
00565 struct LINE *clp;
00566
00567 if ((s=mlreply(theEnv,"Goto line: ", buf, 5)) != TRUE)
00568 return (s);
00569
00570 if((line = atoi(buf)) <= 0) {
00571 mlwrite("Invalid line number!");
00572 return(FALSE);
00573 }
00574 else if(line > cntlines()) {
00575 mlwrite("Not that many lines in buffer!");
00576 return(FALSE);
00577 }
00578
00579 i = 0;
00580 clp = lforw(curbp->b_linep);
00581 while(i < line - 1) {
00582 i++;
00583 clp = lforw(clp);
00584 }
00585
00586 curwp->w_dotp = clp;
00587 curwp->w_doto = 0;
00588 curwp->w_flag |= WFMOVE;
00589 return (TRUE);
00590 }
00591
00592
00593
00594
00595
00596
00597
00598
00599 #if WIN_BTC
00600 #pragma argsused
00601 #endif
00602 globle int twiddle(
00603 void *theEnv,
00604 int f,
00605 int n)
00606 {
00607 register LINE *dotp;
00608 register int doto;
00609 register int cl;
00610 register int cr;
00611
00612 dotp = curwp->w_dotp;
00613 doto = curwp->w_doto;
00614 if (doto==llength(dotp) && --doto<0)
00615 return (FALSE);
00616 cr = lgetc(dotp, doto);
00617 if (--doto < 0)
00618 return (FALSE);
00619 cl = lgetc(dotp, doto);
00620 lputc(dotp, doto+0, cr);
00621 lputc(dotp, doto+1, cl);
00622 lchange(WFEDIT);
00623 return (TRUE);
00624 }
00625
00626
00627
00628
00629
00630
00631
00632
00633 #if WIN_BTC
00634 #pragma argsused
00635 #endif
00636 globle int quote(
00637 void *theEnv,
00638 int f,
00639 int n)
00640 {
00641 register int s;
00642 register int c;
00643
00644 c = (*term.t_getchar)();
00645 if (n < 0)
00646 return (FALSE);
00647 if (n == 0)
00648 return (TRUE);
00649 if (c == '\n') {
00650 do {
00651 s = lnewline(theEnv);
00652 } while (s==TRUE && --n);
00653 return (s);
00654 }
00655 return (linsert(theEnv,n, c));
00656 }
00657
00658
00659
00660
00661
00662
00663
00664
00665 #if WIN_BTC
00666 #pragma argsused
00667 #endif
00668 globle int tab(
00669 void *theEnv,
00670 int f,
00671 int n)
00672 {
00673 if (n < 0)
00674 return (FALSE);
00675 if (n == 0 || n > 1) {
00676 tabsize = n;
00677 return(TRUE);
00678 }
00679 if (! tabsize)
00680 return(linsert(theEnv,1, '\t'));
00681 return(linsert(theEnv,tabsize - (getccol(FALSE) % tabsize), ' '));
00682 }
00683
00684
00685
00686
00687
00688
00689 #if WIN_BTC
00690 #pragma argsused
00691 #endif
00692 globle int openline(
00693 void *theEnv,
00694 int f,
00695 int n)
00696 {
00697 register int i;
00698 register int s;
00699
00700 if (n < 0)
00701 return (FALSE);
00702 if (n == 0)
00703 return (TRUE);
00704 i = n;
00705 do {
00706 s = lnewline(theEnv);
00707 } while (s==TRUE && --i);
00708 if (s == TRUE)
00709 s = backchar(theEnv,f, n);
00710 return (s);
00711 }
00712
00713
00714
00715
00716
00717
00718
00719
00720 #if WIN_BTC
00721 #pragma argsused
00722 #endif
00723 globle int newline(
00724 void *theEnv,
00725 int f,
00726 int n)
00727 {
00728 register LINE *lp;
00729 register int s;
00730
00731 if (n < 0)
00732 return (FALSE);
00733 while (n--) {
00734 lp = curwp->w_dotp;
00735 if (llength(lp) == curwp->w_doto
00736 && lp != curbp->b_linep
00737 && llength(lforw(lp)) == 0) {
00738 if ((s=forwchar(theEnv,FALSE, 1)) != TRUE)
00739 return (s);
00740 } else if ((s=lnewline(theEnv)) != TRUE)
00741 return (s);
00742 }
00743 return (TRUE);
00744 }
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754 #if WIN_BTC
00755 #pragma argsused
00756 #endif
00757 globle int deblank(
00758 void *theEnv,
00759 int f,
00760 int n)
00761 {
00762 register LINE *lp1;
00763 register LINE *lp2;
00764 long nld;
00765
00766 lp1 = curwp->w_dotp;
00767 while (llength(lp1)==0 && (lp2=lback(lp1))!=curbp->b_linep)
00768 lp1 = lp2;
00769 lp2 = lp1;
00770 nld = 0;
00771 while ((lp2=lforw(lp2))!=curbp->b_linep && llength(lp2)==0)
00772 ++nld;
00773 if (nld == 0)
00774 return (TRUE);
00775 curwp->w_dotp = lforw(lp1);
00776 curwp->w_doto = 0;
00777 return (ldelete(theEnv,nld,FALSE));
00778 }
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788 #if WIN_BTC
00789 #pragma argsused
00790 #endif
00791 globle int indent(
00792 void *theEnv,
00793 int f,
00794 int n)
00795 {
00796 register int nicol;
00797 register int c;
00798 register int i;
00799
00800 if (n < 0)
00801 return (FALSE);
00802 while (n--) {
00803 nicol = 0;
00804 for (i=0; i<llength(curwp->w_dotp); ++i) {
00805 c = lgetc(curwp->w_dotp, i);
00806 if (c!=' ' && c!='\t')
00807 break;
00808 if (c == '\t')
00809 nicol |= 0x07;
00810 ++nicol;
00811 }
00812 if (lnewline(theEnv) == FALSE
00813 || ((i=nicol/8)!=0 && linsert(theEnv,i, '\t')==FALSE)
00814 || ((i=nicol%8)!=0 && linsert(theEnv,i, ' ')==FALSE))
00815 return (FALSE);
00816 }
00817 return (TRUE);
00818 }
00819
00820
00821
00822
00823
00824
00825
00826 #if WIN_BTC
00827 #pragma argsused
00828 #endif
00829 globle int forwdel(
00830 void *theEnv,
00831 int f,
00832 int n)
00833 {
00834 if (n < 0)
00835 return (backdel(theEnv,f, -n));
00836 if (f != FALSE) {
00837 if ((lastflag&CFKILL) == 0)
00838 kdelete(theEnv);
00839 thisflag |= CFKILL;
00840 }
00841 return (ldelete(theEnv,(long) n, f));
00842 }
00843
00844
00845
00846
00847
00848
00849
00850 #if WIN_BTC
00851 #pragma argsused
00852 #endif
00853 globle int backdel(
00854 void *theEnv,
00855 int f,
00856 int n)
00857 {
00858 register int s;
00859
00860 if (n < 0)
00861 return (forwdel(theEnv,f, -n));
00862 if (f != FALSE) {
00863 if ((lastflag&CFKILL) == 0)
00864 kdelete(theEnv);
00865 thisflag |= CFKILL;
00866 }
00867 if ((s=backchar(theEnv,f, n)) == TRUE)
00868 s = ldelete(theEnv,(long) n, f);
00869 return (s);
00870 }
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880 #if WIN_BTC
00881 #pragma argsused
00882 #endif
00883 globle int kill_fwd(
00884 void *theEnv,
00885 int f,
00886 int n)
00887 {
00888 register int chunk;
00889 register LINE *nextp;
00890
00891 if ((lastflag&CFKILL) == 0)
00892 kdelete(theEnv);
00893 thisflag |= CFKILL;
00894 if (f == FALSE) {
00895 chunk = llength(curwp->w_dotp)-curwp->w_doto;
00896 if (chunk == 0)
00897 chunk = 1;
00898 } else if (n == 0) {
00899 chunk = curwp->w_doto;
00900 curwp->w_doto = 0;
00901 } else if (n > 0) {
00902 chunk = llength(curwp->w_dotp)-curwp->w_doto+1;
00903 nextp = lforw(curwp->w_dotp);
00904 while (--n) {
00905 if (nextp == curbp->b_linep)
00906 return (FALSE);
00907 chunk += llength(nextp)+1;
00908 nextp = lforw(nextp);
00909 }
00910 } else {
00911 mlwrite("neg kill");
00912 return (FALSE);
00913 }
00914 return (ldelete(theEnv,(long) chunk, TRUE));
00915 }
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925 #if WIN_BTC
00926 #pragma argsused
00927 #endif
00928 globle int yank(
00929 void *theEnv,
00930 int f,
00931 int n)
00932 {
00933 register int c;
00934 register int i;
00935
00936 if (n < 0)
00937 return (FALSE);
00938 while (n--) {
00939 i = 0;
00940 while ((c=kremove(i)) >= 0) {
00941 if (c == '\n') {
00942 if (newline(theEnv,FALSE, 1) == FALSE)
00943 return (FALSE);
00944 } else {
00945 if (linsert(theEnv,1, c) == FALSE)
00946 return (FALSE);
00947 }
00948 ++i;
00949 }
00950 }
00951 return (TRUE);
00952 }
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996 #if WIN_BTC
00997 #pragma argsused
00998 #endif
00999 globle int forwsearch(
01000 void *theEnv,
01001 int f,
01002 int n)
01003 {
01004 register LINE *clp;
01005 register int cbo;
01006 register LINE*tlp;
01007 register int tbo;
01008 register int c;
01009 register char *pp;
01010 register int s;
01011
01012 if ((s = readpattern(theEnv,"Search")) != TRUE)
01013 return (s);
01014
01015 clp = curwp->w_dotp;
01016 cbo = curwp->w_doto;
01017
01018 while (clp != curbp->b_linep)
01019 {
01020 if (cbo == llength(clp))
01021 {
01022 clp = lforw(clp);
01023 cbo = 0;
01024 c = '\n';
01025 }
01026 else
01027 c = lgetc(clp, cbo++);
01028
01029 if (c == pat[0])
01030 {
01031 tlp = clp;
01032 tbo = cbo;
01033 pp = &pat[1];
01034
01035 while (*pp != 0)
01036 {
01037 if (tlp == curbp->b_linep)
01038 goto fail;
01039
01040 if (tbo == llength(tlp))
01041 {
01042 tlp = lforw(tlp);
01043 tbo = 0;
01044 c = '\n';
01045 }
01046 else
01047 c = lgetc(tlp, tbo++);
01048
01049 if (c != *pp++)
01050 goto fail;
01051 }
01052
01053 curwp->w_dotp = tlp;
01054 curwp->w_doto = tbo;
01055 curwp->w_flag |= WFMOVE;
01056 return (TRUE);
01057 }
01058 fail:;
01059 }
01060
01061 mlwrite("Not found");
01062 return (FALSE);
01063 }
01064
01065
01066
01067
01068
01069
01070
01071 #if WIN_BTC
01072 #pragma argsused
01073 #endif
01074 globle int backsearch(
01075 void *theEnv,
01076 int f,
01077 int n)
01078 {
01079 register LINE *clp;
01080 register int cbo;
01081 register LINE *tlp;
01082 register int tbo;
01083 register int c;
01084 register char *epp;
01085 register char *pp;
01086 register int s;
01087
01088 if ((s = readpattern(theEnv,"Reverse search")) != TRUE)
01089 return (s);
01090
01091 for (epp = &pat[0]; epp[1] != 0; ++epp)
01092 ;
01093
01094 clp = curwp->w_dotp;
01095 cbo = curwp->w_doto;
01096
01097 for (;;)
01098 {
01099 if (cbo == 0)
01100 {
01101 clp = lback(clp);
01102
01103 if (clp == curbp->b_linep)
01104 {
01105 mlwrite("Not found");
01106 return (FALSE);
01107 }
01108
01109 cbo = llength(clp)+1;
01110 }
01111
01112 if (--cbo == llength(clp))
01113 c = '\n';
01114 else
01115 c = lgetc(clp, cbo);
01116
01117 if (c == *epp)
01118 {
01119 tlp = clp;
01120 tbo = cbo;
01121 pp = epp;
01122
01123 while (pp != &pat[0])
01124 {
01125 if (tbo == 0)
01126 {
01127 tlp = lback(tlp);
01128 if (tlp == curbp->b_linep)
01129 goto fail;
01130
01131 tbo = llength(tlp)+1;
01132 }
01133
01134 if (--tbo == llength(tlp))
01135 c = '\n';
01136 else
01137 c = lgetc(tlp, tbo);
01138
01139 if (c != *--pp)
01140 goto fail;
01141 }
01142
01143 curwp->w_dotp = tlp;
01144 curwp->w_doto = tbo;
01145 curwp->w_flag |= WFMOVE;
01146 return (TRUE);
01147 }
01148 fail:;
01149 }
01150 }
01151
01152
01153
01154
01155
01156
01157 #if WIN_BTC
01158 #pragma argsused
01159 #endif
01160 globle int bkwrdrpl(
01161 void *theEnv,
01162 int f,
01163 int n)
01164 {
01165 LINE *clp;
01166 int cbo;
01167 LINE *tlp;
01168 int tbo;
01169 int c,count = 0;
01170 char *epp,buf[40];
01171 char *pp;
01172 char *pat2;
01173 int s;
01174
01175 if ((s = readpattern(theEnv,"Rev. replace all occrs of")) != TRUE)
01176 return (s);
01177 pat2 = (char *) genalloc(theEnv,(unsigned) strlen (pat) + 1);
01178 genstrcpy(pat2,pat);
01179 if((s = mlreply(theEnv,"Replace with: ",pat,NPAT)) == ABORT) {
01180 genfree(theEnv,(void *) pat2, (unsigned) strlen(pat) + 1);
01181 return(s);
01182 }
01183 for (epp = &pat2[0];epp[1] != 0 ; ++epp);
01184 clp = curwp->w_dotp;
01185 cbo = curwp->w_doto;
01186 if (clp == curbp->b_linep)
01187 {
01188 clp = lback(clp);
01189 cbo = llength(clp) + 1;
01190 }
01191 while(clp != curbp->b_linep)
01192 {
01193 if (cbo <= 0)
01194 {
01195 clp = lback(clp);
01196 if (clp != curbp->b_linep)
01197 cbo = llength(clp) + 1;
01198 }
01199 if (clp == curbp->b_linep)
01200 break;
01201 if (--cbo == llength(clp))
01202 c = '\n';
01203 else
01204 c = lgetc(clp,cbo);
01205 if(c == *epp)
01206 {
01207 tbo = cbo;
01208 tlp = clp;
01209 pp = epp;
01210 while(pp != pat2)
01211 {
01212 if (tbo <= 0)
01213 {
01214 tlp = lback(tlp);
01215 if (tlp != curbp->b_linep)
01216 tbo = llength(tlp) + 1;
01217 }
01218 if ( tlp == curbp->b_linep)
01219 break;
01220 if(--tbo == llength(tlp))
01221 c = '\n';
01222 else
01223 c = lgetc(tlp,tbo);
01224 if (c != *--pp)
01225 break;
01226 }
01227 if ((pp == pat2)&&(c == *pp))
01228 {
01229 curwp->w_dotp = clp;
01230 curwp->w_doto = tbo;
01231 count++;
01232 lreplace(theEnv,pat2);
01233 clp = curwp->w_dotp;
01234 cbo = curwp->w_doto - strlen(pat);
01235 }
01236 }
01237 }
01238 curwp->w_doto -= strlen(pat);
01239 curwp->w_flag |= WFMOVE;
01240 update();
01241 gensprintf(buf," %d Replacement[s] ",count);
01242 mlwrite(buf);
01243 return(TRUE);
01244 }
01245
01246
01247
01248
01249
01250
01251 #if WIN_BTC
01252 #pragma argsused
01253 #endif
01254 globle int bkwrdcr(
01255 void *theEnv,
01256 int f,
01257 int n)
01258 {
01259 LINE *clp;
01260 int cbo;
01261 LINE *tlp;
01262 int tbo;
01263 int c;
01264 char *epp,*pp;
01265 char *pat2;
01266 int s;
01267
01268 if ((s = readpattern(theEnv,"Rev. replace some occrs. of")) != TRUE)
01269 return (s);
01270 pat2 = (char *) genalloc(theEnv,(unsigned) strlen (pat) + 1);
01271 genstrcpy(pat2,pat);
01272 if((s = mlreply(theEnv,"Replace with: ",pat,NPAT)) == ABORT) {
01273 genfree(theEnv,(void *) pat2,(unsigned) strlen(pat) + 1);
01274 return(s);
01275 }
01276 for (epp = &pat2[0]; epp[1] != 0; ++epp)
01277 ;
01278
01279 clp = curwp->w_dotp;
01280 cbo = curwp->w_doto;
01281 if (clp == curbp->b_linep)
01282 {
01283 clp = lback(clp);
01284 cbo = llength(clp) + 1;
01285 }
01286 while (clp != curbp->b_linep)
01287 {
01288 if (cbo <= 0)
01289 {
01290 clp = lback(clp);
01291
01292 if (clp != curbp->b_linep)
01293 cbo = llength(clp)+1;
01294 }
01295 if (clp == curbp->b_linep)
01296 break;
01297 if (--cbo == llength(clp))
01298 c = '\n';
01299 else
01300 c = lgetc(clp, cbo);
01301
01302 if (c == *epp)
01303 {
01304 tlp = clp;
01305 tbo = cbo;
01306 pp = epp;
01307
01308 while (pp != &pat2[0])
01309 {
01310 if (tbo <= 0)
01311 {
01312 tlp = lback(tlp);
01313 if (tlp != curbp->b_linep)
01314 tbo = llength(tlp)+1;
01315 }
01316 if (tlp == curbp->b_linep)
01317 break;
01318 if (--tbo == llength(tlp))
01319 c = '\n';
01320 else
01321 c = lgetc(tlp, tbo);
01322
01323 if (c != *--pp)
01324 break;
01325 }
01326 if ((pp == pat2)&&(c == *pp))
01327 {
01328 curwp->w_dotp = clp;
01329 curwp->w_doto = tbo;
01330 curwp->w_flag |= WFMOVE;
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341 mlwrite("Do you want to replace this? [y/n]");
01342 update();
01343 c = (*term.t_getchar)();
01344 if((c ==' ')||(c == 'y')||(c == 'Y'))
01345 {
01346 lreplace(theEnv,pat2);
01347 clp = curwp->w_dotp;
01348 cbo = curwp->w_doto - strlen(pat);
01349 }
01350 else if ((c == 'n')||(c == 'N'))
01351 cbo = tbo;
01352 else
01353 return(TRUE);
01354 }
01355 }
01356 }
01357 curwp->w_flag |= WFMOVE;
01358 curwp->w_doto -= strlen(pat);
01359 update();
01360 mlwrite("No more occurrences of [%s] in buffer",pat2);
01361 genfree(theEnv,(void *) pat2,(unsigned) strlen(pat) + 1);
01362 return(TRUE);
01363 }
01364
01365
01366
01367
01368
01369
01370
01371
01372 #if WIN_BTC
01373 #pragma argsused
01374 #endif
01375 globle int frwsr(
01376 void *theEnv,
01377 int f,
01378 int n)
01379 {
01380 LINE *clp,*tlp;
01381 int cbo,tbo,c,s,count = 0 ;
01382 char *pp,buf[40];
01383 char *pat2;
01384
01385
01386
01387 if((s = readpattern (theEnv,"Replace the occurences of?")) != TRUE)
01388 return (s);
01389 pat2 = (char *) genalloc (theEnv,(unsigned) strlen(pat) + 1);
01390 genstrcpy (pat2,pat);
01391
01392
01393
01394 if((s = mlreply(theEnv,"Replace with: ",pat,NPAT)) == ABORT) {
01395 genfree(theEnv,(void *) pat2,(unsigned) strlen(pat) + 1);
01396 return(s);
01397 }
01398
01399 clp = curwp->w_dotp;
01400 cbo = curwp->w_doto;
01401 while (clp != curbp->b_linep)
01402 {
01403 if(cbo >= llength(clp))
01404 {
01405 clp = lforw(clp);
01406 cbo = 0;
01407 c = '\n';
01408 }
01409 else
01410 c = lgetc(clp,cbo++);
01411 if (c == pat2[0])
01412 {
01413 tlp = clp;
01414 tbo = cbo;
01415 pp = &pat2[1];
01416 while (*pp)
01417 {
01418 if(tlp == curbp->b_linep)
01419 break;
01420 if(tbo >= llength(tlp))
01421 {
01422 tlp = lforw(tlp);
01423 tbo = 0;
01424 c = '\n';
01425 }
01426 else
01427 c = lgetc(tlp,tbo++);
01428 if(c != *pp)
01429 break;
01430 pp++;
01431 }
01432 if(!(*pp))
01433 {
01434 curwp->w_dotp = clp;
01435 curwp->w_doto = cbo - 1;
01436 count++;
01437 lreplace(theEnv,pat2);
01438 clp = curwp->w_dotp;
01439 cbo = curwp->w_doto;
01440 }
01441 }
01442
01443 }
01444 curwp->w_doto -= strlen(pat);
01445 curwp->w_flag |= WFMOVE;
01446 update();
01447 gensprintf(buf,"%d replacement[s]",count);
01448 mlwrite(buf);
01449 return(TRUE);
01450
01451 }
01452
01453
01454
01455
01456
01457
01458 #if WIN_BTC
01459 #pragma argsused
01460 #endif
01461 globle int querysr(
01462 void *theEnv,
01463 int f,
01464 int n)
01465 {
01466 LINE *clp,*tlp;
01467 int cbo,tbo,c,s;
01468 char *pp;
01469 char *pat2;
01470
01471
01472
01473 if((s = readpattern (theEnv,"Query_replace ?")) != TRUE)
01474 return (s);
01475 pat2 = (char *) genalloc(theEnv,(unsigned) strlen(pat) + 1);
01476 genstrcpy (pat2,pat);
01477
01478
01479
01480 if((s = mlreply(theEnv,"Replace with: ",pat,NPAT)) == ABORT) {
01481 genfree(theEnv,(void *) pat2,(unsigned) strlen(pat) + 1);
01482 return(s);
01483 }
01484
01485 clp = curwp->w_dotp;
01486 cbo = curwp->w_doto;
01487 while (clp != curbp->b_linep)
01488 {
01489 if(cbo >= llength(clp))
01490 {
01491 clp = lforw(clp);
01492 cbo = 0;
01493 c = '\n';
01494 }
01495 else
01496 c = lgetc(clp,cbo++);
01497 if (c == pat2[0])
01498 {
01499 tlp = clp;
01500 tbo = cbo;
01501 pp = &pat2[1];
01502 while (*pp)
01503 {
01504 if(tlp == curbp->b_linep)
01505 break;
01506 if(tbo >= llength(tlp))
01507 {
01508 tlp = lforw(tlp);
01509 tbo = 0;
01510 c = '\n';
01511 }
01512 else
01513 c = lgetc(tlp,tbo++);
01514 if(c != *pp)
01515 break;
01516 pp++;
01517 }
01518 if(!(*pp))
01519 {
01520 curwp->w_dotp = clp;
01521 curwp->w_doto = cbo - 1;
01522 curwp->w_flag |= WFMOVE;
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533 mlwrite("Do you want to replace this? [y/n]");
01534 update();
01535 c = (*term.t_getchar)();
01536 if((c ==' ')||(c == 'y')||(c == 'Y'))
01537 {
01538 lreplace(theEnv,pat2);
01539 clp = curwp->w_dotp;
01540 cbo = curwp->w_doto;
01541 }
01542 else if ((c == 'n')||(c == 'N'))
01543 cbo = tbo;
01544 else
01545 return(TRUE);
01546 }
01547 }
01548
01549 }
01550 curwp->w_flag |= WFMOVE;
01551 curwp->w_doto -= strlen(pat);
01552 update();
01553 mlwrite("No more occurrences of [%s] in buffer",pat2);
01554 genfree(theEnv,(void *) pat2,(unsigned) strlen(pat) + 1);
01555 return(TRUE);
01556
01557 }
01558
01559
01560
01561
01562
01563
01564 globle int lreplace(
01565 void *theEnv,
01566 char *pat2)
01567 {
01568 int doto;
01569 unsigned i;
01570 char *cp1,*cp2;
01571 LINE *lp1,*lp2;
01572 WINDOW *wp;
01573
01574 lchange(WFEDIT);
01575 lp1 = curwp->w_dotp;
01576 doto = curwp->w_doto;
01577
01578 if((lp2 =lalloc(theEnv,(int) (lp1->l_used - strlen(pat2) + strlen(pat) ))) == NULL)
01579 return(FALSE);
01580
01581 cp1 = &lp1->l_text[0];
01582 cp2 = &lp2->l_text[0];
01583
01584
01585
01586 while(cp1 != &lp1->l_text[doto])
01587 *cp2++ = *cp1++;
01588
01589
01590
01591 cp2 += strlen(pat);
01592 cp1 += strlen(pat2);
01593
01594
01595
01596 while (cp1 != &lp1->l_text[lp1->l_used])
01597 *cp2++ = *cp1++;
01598
01599 *cp2 = *cp1;
01600
01601
01602 lp1->l_bp->l_fp = lp2;
01603 lp2->l_fp = lp1->l_fp;
01604 lp1->l_fp->l_bp = lp2;
01605 lp2->l_bp = lp1->l_bp;
01606
01607
01608
01609
01610 for(i=0;i<strlen(pat);i++)
01611 lp2->l_text[doto + i] = pat[i];
01612
01613
01614
01615 curwp->w_doto += strlen(pat2);
01616
01617 wp = wheadp;
01618 while (wp != NULL)
01619 { if (wp->w_linep == lp1)
01620 wp->w_linep = lp2;
01621 if(wp->w_dotp == lp1)
01622 wp->w_dotp = lp2;
01623 if (wp == curwp)
01624 wp->w_doto += (strlen(pat) - strlen(pat2));
01625 if(wp->w_markp ==lp1)
01626 {
01627 wp->w_markp = lp2;
01628 wp->w_marko += (strlen(pat) - strlen(pat2));
01629 }
01630 wp = wp->w_wndp;
01631 }
01632 genfree(theEnv,(void *) lp1,(unsigned) sizeof(LINE) + lp1->l_size);
01633 return(TRUE);
01634 }
01635
01636
01637
01638
01639
01640
01641 #if WIN_BTC
01642 #pragma argsused
01643 #endif
01644 globle int smatchb(
01645 void *theEnv,
01646 int f,
01647 int n)
01648 {
01649 int cbo,c;
01650 LINE *clp;
01651
01652 clp = curwp->w_dotp;
01653 cbo = curwp->w_doto;
01654 c = lgetc(clp,cbo);
01655
01656 if((c == '{')||(c == '(')||(c=='['))
01657 {
01658
01659 if(searchcl(c) == FALSE)
01660 return(FALSE);
01661 }
01662 else if((c == '}')||(c == ')')||(c == ']'))
01663 {
01664
01665 if(searchop(c) == FALSE)
01666 return(FALSE);
01667 }
01668
01669 else
01670 return(FALSE);
01671
01672 curwp->w_flag |= WFMOVE;
01673 return(TRUE);
01674 }
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688 globle int searchcl(
01689 int tempch)
01690 {
01691 LINE *lp;
01692 int tbo,c,i=1;
01693
01694 lp = curwp->w_dotp;
01695 tbo = curwp->w_doto + 1;
01696
01697 while(i > 0)
01698 {
01699 if(lp == curbp->b_linep)
01700 {
01701 mlwrite("Matched bracket is not found");
01702 return(FALSE);
01703 }
01704 if(tbo== llength(lp))
01705 {
01706 lp = lforw(lp);
01707 tbo = 0;
01708 c = '\n';
01709 }
01710 else
01711 c = lgetc(lp,tbo++);
01712 switch(tempch)
01713 {
01714 case '{':
01715 if (c == '{')
01716 i++;
01717
01718 else if (c =='}')
01719 i--;
01720 break;
01721
01722 case '(':
01723 if (c == '(')
01724 i++;
01725
01726 else if (c ==')')
01727 i--;
01728 break;
01729
01730 case '[':
01731 if (c == '[')
01732 i++;
01733
01734 else if (c ==']')
01735 i--;
01736 break;
01737 }
01738 }
01739 curwp->w_dotp = lp;
01740 curwp->w_doto = tbo - 1;
01741 return(TRUE);
01742 }
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752 globle int searchop(
01753 int tempch)
01754 {
01755 LINE *lp;
01756 int tbo,c,i=1;
01757
01758 lp = curwp->w_dotp;
01759 tbo = curwp->w_doto;
01760 while(i>0)
01761 {
01762 if(tbo == 0)
01763 {
01764 lp = lback(lp);
01765 if(lp == curbp->b_linep)
01766 {
01767 mlwrite("matched bracket is not found");
01768 return(FALSE);
01769 }
01770 tbo = llength(lp) + 1;
01771 }
01772 if(--tbo == llength(lp))
01773 c = '\n';
01774 else
01775 c = lgetc(lp,tbo);
01776
01777 switch(tempch)
01778 {
01779 case '}':
01780 if(c == '}')
01781 i++;
01782 else if (c == '{')
01783 i--;
01784 break;
01785
01786 case ')':
01787 if (c == ')')
01788 i++;
01789 else if (c =='(')
01790 i--;
01791 break;
01792
01793 case ']':
01794 if (c == ']')
01795 i++;
01796 else if (c =='[')
01797 i--;
01798 break;
01799 }
01800 }
01801 curwp->w_dotp = lp;
01802 curwp->w_doto = tbo ;
01803 return(TRUE);
01804 }
01805
01806
01807
01808
01809
01810
01811
01812 globle int readpattern(
01813 void *theEnv,
01814 char *prompt)
01815 {
01816 register char *cp1;
01817 register char *cp2;
01818 register int c;
01819 register int s;
01820 char tpat[NPAT+20];
01821
01822 cp1 = &tpat[0];
01823 cp2 = prompt;
01824
01825 while ((c = *cp2++) != '\0')
01826 *cp1++ = (char) c;
01827
01828 if (pat[0] != '\0')
01829 {
01830 *cp1++ = ' ';
01831 *cp1++ = '[';
01832 cp2 = &pat[0];
01833
01834 while ((c = *cp2++) != 0)
01835 {
01836 if (cp1 < &tpat[NPAT+20-6])
01837 {
01838 if (c<0x20 || c==0x7F) {
01839 *cp1++ = '^';
01840 c ^= 0x40;
01841 }
01842 else if (c == '%')
01843 *cp1++ = (char) c;
01844
01845 *cp1++ = (char) c;
01846 }
01847 }
01848
01849 *cp1++ = ']';
01850 }
01851
01852 *cp1++ = ':';
01853 *cp1++ = ' ';
01854 *cp1++ = '\0';
01855 s = mlreply(theEnv,tpat, tpat, NPAT);
01856
01857 if (s == TRUE)
01858 genstrcpy(pat, tpat);
01859 else if (s == FALSE && pat[0] != 0)
01860 s = TRUE;
01861
01862 return (s);
01863 }
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881 #if WIN_BTC
01882 #pragma argsused
01883 #endif
01884 globle int spawncli(
01885 void *theEnv,
01886 int f,
01887 int n)
01888 {
01889 #if UNIX_7 || UNIX_V || LINUX || DARWIN || WIN_MVC || WIN_BTC || WIN_GCC
01890 register char *cp;
01891 #endif
01892
01893 #if VAX_VMS
01894 movecursor(term.t_nrow, 0);
01895 mlputs("[Starting DCL]\r\n");
01896 (*term.t_flush)();
01897 sgarbf = TRUE;
01898 return (sys(NULL));
01899 #endif
01900
01901 #if WIN_MVC || WIN_BTC || WIN_GCC
01902 cp = getenv("COMSPEC");
01903 if (cp == NULL)
01904 return(TRUE);
01905 movecursor(term.t_nrow, 0);
01906 (*term.t_flush)();
01907 system(cp);
01908 sgarbf = TRUE;
01909 return(TRUE);
01910 #endif
01911
01912 #if UNIX_7 || UNIX_V || LINUX || DARWIN
01913 movecursor(term.t_nrow, 0);
01914 (*term.t_flush)();
01915 ttclose();
01916 if ((cp = getenv("SHELL")) != NULL && *cp != '\0')
01917 system(cp);
01918 else
01919 system("exec /bin/sh");
01920 sgarbf = TRUE;
01921 sleep(2);
01922 ttopen();
01923 return(TRUE);
01924 #endif
01925 }
01926
01927
01928
01929
01930
01931
01932 #if WIN_BTC
01933 #pragma argsused
01934 #endif
01935 globle int spawn(
01936 void *theEnv,
01937 int f,
01938 int n)
01939 {
01940 register int s;
01941 char line[NLINE];
01942
01943 #if VAX_VMS
01944 if ((s=mlreply(theEnv,"DCL command: ", line, NLINE)) != TRUE)
01945 return (s);
01946 (*term.t_putchar)('\n');
01947 (*term.t_flush)();
01948 s = sys(line);
01949 mlputs("\r\n\n[End]");
01950 (*term.t_flush)();
01951 while ((*term.t_getchar)() != '\r')
01952 ;
01953 sgarbf = TRUE;
01954 return (s);
01955 #endif
01956
01957 #if WIN_MVC || WIN_BTC || WIN_GCC
01958 if ((s=mlreply(theEnv,"MS-DOS command: ", line, NLINE)) != TRUE)
01959 return (s);
01960 system(line);
01961 mlwrite("Hit any key to continue");
01962 (*term.t_getchar)();
01963 sgarbf = TRUE;
01964 return (TRUE);
01965 #endif
01966
01967 #if UNIX_7 || UNIX_V || LINUX || DARWIN
01968 if ((s=mlreply(theEnv,"! ", line, NLINE)) != TRUE)
01969 return (s);
01970 (*term.t_putchar)('\n');
01971 (*term.t_flush)();
01972 ttclose();
01973 system(line);
01974 sleep(2);
01975 ttopen();
01976 mlputs("[End]");
01977 (*term.t_flush)();
01978 while ((s = (*term.t_getchar)()) != '\r' && s != ' ')
01979 ;
01980 sgarbf = TRUE;
01981 return (TRUE);
01982 #endif
01983 }
01984
01985 #if VAX_VMS
01986
01987
01988
01989
01990
01991
01992 globle int sys(
01993 char *cmd)
01994 {
01995 struct dsc$descriptor cdsc;
01996 struct dsc$descriptor *cdscp;
01997 long status;
01998 long substatus;
01999 long iosb[2];
02000
02001 status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
02002 oldmode, sizeof(oldmode), 0, 0, 0, 0);
02003 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
02004 return (FALSE);
02005 cdscp = NULL;
02006 if (cmd != NULL) {
02007 cdsc.dsc$a_pointer = cmd;
02008 cdsc.dsc$w_length = strlen(cmd);
02009 cdsc.dsc$b_dtype = DSC$K_DTYPE_T;
02010 cdsc.dsc$b_class = DSC$K_CLASS_S;
02011 cdscp = &cdsc;
02012 }
02013 status = LIB$SPAWN(cdscp, 0, 0, 0, 0, 0, &substatus, 0, 0, 0);
02014 if (status != SS$_NORMAL)
02015 substatus = status;
02016 status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
02017 newmode, sizeof(newmode), 0, 0, 0, 0);
02018 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
02019 return (FALSE);
02020 if ((substatus&STS$M_SUCCESS) == 0)
02021 return (FALSE);
02022 return (TRUE);
02023 }
02024 #endif
02025
02026 #endif