52
52
c 19 20 21 22 23 24 25
53
53
c funcprot whereis where timer havewindow stacksize
54
54
c 26 27 28 29 30 31 32
55
c mtlb_mode link ulink c_link addinter fhelp fapropos
55
c mtlb_mode link ulink c_link addinter <free> <free>
56
56
c 33 34 35 36 37 38 39
57
c fclear what sciargs chdir getcwd ieee typename
57
c fclear what sciargs chdir getwd ieee typename
58
58
c 40 41 42 43 44 45 46
59
59
c global clearglobal isglobal gstacksize getdate intppty
60
60
c 47 48 49 50 51 52
61
c lasterror version loadhistory savehistory gethistory resethistory sendtobrowser macr2tree
62
c 53 54 55 56 57 58 59 60
63
c hidetoolbar use_as_command
64
65
if (ddt .eq. 4) then
65
66
write(buf(1:4),'(i4)') fin
66
67
call basout(io,wte,' matsys '//buf(1:4))
74
75
+ 251,300,320,350,370,380,390,400,410,420,
75
76
+ 450,500,510,600,610,620,630,640,650,660,
76
77
+ 670,680,681,682,683,684,690,691,692,693,
77
+ 694,695,697,698),fin
78
+ 694,695,697,698,699,700,701,702,703,704,
250
252
698 call intversion('version')
254
699 call loadhistory('loadhistory')
256
700 call savehistory('savehistory')
258
701 call gethistory('gethistory')
260
702 call resethistory('resethistory')
262
703 call openbrowser('openbrowser')
264
704 call macr2tree('macr2tree')
266
705 call hidetoolbar('hidetoolbar')
268
706 call useascommand('use_as_command')
254
272
c fake calls : only to force the
370
386
character*(*) fname
371
387
cc implicit undefined (a-z)
372
388
include '../stack.h'
374
logical getwsmat,checkrhs,getsmat,lib_cpp
389
integer topk,iadr,gettype
390
logical getwsmat,checkrhs,getsmat,lib_cpp,getscalar
376
391
character strf*25, c_cpp*10
434
449
strf(nlr2+1:nlr2+1)=char(0)
437
if (.not.getwsmat(fname,topk,top,m1,n1,il1,ild1)) return
438
call addinter(istk(il1),istk(ild1),m1*n1,strf,
439
$ istk(il3),istk(ild3),m3*n3,c_cpp,lib_cpp,ierr)
452
C jpc on accepte un entier
454
if ( itop .eq. 1 ) then
455
if (.not.getscalar(fname,topk,top,il1)) return
457
call addinter(ilib,iv,iv,iv,strf,
458
$ istk(il3),istk(ild3),m3*n3,c_cpp,lib_cpp,ierr)
460
if (.not.getwsmat(fname,topk,top,m1,n1,il1,ild1)) return
462
call addinter(ilib,istk(il1),istk(ild1),m1*n1,strf,
463
$ istk(il3),istk(ild3),m3*n3,c_cpp,lib_cpp,ierr)
440
465
if(ierr.ne.0) then
441
466
if (ierr.eq.-1) then
494
519
integer topk,iadr
495
520
c integer m3,n3,lr3,nlr3,m2,n2,il2,ild2,m1,n1,il1,ild1
496
521
integer ilib,iv ,l1
497
logical checkrhs,crebmat,getscalar,getsmat,cremat
522
logical checkrhs,checklhs,crebmat,getscalar,getsmat,cremat
499
524
if (.not.checkrhs(fname,1,2)) return
500
if (.not.checkrhs(fname,1,2)) return
525
if (.not.checklhs(fname,1,2)) return
502
527
if (rhs.eq.2) then
503
528
if(.not.getscalar(fname,topk,top,lr))return
509
534
if(.not.getsmat(fname,topk,top,m3,n3,1,1,lr3,nlr3))return
510
535
call cvstr(nlr3,istk(lr3),buf,1)
511
536
buf(nlr3+1:nlr3+1)=char(0)
512
call iislink(buf,ilib,irep)
537
call iislink(buf,ilib)
513
538
if (.not.crebmat(fname,top,1,1,lr)) return
514
539
if (ilib.eq.-1) then
528
subroutine scifhelp(fname)
529
c =============================
533
logical checkrhs,checklhs,getsmat,checkval,cresmat2,bufstore
535
integer a, blank,percent
536
data a/10/,blank/40/,percen/56/
540
if(.not.checkrhs(fname,0,1)) return
544
call iscihelp(buf,h,ierr)
546
if(.not.getsmat(fname,top,top-rhs+1,m1,n1,1,1,lr1,nlr1)) return
547
if(.not.checkval(fname,m1*n1,1)) return
550
if(.not.((ic.ge.a.and.ic.lt.blank) .or. ic.eq.percen)) then
553
call iscihelp(buf,h,ierr)
555
if(.not.bufstore(fname,lbuf,lbufi1,lbuff1,lr1,nlr1))
557
call iscihelp(buf,buf(lbufi1:lbuff1),ierr)
561
call objvide(fname,top)
565
subroutine scifapr(fname)
566
c =============================
569
logical checkrhs,checklhs,getsmat,checkval,cresmat2,bufstore
573
if(.not.checkrhs(fname,1,1)) return
574
if(.not.getsmat(fname,top,top-rhs+1,m1,n1,1,1,lr1,nlr1)) return
575
if(.not.checkval(fname,m1*n1,1)) return
576
c conversion to lower case
578
istk(lr1+i)=abs(istk(lr1+i))
580
if(.not.bufstore(fname,lbuf,lbufi1,lbuff1,lr1,nlr1)) return
581
call isciap(buf,buf(lbufi1:lbuff1),ierr)
582
call objvide(fname,top)
586
554
subroutine intfort(fname)
587
555
c =====================================
945
912
subroutine intschdir(fname)
946
913
character*(*) fname
947
914
logical createvar, putlhsvar
948
logical checkrhs,checklhs,getsmat
915
logical checkrhs,checklhs,getrhsvar
949
916
include '../stack.h'
951
if(.not.checkrhs(fname,1,1)) return
918
if(.not.checkrhs(fname,0,1)) return
952
919
if(.not.checklhs(fname,1,1)) return
954
if(.not.getsmat(fname,top,top,m1,n1,1,1,lr,m)) return
955
call cvstr(m,istk(lr),buf,1)
921
if(.not.createvar(1,'i',1,1,l2)) return
924
if(.not.putlhsvar()) return
928
if(.not.getrhsvar(1,'c',m1,n1,lr)) return
929
call cluni0(cstk(lr:lr+m1*n1), buf,lp)
930
buf(lp+1:lp+1)=char(0)
956
931
if(.not.createvar(2,'i',1,1,l2)) return
958
call scichdir(buf(1:m+1),istk(l2))
932
call scichdir(buf(1:lp+1),istk(l2))
959
933
if(istk(l2) .gt. 0) then
960
934
buf = fname // ': Internal Error'
1327
1314
if(.not.checklhs(fname,1,1)) return
1329
1316
if(rhs.le.0) then
1330
c clear all variable
1331
call iset(gtop-(isiz+1)*nsiz,0,idstk(1,isiz+2),1)
1317
c clear all variable but those created by the startup
1319
nv=gtop-(isiz+1)-nprotect
1321
call iset(nv*nsiz,0,idstk(1,isiz+2+nprotect),1)
1322
gtop=isiz+1+nprotect
1559
1558
$ bptlg(lgptrs(kmac)),1)
1560
1559
do 356 kk=kmac,nmacs-1
1561
1560
call icopy(nsiz,macnms(1,kk+1),1,macnms(1,kk),1)
1562
lgptrs(kk)=lgptrs(kk+1)
1561
c Francois VOGEL, May 2004
1562
c the following statement was wrong - replaced with the next line
1563
c lgptrs(kk)=lgptrs(kk+1)
1564
lgptrs(kk+1)=lgptrs(kk)+lgptrs(kk+2)-lgptrs(kk+1)
1564
lgptrs(nmacs)=lgptrs(nmacs+1)
1566
c lgptrs(nmacs)=lgptrs(nmacs+1)
1569
c else part (just these two lines) added to cure bugzilla #718
1576
1583
if(kk.eq.kk1) goto 360
1578
1586
if(kmac.lt.nmacs) then
1579
1587
l0=lgptrs(kmac+1)
1580
1588
do 358 kk=kmac+1,nmacs
1581
call icopy(lgptrs(kk+1)-l0,bptlg(l0),1,bptlg(l0-1),1)
1590
c changed to remove at once multiple breakpoints on a single line
1591
c call icopy(lgptrs(kk+1)-l0,bptlg(l0),1,bptlg(l0-1),1)
1592
call icopy(lgptrs(kk+1)-l0,bptlg(l0),1,bptlg(l0-kk2),1)
1582
1593
l0=lgptrs(kk+1)
1583
lgptrs(kk+1)=lgptrs(kk+1)-1
1594
c lgptrs(kk+1)=lgptrs(kk+1)-1
1595
lgptrs(kk)=lgptrs(kk)-kk2
1586
lgptrs(kmac+1)=lgptrs(kmac+1)-1
1598
c lgptrs(kmac+1)=lgptrs(kmac+1)-1
1599
lgptrs(nmacs+1)=lgptrs(nmacs+1)-kk2
1587
1601
if(lgptrs(kmac+1).eq.lgptrs(kmac)) then
1588
1602
if(kmac.lt.nmacs) then
1589
1603
do 359 kk=kmac,nmacs-1
1997
2012
if(err.gt.0) return
1998
2013
if(fin.eq.0) then
1999
2014
c . no, create an empty variable in the global area
2016
if (lstk(gtop+1)+vol.gt.lstk(gbot)) then
2017
c . not enought memory, realloc
2018
mem=lstk(gbot)-lstk(isiz+2)+max(vol+1,10000)
2019
call reallocglobal(mem)
2001
2023
call putid(idstk(1,gtop),id)
2010
2032
c . yes, move it to the global area
2011
2033
vol=lstk(fin+1)-lstk(fin)
2012
if (lstk(gtop+1)+vol.gt.lstk(gbot)) then
2013
mem=lstk(gbot)-lstk(isiz+2)+vol+1
2034
if (lstk(gtop+1)+vol+10.ge.lstk(gbot)) then
2035
c . max(vol+1,100000) to avoid too many reallocation
2036
mem=lstk(gbot)-lstk(isiz+2)+max(vol+1,10000)
2014
2037
call reallocglobal(mem)
2015
2038
if(err.gt.0) return
2396
2419
c . mark n oldest current variables as protected
2397
2420
if(.not.getscalar('predef',top,top,l)) return
2399
bbot=max(bot,isiz-max( nint(stk(l)),(isiz-bot0) ) )
2422
bbot=max(bot,min(isiz-nint(stk(l)),bot0))
2400
2423
elseif(ityp.eq.10) then
2401
2424
if(.not.getsmat('predef',top,top,m,n,1,1,l,n1)) return
2402
2425
if(.not.checkval('predef',m*n,1) ) return
2454
2478
pstk(pt0+2)=count
2455
2479
elseif(rstk(pt0).eq.502) then
2456
2480
c resume in an uncompiled macro or an exec or an execstr
2457
if(rstk(pt0-1).eq.903) then
2481
if(rstk(pt0-1).eq.903.or.rstk(pt0-1).eq.706) then
2458
2482
c . in an execstr, check execstr calling context
2462
if(pt0.le.0) goto 156
2463
2487
if(rstk(pt0).eq.802.or.rstk(pt0).eq.612 .or.
2464
2488
& (rstk(pt0).eq.805.and.eqid(ids(1,pt0),sel)).or.
2465
2489
& (rstk(pt0).eq.616.and.pstk(pt0).eq.10)) count=count+1
2466
if(rstk(pt0).ne.501.and.rstk(pt0).ne.502) goto 153
2467
if(paus.ne.0.and.rstk(pt0).eq.201) then
2490
if(rstk(pt0).lt.501.or.rstk(pt0).gt.503) goto 153
2491
if(rstk(pt0).eq.503.and.rio.eq.rte.and.pause.ne.0) then
2492
c . resume appele dans par un execstr sous pause
2503
call stackp(ids(1,ip0),0)
2511
elseif(paus.ne.0.and.rstk(pt0).eq.201) then
2470
2514
if (r.eq.701.or.r.eq.604) goto 156
2550
2601
c if(rhs.eq.1) lnb=1
2551
2602
if(nmacs.gt.0) then
2552
2603
do 323 kmac=1,nmacs
2553
if(eqid(macnms(1,kmac),id)) goto 325
2604
c Francois VOGEL, May 2004
2605
c if(eqid(macnms(1,kmac),id)) goto 325
2606
if(eqid(macnms(1,kmac),id)) goto 324
2609
C Serge Steer May 2004
2610
if (nmacs.ge.maxdb) then
2611
buf='Too many functions contain breakpoints'
2557
2617
call putid(macnms(1,nmacs),id)
2618
C Serge Steer May 2004
2619
if (lgptrs(nmacs)+1.gt.maxbpt) then
2620
buf='Too many defined breakpoints'
2558
2625
lgptrs(nmacs+1)=lgptrs(nmacs)+1
2559
2626
bptlg(lgptrs(nmacs))=lnb
2629
c do statement added to avoid definition of duplicate bpts
2630
324 do 3241 kk=lgptrs(kmac),lgptrs(kmac+1)-1
2631
if (bptlg(kk).eq.lnb) goto 330
2561
2633
325 if(kmac.eq.nmacs) then
2562
2634
lgptrs(nmacs+1)=lgptrs(nmacs+1)+1
2635
C Serge Steer May 2004
2636
if (lgptrs(nmacs+1)-1.gt.maxbpt) then
2637
buf='Too many defined breakpoints'
2563
2641
bptlg(lgptrs(nmacs+1)-1)=lnb
2643
C Serge Steer May 2004
2644
if (lgptrs(nmacs+1)-1.gt.maxbpt) then
2645
buf='Too many defined breakpoints'
2565
2650
do 326 kk=nmacs,kmac,-1
2567
2652
call icopy(lgptrs(kk+1)-l0,bptlg(l0),-1,bptlg(l0+1),-1)
2568
2653
lgptrs(kk+1)=lgptrs(kk+1)+1
2570
bptlg(lgptrs(kmac+1)-1)=lnb
2656
c this statement was wrong - replaced with next line
2657
c bptlg(lgptrs(kmac+1)-1)=lnb
2658
bptlg(lgptrs(kmac))=lnb
2573
2661
call objvide('setbpt',top)
2600
2688
if(.not.getscalar('stacksize',top,top,l)) return
2603
buf='stacksize cannot be used in this context'
2691
if (stk(l).lt.1000.or.stk(l).gt.2.0d0**31) then
2692
buf='Out of bounds value for stacksize argument'
2608
2697
memold=lstk(isiz)-lstk(1)
2609
if (mem.eq.memold) goto 502
2610
l=lstk(isiz)-lstk(bot)
2698
if (mem.eq.memold) goto 50
2699
lbot=lstk(isiz)-lstk(bot)
2701
if (top.gt.0) ltop=lstk(top+1)-lstk(1)
2702
if (mem.lt.lbot+ltop) then
2612
2703
buf='Required memory too small for defined data'
2613
2704
call error(1503)
2621
2712
offset=offset+1
2622
call unsfdcopy(l,stk(lstk(bot)),1,stk(offset+mem-l),1)
2623
kd=offset-lstk(1)+mem-memold
2715
c copy the top of the stack
2716
if (top.gt.0) call unsfdcopy(ltop,stk(l1),1,stk(offset),1)
2722
c copy the bottom of the stack
2723
call unsfdcopy(lbot,stk(l2),1,stk(offset+mem-lbot),1)
2724
kd2=offset+mem-lbot-l2
2730
c update reference variables
2732
if(infstk(i).ne.2) then
2734
if(istk(il).lt.0) istk(il+1)=istk(il+1)+kd1
2738
if(infstk(i).ne.2) then
2740
if(istk(il).lt.0) istk(il+1)=istk(il+1)+kd2
2744
c rebuild asolute pointers if necessary see macro.f and run.f
2747
c Check if a compiled macro is running
2750
if((rstk(p).ge.601.and.rstk(p).le.603).or.rstk(p).eq.605) then
2751
call adjuststkptr(pstk(p),kd1,kd2,l2)
2752
elseif(rstk(p).eq.604.or.rstk(p).eq.606) then
2753
call adjuststkptr(ids(1,p),kd1,kd2,l2)
2754
if(rstk(p).le.606) call adjuststkptr(ids(2,p),kd1,kd2,l2)
2755
elseif(rstk(p).ge.611.and.rstk(p).le.616) then
2756
call adjuststkptr(ids(1,p),kd1,kd2,l2)
2757
if(rstk(p).ge.614) call adjuststkptr(pstk(p),kd1,kd2,l2)
2758
elseif(rstk(p).eq.501.or.rstk(p).eq.502.or.rstk(p).eq.503) then
2759
k = lpt1 - (13+nsiz)
2761
if(rstk(p).eq.501.or.rstk(p).eq.502) then
2762
call adjuststkptr(lin(k+6),kd1,kd2,l2)
2763
call adjuststkptr(lin(k+7),kd1,kd2,l2)
2764
call adjuststkptr(ids(3,p),kd1,kd2,l2)
2629
2770
leps=sadr(iadr(lstk(isiz-5)) +4)
2633
2773
call objvide('stacksize',top)
2776
subroutine adjuststkptr(p,topoffset,botoffset,lbot)
2777
c routine for intstacksize
2778
integer p,topoffset,botoffset,lbot
2779
if(p.ge.2*lbot) then
2636
2786
subroutine inttimer
2637
2787
c Copyright INRIA
2638
2788
include '../stack.h'
2903
if(.not.getscalar('getdate', top,top, lr)) return
2905
call convertdate(dt,w)
3053
if(.not.getrmat('getdate', top, top, m1, n1, lr)) return
3055
if(.not.cremat('getdate',top,0,m1*n1,nf,l,lc)) return
3058
call convertdate(dt,w)
3059
c . dt contains a number of seconds, number of milliseconds
3062
call int2db(nf,w,1,stk(l+i),m1*n1)
3064
call copyobj('getdate',top,top-1)
3125
subroutine useascommand(fname)
3127
include '../stack.h'
3128
logical checkrhs,checklhs,cremat,getscalar,getsmat,checkval
3129
integer topk,id(nsiz)
3139
if(.not.checkrhs(fname,1,2)) return
3140
if(.not.checklhs(fname,1,1)) return
3146
if(.not.getsmat(fname,topk,top,m,n,1,1,l,nl))return
3152
call cvstr(nl,istk(l),opt,1)
3157
elseif (opt.eq.'d') then
3165
if(.not.getsmat(fname,topk,top,m,n,1,1,l,n1)) return
3166
if(.not.checkval(fname,m*n,1) ) return
3167
call namstr(id,istk(l),n1,0)
3172
lstk(top+1)=lstk(top)+1