-
Notifications
You must be signed in to change notification settings - Fork 0
/
libygl.f
2070 lines (2070 loc) · 65.3 KB
/
libygl.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
subroutine gitwks(idcon,iwtype)
c this is a site-dependent subroutine which returns
c connection identifier and workstation type
c version for Ygl graphics
c iwtype = workstation type
c 1 = gl console
iwtype = 1
c idcon = connection identifier, 1 seems to work
idcon = 1
return
end
c gks device driver for Ygl 4.0 graphics
c written by viktor k. decyk, ucla
c copyright 1997, regents of the university of california
c version for ibm rs/6000
c update: september 9, 2009
block data
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
save /gksgl/
data kosv /0/
end
subroutine gqops(istat)
c inquire operating state value
c input arguments: none
c istat = operating state (0=gks closed,1=gks open,2=workstation open,
c 3=workstation active,4=segment open)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
istat = kosv
return
end
subroutine gopks(nerrfl,meml)
c open gks
c input arguments: all
c nerrfl = error file unit number, 6 for terminal
c meml = storage limit for one segment, in bytes
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
kosv = 1
return
end
subroutine gopwk(idwk,idcon,iwtype)
c open workstation
c input arguments: all
c idwk = workstation identifier
c idcon = connection identifier
c iwtype = workstation type
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c iwk = current workstation identifier
c idc = current connection identifier
c minx/miny = location of lower left hand corner of window
minx = 40
miny = 40
c llx/lly = current window width/height
llx = 720
lly = 540
maxx = minx + llx - 1
maxy = miny + lly - 1
c constrain location and size of window
call prefpo(minx,maxx,miny,maxy)
kosv = 2
iwk = idwk
idc = idcon
return
end
subroutine gqopwk(n,ierr,now,idwk)
c inquire set number of open workstations
c input arguments: n
c n = set member requested
c ierr = error indicator
c now = number of open workstations
c idwk = workstation identifier of the nth member
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c iwk = current workstation identifier
now = 0
ierr = 0
if (kosv.ge.2) now = 1
if ((n.lt.0).or.(n.gt.1)) ierr = -12
if (n.eq.1) idwk = iwk
return
end
subroutine gqwkca(iwtype,ierr,iwkca)
c inquire workstation category
c input arguments: iwtype
c iwtype = workstation type
c ierr = error indicator
c iwkca = workstation category
c (0 = output, 1 = input, 2 = outin, 3 = wiss, 4 = mo, 5 = mi)
ierr = 0
if (iwtype.eq.1) then
iwkca = 2
else
ierr = 22
endif
return
end
subroutine gscnid(idcon,connam)
c set connection identifier
c input arguments: all
c idcon = connection identifier
c connam = connection name
character*8 connam
c open(unit=idcon,file=connam,form='formatted',status='unknown')
return
end
subroutine gqwkc(idwk,ierr,idcon,iwtype)
c inquire workstation connection and type
c input arguments: idwk
c idwk = workstation identifier
c ierr = error indicator
c idcon = connection identifier
c iwtype = workstation type
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c iwk = current workstation identifier
c idc = current connection identifier
ierr = 0
idcon = idc
if (idwk.eq.iwk) then
iwtype = 1
else
ierr = 20
endif
return
end
subroutine gacwk(idwk)
c activate workstation
c input arguments: all
c idwk = workstation identifier
integer winope
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c special case for sgi
c prevent graphical process from being put in background
c call foregr
c create a window
idwind = winope(' gkslib ',8)
c create gl defaults
call gldflts
kosv = 3
return
end
subroutine gqacwk(n,ierr,naw,idwk)
c inquire set of active workstations
c input arguments: n
c n = set member requested
c ierr = error indicator
c naw = number of active workstations
c idwk = workstation identifier of the nth member
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c iwk = current workstation identifier
naw = 0
ierr = 0
if (kosv.ge.3) naw = 1
if ((n.lt.0).or.(n.gt.1)) ierr = -12
if (n.eq.1) idwk = iwk
return
end
subroutine gqwks(idwk,ierr,istat)
c inquire workstation state
c input arguments: idwk
c idwk = workstation identifier
c ierr = error indicator
c istat = workstation state (0 = inactive, 1 = active)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c iwk = current workstation identifier
ierr = 0
istat = 0
if (kosv.lt.2) ierr = 25
if (kosv.ge.3) istat = 1
if (idwk.ne.iwk) then
istat = 0
ierr = 20
endif
return
end
subroutine gqcf(iwtype,ierr,ncoli,iscol,npci)
c inquire color facilities
c input arguments: iwtype
c iwtype = workstation type
c ierr = error indicator (0=inquiry successful)
c ncoli = number of colors available
c iscol = color availability indicator, 0 = monochrome, 1 = color
c npci = number of predefined color indices
ierr = 0
c ncoli = 4096
ncoli = 128
iscol = 0
if (ncoli.gt.2) iscol = 1
npci = ncoli
return
end
subroutine gscr(idwk,ic,cr,cg,cb)
c set color representation
c input arguments: all
c idwk = workstation identifier
c ic = color index
c cr/cg/cb = red/green/blue component (0 < cr,cg,cb < 1)
c convert to integer
icr = 255.*cr
icg = 255.*cg
icb = 255.*cb
c change a color map entry to a specified RGB value
call mapcol(ic,icr,icg,icb)
return
end
subroutine gqeci(idwk,n,ierr,ncoli,icol)
c inquire list element of color indices
c input arguments: idwk, n
c idwk = workstation identifier
c n = requested list element
c ierr = error indicator
c ncoli = number of indices currently defined
c icol = color index of requested element
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c iwk = current workstation identifier
ierr = 0
c ncoli = 4096
ncoli = 128
if (idwk.ne.iwk) ierr = -12
if ((n.lt.0).or.(n.gt.ncoli)) ierr = -12
if ((n.gt.0).and.(n.le.ncoli)) icol = n - 1
return
end
subroutine gqdsp(iwtype,ierr,idcun,dcx,dcy,lx,ly)
c inquire maximum display surface size
c input arguments: iwtype
c iwtype = workstation type
c ierr = error indicator (0=inquiry successful)
c idcun = device coordinate units, (0=meters,1=other)
c dcx/dcy = width/height in device coordinate units
c lx/ly = width/height in device (raster) units
idcun = 1
c return size of a window
call getsiz(llx,lly)
c llx/lly = current window width/height
lx = llx
ly = lly
dcx = float(lx - 1)
dcy = float(ly - 1)
ierr = 0
return
end
subroutine gswkwn(idwk,xmin,xmax,ymin,ymax)
c set workstation window
c input arguments: all
c idwk = workstation identifier
c xmin/xmax = window x coordinates in ndc
c ymin/ymax = window y coordinates in ndc
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c wwnvp = workstation window and viewport
c trans = normalization transformations
c clip to maximum window size
wwnvp(1) = amax1(xmin,0.)
wwnvp(2) = amin1(xmax,1.)
wwnvp(3) = amax1(ymin,0.)
wwnvp(4) = amin1(ymax,1.)
c redefine viewport of transformation 0
trans(1,1) = wwnvp(1)
trans(2,1) = wwnvp(2)
trans(3,1) = wwnvp(3)
trans(4,1) = wwnvp(4)
return
end
subroutine gswkvp(idwk,xmin,xmax,ymin,ymax)
c set workstation viewport
c input arguments: all
c idwk = workstation identifier
c xmin/xmax = viewport x coordinates in device coordinates
c ymin/ymax = viewport y coordinates in device coordinates
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c wwnvp = workstation window and viewport
c return size of a window
call getsiz(llx,lly)
c llx/lly = current window width/height
dcx = float(llx - 1)
dcy = float(lly - 1)
c clip to maximum screen size
wwnvp(5) = amax1(xmin,0.)
wwnvp(7) = amax1(ymin,0.)
wwnvp(6) = amin1(xmax,dcx)
wwnvp(8) = amin1(ymax,dcy)
return
end
subroutine gqsts(idwk,idstr,mldr,ierr,mode,iesw,lstr,str,ipet,eare
1a,lenb,ipos,ldr,datar)
c inquire string device state
c input arguments: idwk, idstr, mldr
c idwk = workstation identifier
c idstr = string device number
c mldr = maximum dimension of data record array
c ierr = error indicator (0=inquiry successful)
c mode = operating mode (0=request,1=sample,2=event)
c iesw = echo switch (0=no echo,1=echo)
c lstr = number of characters in initial string
c str = initial string
c ipet = prompt/echo type (1=normal)
c earea(1)/earea(2) = echo area x coordinates in device coordinates
c earea(3)/earea(4) = echo area y coordinates in device coordinates
c lenb = input buffer size
c ipos = inital edit position
c ldr = length of data record array
c datar = data record array
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c cea = character echo area
character*(*) str
character*80 datar(mldr)
dimension earea(4)
mode = 0
iesw = 1
lstr = 1
str(1:1) = ' '
ipet = 1
do 10 j = 1, 4
earea(j) = cea(j)
10 continue
lenb = 80
ipos = 1
ldr = 1
ierr = 0
return
end
subroutine gqlcs(idwk,idloc,itype,mldr,ierr,mode,iesw,nrt,pxi,pyi,
1ipet,earea,ldr,datar)
c inquire locator device state
c input arguments: idwk, idloc, itype, mldr
c idwk = workstation identifier
c idloc = locator device number
c itype = type of returned value (0=set,1=realized)
c mldr = maximum dimension of data record array
c ierr = error indicator (0=inquiry successful)
c mode = operating mode (0=request,1=sample,2=event)
c iesw = echo switch (0=no echo,1=echo)
c nrt = normalization transformation number for initial position
c pxi/pyi = initial position, in world coordinates
c ipet = prompt/echo type (1=normal)
c earea(1)/earea(2) = echo area x coordinates in device coordinates
c earea(3)/earea(4) = echo area y coordinates in device coordinates
c ldr = length of data record array
c datar = data record array
character*80 datar(mldr)
dimension earea(4)
mode = 0
iesw = 1
nrt = 0
pxi = .5
pyi = .5
ipet = 1
c return size of a window
call getsiz(llx,lly)
c llx/lly = current window width/height
earea(1) = 0.
earea(2) = float(llx - 1)
earea(3) = 0.
earea(4) = float(lly - 1)
ldr = 1
ierr = 0
return
end
subroutine ginst(idwk,idstr,lstr,str,ipet,xmin,xmax,ymin,ymax,lenb
1,ipos,ldr,datar)
c initialize string device
c input arguments: all
c idwk = workstation identifier
c idstr = string device number
c lstr = number of characters in initial string
c str = initial string
c ipet = prompt/echo type (1=normal)
c xmin/xmax = echo area x coordinates in device coordinates
c ymin/ymax = echo area y coordinates in device coordinates
c lenb = input buffer size
c ipos = inital edit position
c ldr = length of data record array
c datar = data record array
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c keydv = keyboard device number
c idst = current string device number
c cea = character echo area
character*80 datar(ldr)
character*(*) str
c save string device number
idst = idstr
c save characer echo area
cea(1) = xmin
cea(2) = xmax
cea(3) = ymin
cea(4) = ymax
c keyboard device number
KEYBD = 513
keydv = KEYBD
c enable input device for event queuing
call qdevic(keydv)
return
end
subroutine ginlc(idwk,idloc,nrt,px,py,ipet,xmin,xmax,ymin,ymax,ldr
1,datar)
c initialize locator device
c input arguments: all
c idwk = workstation identifier
c idloc = locator device number
c nrt = initial normalization transformation number
c px/py = initial locator position, in world coordinates
c ipet = prompt/echo type (1=normal)
c xmin/xmax = echo area x coordinates in device coordinates
c ymin/ymax = echo area y coordinates in device coordinates
c ldr = length of data record array
c datar = data record array
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c mousdv = botton device number
c idlc = current locator device number
c mosx/mosy = x/y valuator device numbers
character*80 datar(ldr)
c save locator device number
idlc = idloc
c right mouse
MOUSE1 = 101
c middle mouse
MOUSE2 = 102
c left mouse
MOUSE3 = 103
c button device number
mousdv = MOUSE3
c enable input device for event queuing
call qdevic(mousdv)
c x/y mouse location valuators
MOUSEX = 266
MOUSEY = 267
c valuator device numbers
mosx = MOUSEX
mosy = MOUSEY
c enable input device for event queuing
call qdevic(mosx)
call qdevic(mosy)
c tie two valuators to a button
call tie(mousdv,mosx,mosy)
return
end
subroutine gdawk(idwk)
c deactivate workstation
c input arguments: all
c idwk = workstation identifier
integer winget
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c keydv = keyboard device number
c mousdv = botton device number
c idst = current string device number
c idlc = current locator device number
c mosx/mosy = x/y valuator device numbers
c disable mouse if enabled
if (idlc.gt.0) then
c disable an input device for event queuing
call unqdev(mosx)
call unqdev(mosy)
c disable an input device for event queuing
call unqdev(mousdv)
endif
c disable an input device for event queuing
if (idst.gt.0) call unqdev(keydv)
c return identifier of current window
idwind = winget()
c close the identified window
call winclo(idwind)
kosv = 2
return
end
subroutine gclwk(idwk)
c close workstation
c input arguments: all
c idwk = workstation identifier
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
c terminate the graphics program
call gexit
kosv = 1
return
end
subroutine gclks
c close gks
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c kosv = operating state value
kosv = 0
return
end
subroutine gclrwk(idwk,icofl)
c clear workstation
c input arguments: all
c idwk = workstation identifier
c icofl = control flag (0=conditionally,1=always)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c idvt = device transformation
c wwnvp = workstation window and viewport
c set current color in color map mode to background
call color(0)
c clipping is on
if (kcf.eq.1) then
c reset viewport to maximum screen size
minx = wwnvp(5)
maxx = wwnvp(6)
miny = wwnvp(7)
maxy = wwnvp(8)
c set the area of window used for drawing
call viewpo(minx,maxx,miny,maxy)
c clear to the screenmask
call clear
c set the area of window used for drawing
call viewpo(idvt(1),idvt(2),idvt(3),idvt(4))
c clipping is off
else
c clear to the screenmask
call clear
endif
return
end
subroutine gqcntn(ierr,nrt)
c inquire current normalization transformation number
c input arguments: none
c ierr = error indicator (0=inquiry successful)
c nrt = transformation number (0 <= nrt <= 25)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c nrtn = current normalization transformation number
ierr = 0
nrt = nrtn
return
end
subroutine gqnt(nrt,ierr,window,viewpt)
c inquire normalization transformation
c input arguments: nrt
c nrt = transformation number (0 <= nrt <= 25)
c ierr = error indicator (0=inquiry successful)
c window(1)/window(2) = window x coordinates in world coordinates
c window(3)/window(4) = window y coordinates in world coordinates
c viewpt(1)/viewpt(2) = viewport x coordinates in ndc
c viewpt(3)/viewpt(4) = viewport y coordinates in ndc
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c trans = normalization transformations
dimension window(4), viewpt(4)
ierr = 0
if ((nrt.lt.0).or.(nrt.ge.maxt)) then
nrt = 0
ierr = 1
endif
n = nrt + 1
do 10 j = 1, 4
window(j) = trans(j+4,n)
viewpt(j) = trans(j,n)
10 continue
return
end
subroutine gswn(nrt,xmin,xmax,ymin,ymax)
c set window
c input arguments: all
c nrt = transformation number (1 <= nrt <= 25)
c xmin/xmax = window x coordinates in world coordinates
c ymin/ymax = window y coordinates in world coordinates
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c trans = normalization transformations
if ((nrt.lt.0).or.(nrt.ge.maxt)) nrt = 0
n = nrt + 1
c store transformation
trans(5,n) = xmin
trans(6,n) = xmax
trans(7,n) = ymin
trans(8,n) = ymax
return
end
subroutine gsvp(nrt,xmin,xmax,ymin,ymax)
c set viewport
c input arguments: all
c nrt = transformation number (1 <= nrt <= 25)
c xmin/xmax = viewport x coordinates in ndc
c ymin/ymax = viewport y coordinates in ndc
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c trans = normalization transformations
if ((nrt.lt.0).or.(nrt.ge.maxt)) nrt = 0
n = nrt + 1
c store transformation
trans(1,n) = xmin
trans(2,n) = xmax
trans(3,n) = ymin
trans(4,n) = ymax
return
end
subroutine gselnt(nrt)
c select normalization transformation
c input arguments: all
c nrt = transformation number (1 <= nrt <= 25)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
real*4 xmin, xmax, ymin, ymax
c nrtn = current normalization transformation number
c kcf = clipping flag
c idvt = device transformation
c wwnvp = workstation window and viewport
c trans = normalization transformations
if ((nrt.lt.0).or.(nrt.ge.maxt)) nrt = 0
nrtn = nrt
n = nrt + 1
c clip to workstation window
xmin = amax1(wwnvp(1),trans(1,n))
xmax = amin1(wwnvp(2),trans(2,n))
ymin = amax1(wwnvp(3),trans(3,n))
ymax = amin1(wwnvp(4),trans(4,n))
c convert from viewport to screen coordinates
scx = (wwnvp(6) - wwnvp(5))/(wwnvp(2) - wwnvp(1))
idvt(1) = (xmin - wwnvp(1))*scx + wwnvp(5) + .5
idvt(2) = (xmax - wwnvp(1))*scx + wwnvp(5) + .5
scy = (wwnvp(8) - wwnvp(7))/(wwnvp(4) - wwnvp(3))
idvt(3) = (ymin - wwnvp(3))*scy + wwnvp(7) + .5
idvt(4) = (ymax - wwnvp(3))*scy + wwnvp(7) + .5
c clipping is on
if (kcf.eq.1) then
c set the area of window used for drawing
call viewpo(idvt(1),idvt(2),idvt(3),idvt(4))
c define orthographic transformation
xmin = trans(5,n)
xmax = trans(6,n)
ymin = trans(7,n)
ymax = trans(8,n)
call ortho2(xmin,xmax,ymin,ymax)
c clipping is off
else
c reset viewport to maximum screen size
minx = wwnvp(5)
maxx = wwnvp(6)
miny = wwnvp(7)
maxy = wwnvp(8)
c set the area of window used for drawing
call viewpo(minx,maxx,miny,maxy)
c calculate new window to preserve scaling
scx = (trans(6,n) - trans(5,n))/float(idvt(2) - idvt(1))
scy = (trans(8,n) - trans(7,n))/float(idvt(4) - idvt(3))
xmin = trans(5,n) + (wwnvp(5) - float(idvt(1)))*scx
xmax = trans(5,n) + (wwnvp(6) - float(idvt(1)))*scx
ymin = trans(7,n) + (wwnvp(7) - float(idvt(3)))*scy
ymax = trans(7,n) + (wwnvp(8) - float(idvt(3)))*scy
c define orthographic transformation
call ortho2(xmin,xmax,ymin,ymax)
endif
return
end
subroutine gqln(ierr,ltype)
c inquire linetype
c input arguments: none
c ierr = error indicator (0=inquiry successful)
c ltype = linetype, 1 = solid, 2 = dash, 3 = dot, 4 = dash-dot
integer getlst
c returns the current linestyle
ltc = getlst()
ltype = ltc + 1
ierr = 0
return
end
subroutine gslwsc(alwsc)
c set linewidth scale factor
c input arguments: all
c alwsc = linewidth scale factor, (alwsc > 1.0)
lws = alwsc
if (lws.lt.1) lws = 1
if (lws.gt.3) lws = 3
c specify the linewidth
call linewi(lws)
return
end
subroutine gsplci(icol)
c set polyline color index
c input arguments: all
c icol = color index
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c lcl = current line color
lcl = icol
return
end
subroutine gsln(ltype)
c set linetype
c input arguments: all
c ltype = linetype, 1 = solid, 2 = dash, 3 = dot, 4 = dash-dot
ltc = 0
if ((ltype.ge.1).and.(ltype.le.5)) ltc = ltype - 1
c select linestyle
call setlin(ltc)
return
end
subroutine gpl(n,px,py)
c draw polyline
c input arguments: all
c n = number of points to be connected by a polyline
c px/py = x/y coordinates of points in world coordinates
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
real*4 ax, ay
c nrtn = current normalization transformation number
c lcl = current line color
c idvt = device transformation
c trans = normalization transformations
dimension px(n), py(n)
c set current color in color map mode
call color(lcl)
c move cursor
ax = px(1)
ay = py(1)
c special case of a line to itself
if (n.gt.1) then
if ((px(2).eq.ax).and.(py(2).eq.ay)) then
c calculate transformation factors
m = nrtn + 1
eps = (trans(6,m) - trans(5,m))/float(idvt(2) - idvt(1))
ax = ax - eps
eps = (trans(8,m) - trans(7,m))/float(idvt(4) - idvt(3))
ay = ay - eps
endif
endif
c move the current graphics position to a specified point
call move2(ax,ay)
do 10 j = 2, n
c draw a line
ax = px(j)
ay = py(j)
call draw2(ax,ay)
10 continue
return
end
subroutine gqmk(ierr,mtype)
c inquire marker type
c input arguments: none
c ierr = error indicator (0=inquiry successful)
c mtype = marker type
c 1 = dot, 2 = plus, 3 = star, 4 = circle, 5 = cross, 6 = square,
c 7 = square with cross, 8 = diamond, 9 = diamond with cross,
c 10 = filled circle
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c mtc = current marker type
mtype = mtc
ierr = 0
return
end
subroutine gsmksc(amksc)
c set marker size scale factor
c input arguments: all
c amksc = linewidth scale factor, (amksc > 1.0)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c ams = current marker size scale factor
ams = amksc
return
end
subroutine gspmci(imcol)
c set polymarker color index
c input arguments: all
c imcol = polymarker color index
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c lcm = current marker color
lcm = imcol
return
end
subroutine gsmk(mtype)
c set marker type
c input arguments: all
c mtype = marker type
c 1 = dot, 2 = plus, 3 = star, 4 = circle, 5 = cross, 6 = square,
c 7 = square with cross, 8 = diamond, 9 = diamond with cross,
c 10 = filled circle
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c mtc = current marker type
if ((mtype.ge.1).and.(mtype.le.10)) then
c set marker symbol
mtc = mtype
else
c set marker symbol to star
mtc = 3
endif
return
end
subroutine gpm(n,px,py)
c draw polymarker
c input arguments: all
c n = number of points to be connected by a polymarker
c px/py = x/y coordinates of points in world coordinates
integer gethei, strwid
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
real*4 ax, ay
c nrtn = current normalization transformation number
c lcm = current marker color
c idvt = device transformation
c trans = normalization transformations
dimension px(n), py(n)
character*1 amks(10)
save amks
data amks /'.','+','*','o','x','#','H','V','W','@'/
c set current color in color map mode
call color(lcm)
c special case of dot markers
if (mtc.eq.1) then
do 10 j = 1, n
c draw a point in modeling coordinates
ax = px(j)
ay = py(j)
call pnt2(ax,ay)
10 continue
c other markers
else
c return maximum character height in current raster font
ich = gethei()
c return width of the specified string
icw = strwid(amks(mtc),1)
c convert to world coordinates
m = nrtn + 1
scx = (trans(6,m) - trans(5,m))/float(idvt(2) - idvt(1))
scy = (trans(8,m) - trans(7,m))/float(idvt(4) - idvt(3))
dx = .5*float(icw)*scx
dy = .5*float(ich)*scy
do 20 j = 1, n
c shift origin of character
ax = px(j) - dx
ay = py(j) - dy
c update the current text character position
call cmov2(ax,ay)
c draw string of raster characters on screen
call charst(amks(mtc),1)
20 continue
endif
return
end
subroutine gqtxal(ierr,itxalh,itxalv)
c inquire text alignment
c input arguments: none
c ierr = error indicator
c itxalh = horizontal component
c 0 = normal, 1 = left, 2 = center, 3 = right
c itxalv = vertical component:
c = 0 normal, 1 = top, 2 = cap, 3 = half, 4 = base, 5 = bottom
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c itx = current horizontal text alignment
c ity = current vertical text alignment
ierr = 0
itxalh = itx
itxalv = ity
return
end
subroutine gqchh(ierr,chh)
c inquire character height
c input arguments: none
c ierr = error indicator
c chh = character height, in world coordinates
integer gethei
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv
dimension idvt(4), wwnvp(8), cea(4), trans(8,maxt), chuv(2)
c nrtn = current normalization transformation number
c idvt = device transformation
c trans = normalization transformations
c return maximum character height in current raster font
ich = gethei()
c convert to world coordinates
m = nrtn + 1
scy = (trans(8,m) - trans(7,m))/float(idvt(4) - idvt(3))
chh = float(ich)*scy
ierr = 0
return
end
subroutine gqtxp(ierr,itxp)
c inquire text path
c input arguments: none
c ierr = error indicator
c itxp = text path (0=right(default), 1=left, 2=up, 3=down)
parameter(maxt=3)
common /gksgl/ kosv,iwk,idc,keydv,mousdv,nrtn,itx,ity,kcf,lcl,lcm,
1lct,lcf,mtc,infs,itxtp,idst,idlc,mosx,mosy,idvt,ams,chx,cch,wwnvp,
2cea,trans,chuv