ruby-pgplot 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +100 -0
- data/README.ja +91 -0
- data/cogen.rb +157 -0
- data/demo/pgdemo1.rb +414 -0
- data/demo/pgdemo15.rb +78 -0
- data/demo/pgdemo3.rb +188 -0
- data/demo/pgdemo4.rb +80 -0
- data/demo/pgdemo9.rb +44 -0
- data/depend +4 -0
- data/extconf.rb +97 -0
- data/kwarg.c +78 -0
- data/rb_pgplot.c.in +1266 -0
- data/test/pgband.rb +21 -0
- data/test/pgcurs.rb +14 -0
- data/test/pggray.rb +21 -0
- data/test/pglcur.rb +14 -0
- data/test/pgline.rb +13 -0
- data/test/pgncur.rb +14 -0
- data/test/pgolin.rb +14 -0
- data/test/pgtick.rb +12 -0
- metadata +97 -0
data/demo/pgdemo15.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'narray'
|
2
|
+
require 'pgplot'
|
3
|
+
include NMath
|
4
|
+
include Pgplot
|
5
|
+
#-----------------------------------------------------------------------
|
6
|
+
# Demonstration program for PGPLOT vector field plot.
|
7
|
+
#
|
8
|
+
# Program to demonstrate the use of PGVECT along with
|
9
|
+
# PGCONB by illustrating the flow around a cylinder with circulation.
|
10
|
+
#-----------------------------------------------------------------------
|
11
|
+
twopi = 2*Math::PI
|
12
|
+
blank = -1.0e10
|
13
|
+
# number of points in the x and y directions
|
14
|
+
nx = 31
|
15
|
+
ny = 31
|
16
|
+
# cylinder radius
|
17
|
+
a = 1.0
|
18
|
+
# circulation strength
|
19
|
+
gamma = 2.0
|
20
|
+
# freestream velocity
|
21
|
+
vinf = 1.0
|
22
|
+
# max and min x and y
|
23
|
+
xmax = 3.0*a
|
24
|
+
xmin = -3.0*a
|
25
|
+
ymax = 3.0*a
|
26
|
+
ymin = -3.0*a
|
27
|
+
# point spacing
|
28
|
+
dx = (xmax-xmin)/(nx-1)
|
29
|
+
dy = (ymax-ymin)/(ny-1)
|
30
|
+
# compute the stream function, Cp, and u and v velocities
|
31
|
+
a2 = a**2
|
32
|
+
x = NArray.sfloat(nx,1).indgen!*dx + xmin
|
33
|
+
y = NArray.sfloat(1,ny).indgen!*dy + ymin
|
34
|
+
r2 = x**2 + y**2
|
35
|
+
r2[(r2.eq 0).where] = 1e-10
|
36
|
+
psi = vinf * y * (1-a2/r2) + gamma/twopi*0.5*log(r2/a)
|
37
|
+
u = vinf * (1 + a2/r2 - 2*a2*(x/r2)**2) + gamma/twopi * y/r2
|
38
|
+
v = vinf * x * (-2*a2*y/r2**2) + gamma/twopi * x/r2
|
39
|
+
cp = 1 - (u**2+v**2)/vinf**2
|
40
|
+
idx = (r2 < a2).where
|
41
|
+
u[idx] =
|
42
|
+
v[idx] = blank
|
43
|
+
#
|
44
|
+
# start drawing
|
45
|
+
#
|
46
|
+
pgbeg
|
47
|
+
pgenv( x[0], x[-1], y[0], y[-1], 1 )
|
48
|
+
pgiden
|
49
|
+
pglab('X','Y','Flow About a Cylinder with Circulation')
|
50
|
+
#
|
51
|
+
# contour plot of the stream function (streamlines)
|
52
|
+
#
|
53
|
+
tr = [ x[0]-dx, dx, 0.0, y[0]-dy, 0.0, dy ]
|
54
|
+
level = [ 1.0, 0.5, 0.0, -0.5, -1.0 ]
|
55
|
+
pgcont( psi, level, tr )
|
56
|
+
#
|
57
|
+
# draw cylinder
|
58
|
+
#
|
59
|
+
pgbbuf
|
60
|
+
pgsci(0)
|
61
|
+
pgsfs(1)
|
62
|
+
pgcirc(0.0, 0.0, a*1.1)
|
63
|
+
pgsfs(2)
|
64
|
+
pgsci(14)
|
65
|
+
pgcirc(0.0, 0.0, a)
|
66
|
+
pgsci(1)
|
67
|
+
pgebuf
|
68
|
+
#
|
69
|
+
# vector plot
|
70
|
+
#
|
71
|
+
pgsah(2, 45.0, 0.7)
|
72
|
+
pgsch(0.3)
|
73
|
+
tr = [ x[0], dx, 0.0, y[0], 0.0, dy ]
|
74
|
+
pgvect( u[1..-2,1..-2], v[1..-2,1..-2], 0.0, 0, tr, -1.0e10 )
|
75
|
+
pgsch(1.0)
|
76
|
+
#
|
77
|
+
# finish
|
78
|
+
#
|
data/demo/pgdemo3.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
require 'narray'
|
2
|
+
require 'pgplot'
|
3
|
+
include Pgplot
|
4
|
+
include NMath
|
5
|
+
|
6
|
+
def main
|
7
|
+
exit unless pgbeg('?',1,1)
|
8
|
+
print " Routine PGCONT\n"
|
9
|
+
pgex31
|
10
|
+
print " Routine PGCONS\n"
|
11
|
+
pgex32
|
12
|
+
print " Routine PGCONB\n"
|
13
|
+
pgex33
|
14
|
+
print " Routine PGCONT with PGCONL labels\n"
|
15
|
+
pgex36
|
16
|
+
#print " Routine PGCONX with arrow labels\n"
|
17
|
+
#pgex37
|
18
|
+
#print " Routine PGCONX\n"
|
19
|
+
#pgex34
|
20
|
+
print " Routine PGCONF\n"
|
21
|
+
pgexx1
|
22
|
+
pgend
|
23
|
+
end
|
24
|
+
|
25
|
+
# ====== Utility ======
|
26
|
+
|
27
|
+
class PgLinestyle
|
28
|
+
attr_accessor :width
|
29
|
+
attr_accessor :color
|
30
|
+
attr_accessor :style
|
31
|
+
|
32
|
+
def initialize(opt=nil)
|
33
|
+
@width = 1
|
34
|
+
@color = 1
|
35
|
+
@style = 1
|
36
|
+
if opt.is_a?(Hash)
|
37
|
+
@width = opt[:width] || @width
|
38
|
+
@width = opt['width'] || @width
|
39
|
+
@color = opt[:color] || @color
|
40
|
+
@color = opt['color'] || @color
|
41
|
+
@style = opt[:style] || @style
|
42
|
+
@style = opt['style'] || @style
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def set
|
47
|
+
pgslw @width
|
48
|
+
pgsci @color
|
49
|
+
pgsls @style
|
50
|
+
end
|
51
|
+
end # class PgLinestyle
|
52
|
+
|
53
|
+
NC=21
|
54
|
+
Pgline_default = PgLinestyle.new
|
55
|
+
$sty = (1..NC).collect{|i|
|
56
|
+
if i<10
|
57
|
+
x = PgLinestyle.new(:width =>1, :color =>2, :style =>2)
|
58
|
+
else
|
59
|
+
x = PgLinestyle.new(:width =>1, :color =>3, :style =>1)
|
60
|
+
end
|
61
|
+
if i%5==0
|
62
|
+
x.width = 5
|
63
|
+
end
|
64
|
+
x
|
65
|
+
}
|
66
|
+
i = NArray.sfloat(40,1).indgen!(1)
|
67
|
+
j = NArray.sfloat(1,40).indgen!(1)
|
68
|
+
$f = cos( 0.3*sqrt(i*2)-0.4*j/3 ) * cos( 0.4*i/3 ) + (i-j)/40.0
|
69
|
+
$lv = NArray.sfloat(NC).indgen!*($f.max-$f.min)/NC+$f.min
|
70
|
+
#NArray.span($f.minmax,NC)
|
71
|
+
|
72
|
+
# ====== Exsample routine ======
|
73
|
+
|
74
|
+
def pgex31
|
75
|
+
pgpage
|
76
|
+
pgsvp(0.05,0.95,0.05,0.95)
|
77
|
+
pgswin(1.0,40.0,1.0,40.0)
|
78
|
+
pgbox('bcts',0.0,0,'bcts',0.0,0)
|
79
|
+
pgmtxt('t',1.0,0.0,0.0,'Contouring using PGCONT')
|
80
|
+
pgbbuf
|
81
|
+
for i in 0...NC
|
82
|
+
$sty[i].set
|
83
|
+
pgcont $f, $lv[i]
|
84
|
+
end
|
85
|
+
Pgline_default.set
|
86
|
+
pgebuf
|
87
|
+
end
|
88
|
+
|
89
|
+
def pgex32
|
90
|
+
pgpage
|
91
|
+
pgsvp(0.05,0.95,0.05,0.95)
|
92
|
+
pgswin(1.0,40.0,1.0,40.0)
|
93
|
+
pgbox('bcts',0.0,0,'bcts',0.0,0)
|
94
|
+
pgmtxt('t',1.0,0.0,0.0,'Contouring using PGCONS')
|
95
|
+
pgbbuf
|
96
|
+
for i in 0...NC
|
97
|
+
$sty[i].set
|
98
|
+
pgcons $f, $lv[i]
|
99
|
+
end
|
100
|
+
Pgline_default.set
|
101
|
+
pgebuf
|
102
|
+
end
|
103
|
+
|
104
|
+
def pgex33
|
105
|
+
pgpage
|
106
|
+
pgsvp(0.05,0.95,0.05,0.95)
|
107
|
+
pgswin(1.0,40.0,1.0,40.0)
|
108
|
+
pgbox('bcts',0.0,0,'bcts',0.0,0)
|
109
|
+
pgmtxt('t',1.0,0.0,0.0,'Contouring using PGCONB')
|
110
|
+
pgbbuf
|
111
|
+
|
112
|
+
blank = -65536.0
|
113
|
+
|
114
|
+
f = $f.dup
|
115
|
+
i = NArray.sfloat(40,1).indgen!(1)
|
116
|
+
j = NArray.sfloat(1,40).indgen!(1)
|
117
|
+
r = sqrt((i-20.5)**2 + (j-20.5)**2)
|
118
|
+
idx = ((r>20).or(r<3.0)).where
|
119
|
+
f[idx] = blank
|
120
|
+
pgsci 1
|
121
|
+
pgpt( (i+NArray.int(1,40))[idx], (j+NArray.int(40,1))[idx], 1 )
|
122
|
+
|
123
|
+
for i in 0...NC
|
124
|
+
$sty[i].set
|
125
|
+
pgconb f, $lv[i], blank
|
126
|
+
end
|
127
|
+
Pgline_default.set
|
128
|
+
pgebuf
|
129
|
+
end
|
130
|
+
|
131
|
+
def pgex36
|
132
|
+
pgpage
|
133
|
+
pgsvp(0.05,0.95,0.05,0.95)
|
134
|
+
pgswin(1.0,40.0,1.0,40.0)
|
135
|
+
pgbox('bcts',0.0,0,'bcts',0.0,0)
|
136
|
+
pgmtxt('t',1.0,0.0,0.0,'Contouring using PGCONT and PGCONL labels')
|
137
|
+
pgbbuf
|
138
|
+
|
139
|
+
for i in 0...NC
|
140
|
+
$sty[i].set
|
141
|
+
pgcons $f, $lv[i]
|
142
|
+
end
|
143
|
+
pgslw 1
|
144
|
+
pgsls 1
|
145
|
+
1.step(20,2) {|i|
|
146
|
+
pgsci $sty[i].color
|
147
|
+
pgconl $f,$lv[i],"%2i"%(i+1),16,8
|
148
|
+
}
|
149
|
+
Pgline_default.set
|
150
|
+
pgebuf
|
151
|
+
end
|
152
|
+
|
153
|
+
def pgexx1
|
154
|
+
nx=ny=51
|
155
|
+
c = [3.0, 3.2, 3.5, 3.6, 3.766413, 4.0 ,5.0, 10.0, 100.0]
|
156
|
+
xmin =-2.0
|
157
|
+
xmax = 2.0
|
158
|
+
ymin =-2.0
|
159
|
+
ymax = 2.0
|
160
|
+
mu = 0.3
|
161
|
+
dx = (xmax-xmin)/(nx-1)
|
162
|
+
dy = (ymax-ymin)/(ny-1)
|
163
|
+
tr = [xmin-dx, dx, 0.0, ymin-dy, 0.0, dy]
|
164
|
+
x = tr[0] + NArray.sfloat(nx,1).indgen!(1)*tr[1]
|
165
|
+
y = tr[3] + NArray.sfloat(1,ny).indgen!(1)*tr[5]
|
166
|
+
z = (1.0-mu)*(2.0/sqrt((x-mu)**2+y**2)+(x-mu)**2+y**2) +
|
167
|
+
mu*(2.0/sqrt((x+1.0-mu)**2+y**2)+(x+1.0-mu)**2+y**2)
|
168
|
+
|
169
|
+
pgpage
|
170
|
+
pgvstd
|
171
|
+
pgwnad(xmin, xmax, ymin, ymax)
|
172
|
+
pgsfs(1)
|
173
|
+
for i in 0..c.size-2
|
174
|
+
r = 0.5+0.5*(i-1)/(c.size-1)
|
175
|
+
pgscr(i+10, r, r, r)
|
176
|
+
pgsci(i+10)
|
177
|
+
pgconf(z,c[i]..c[i+1],tr)
|
178
|
+
end
|
179
|
+
pgsci(3)
|
180
|
+
pgcont(z,c,tr)
|
181
|
+
pgsci(1)
|
182
|
+
pgsch(0.6)
|
183
|
+
pgbox('bctsin',1.0,10,'bctsinv',1.0,10)
|
184
|
+
pgsch(1.0)
|
185
|
+
pgmtxt('t',1.0,0.0,0.0,'Contour filling using PGCONF')
|
186
|
+
end
|
187
|
+
|
188
|
+
main
|
data/demo/pgdemo4.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'narray'
|
2
|
+
require 'pgplot'
|
3
|
+
include Pgplot
|
4
|
+
include NMath
|
5
|
+
|
6
|
+
def setvp
|
7
|
+
pgsvp(0.0, 1.0, 0.0, 1.0)
|
8
|
+
vpx1, vpx2, vpy1, vpy2 = pgqvp(1)
|
9
|
+
d = [vpx2-vpx1, vpy2-vpy1].min/40.0
|
10
|
+
vpx1 = vpx1 + 5.0*d
|
11
|
+
vpx2 = vpx2 - 2.0*d
|
12
|
+
vpy1 = vpy1 + 8.0*d
|
13
|
+
vpy2 = vpy2 - 2.0*d
|
14
|
+
pgvsiz(vpx1, vpx2, vpy1, vpy2)
|
15
|
+
end
|
16
|
+
|
17
|
+
def palett contra,bright
|
18
|
+
rl =[-0.5, 0.0, 0.17, 0.33, 0.50, 0.67, 0.83, 1.0, 1.7]
|
19
|
+
rr =[ 0.0, 0.0, 0.0, 0.0, 0.6, 1.0, 1.0, 1.0, 1.0]
|
20
|
+
rg =[ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.0, 1.0]
|
21
|
+
rb =[ 0.0, 0.3, 0.8, 1.0, 0.3, 0.0, 0.0, 0.0, 1.0]
|
22
|
+
pgctab(rl, rr, rg, rb)
|
23
|
+
end
|
24
|
+
|
25
|
+
exit if pgopen('?') < 1
|
26
|
+
printf "PGPLOT device type: %s\n", pgqinf('TYPE')
|
27
|
+
c1,c2 = pgqcir()
|
28
|
+
printf "Number of color indices used for image: %d\n", nc=[0,c2-c1+1].max
|
29
|
+
exit if nc<8
|
30
|
+
|
31
|
+
nx = 64
|
32
|
+
ny = 64
|
33
|
+
x = NArray.sfloat(nx,1).indgen!(1)
|
34
|
+
y = NArray.sfloat(1,ny).indgen!(1)
|
35
|
+
f = cos( sqrt(x*(80.0/nx))*0.6 - y*16.0/(3.0*ny) ) *
|
36
|
+
cos( x*16.0/(3.0*nx) ) +
|
37
|
+
(x/nx - y/ny) + sin(sqrt(x**2+y**2))*0.05
|
38
|
+
|
39
|
+
pgpage
|
40
|
+
setvp
|
41
|
+
pgwnad(0.0, 1.0+nx, 0.0, 1.0+ny)
|
42
|
+
bright = 0.5
|
43
|
+
contra = 1.0
|
44
|
+
palett(contra, bright)
|
45
|
+
pgimag(f)
|
46
|
+
pgmtxt('t',1.0,0.0,0.0,'PGIMAG, PGWEDG, and PGCTAB')
|
47
|
+
pgsch(0.6)
|
48
|
+
pgbox('bcntsi',0.0,0,'bcntsiv',0.0,0)
|
49
|
+
pgmtxt('b',3.0,1.0,1.0,'pixel number')
|
50
|
+
pgwedg('BI', 4.0, 5.0, f.min,f.max, 'pixel value')
|
51
|
+
pgsch(1.0)
|
52
|
+
|
53
|
+
angle = 120.0/57.29578
|
54
|
+
c = cos(angle)
|
55
|
+
s = sin(angle)
|
56
|
+
tr = NArray[ -c-s, 2.0*c/nx, 2.0*s/ny,
|
57
|
+
-c+s, -2.0*s/nx, 2.0*c/ny ]
|
58
|
+
|
59
|
+
pgpage
|
60
|
+
setvp
|
61
|
+
pgwnad(-1.0, 1.0, -1.0, 1.0)
|
62
|
+
pgsci(1)
|
63
|
+
bright = 0.5
|
64
|
+
contra = 1.0
|
65
|
+
palett(contra, bright)
|
66
|
+
pgimag(f,nil,tr)
|
67
|
+
pgsci(1)
|
68
|
+
|
69
|
+
pgcont(f,NArray.sfloat(21).indgen!*(f.max-f.min)/21+f.min, tr)
|
70
|
+
pgsls(1)
|
71
|
+
pgslw(1)
|
72
|
+
pgsci(1)
|
73
|
+
#outlin(1,mxi,1,mxj,tr)
|
74
|
+
pgmtxt('t',1.0,0.0,0.0,'PGIMAG, PGCONT and PGWEDG')
|
75
|
+
pgsch(0.6)
|
76
|
+
pgbox('bctsn',0.0,0,'bctsn',0.0,0)
|
77
|
+
pgwedg('BI', 4.0, 5.0, f.min, f.max, 'pixel value')
|
78
|
+
pgsch(1.0)
|
79
|
+
|
80
|
+
pgclos
|
data/demo/pgdemo9.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'narray'
|
2
|
+
require 'pgplot'
|
3
|
+
include Pgplot
|
4
|
+
include NMath
|
5
|
+
|
6
|
+
n=64
|
7
|
+
ncol=32
|
8
|
+
nlev=9
|
9
|
+
|
10
|
+
pgbeg
|
11
|
+
|
12
|
+
i = NArray.sfloat(n,1).indgen!(1)
|
13
|
+
j = NArray.sfloat(1,n).indgen!(1)
|
14
|
+
f = cos(0.6*sqrt(i*2)-(0.4/3)*j) * cos((0.4/3)*i) + (i-j)/n
|
15
|
+
fmin = f.min
|
16
|
+
fmax = f.max
|
17
|
+
|
18
|
+
ia = (f-fmin)/(fmax-fmin)*(ncol-1)+16
|
19
|
+
|
20
|
+
ci1,ci2 = pgqcol
|
21
|
+
if ci2 < 15+ncol
|
22
|
+
raise 'This program requires a device with at least %d colors'%(15+ncol)
|
23
|
+
end
|
24
|
+
|
25
|
+
pgpage
|
26
|
+
pgscr(0, 0.0, 0.3, 0.2)
|
27
|
+
pgsvp(0.05,0.95,0.05,0.95)
|
28
|
+
pgwnad(0.0, 1.0, 0.0, 1.0)
|
29
|
+
|
30
|
+
for i in 1..ncol
|
31
|
+
r = 0.8*(i-1)/(ncol-1) + 0.2
|
32
|
+
g = 2.0*(i-1-ncol/2)/(ncol-1)
|
33
|
+
g = 0 if g<0
|
34
|
+
b = 0.2 + 0.4*(ncol-i)/ncol
|
35
|
+
pgscr(i+15, r, g, b)
|
36
|
+
end
|
37
|
+
|
38
|
+
pgpixl(ia,0,1,0,1)
|
39
|
+
pgsci(1)
|
40
|
+
pgmtxt('t',1.0,0.0,0.0,'Test of PGPIXL')
|
41
|
+
pgbox('bcnts',0.0,0,'bcnts',0.0,0)
|
42
|
+
|
43
|
+
clev = NArray.sfloat(nlev).indgen!(1) * ((fmax-fmin)/nlev) + fmin
|
44
|
+
pgcont(f, clev, NArray[-1.0, 1, 0, -1, 0, 1]/(n-1))
|
data/depend
ADDED
data/extconf.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# extconf.rb : Configure script for Ruby/PGPLOT
|
2
|
+
#
|
3
|
+
# Copyright (c) 2000,2001 Masahiro TANAKA <masa@ir.isas.ac.jp>
|
4
|
+
#
|
5
|
+
# This program is free software.
|
6
|
+
# You can distribute/modify this program
|
7
|
+
# under the same terms as Ruby itself.
|
8
|
+
# NO WARRANTY.
|
9
|
+
#
|
10
|
+
# usage: ruby extconf.rb [configure options]
|
11
|
+
|
12
|
+
require "mkmf"
|
13
|
+
|
14
|
+
#$DEBUG = true
|
15
|
+
|
16
|
+
# configure options:
|
17
|
+
# --with-x11-dir=path
|
18
|
+
# --with-x11-include=path
|
19
|
+
# --with-x11-lib=path
|
20
|
+
dir_config("x11")
|
21
|
+
|
22
|
+
# configure options:
|
23
|
+
# --with-pgplot-dir=path
|
24
|
+
# --with-pgplot-include=path
|
25
|
+
# --with-pgplot-lib=path
|
26
|
+
dir_config("pgplot")
|
27
|
+
|
28
|
+
# Otherwise you can also specify:
|
29
|
+
# --with-opt-dir=path
|
30
|
+
# --with-opt-include=path
|
31
|
+
# --with-opt-lib=path
|
32
|
+
|
33
|
+
# Check PGPLOT Header
|
34
|
+
exit unless have_header("cpgplot.h")
|
35
|
+
|
36
|
+
# Check NArray
|
37
|
+
$CPPFLAGS = " -I#{CONFIG['sitearchdir']} " + $CPPFLAGS
|
38
|
+
gem_narray_dir = File.dirname(Dir.glob("../narray-0.[56].*/narray.h").last)
|
39
|
+
$CPPFLAGS = " -I#{gem_narray_dir} " + $CPPFLAGS if gem_narray_dir
|
40
|
+
exit unless have_header("narray.h")
|
41
|
+
if RUBY_PLATFORM =~ /cygwin|mingw/
|
42
|
+
$LDFLAGS = " -L#{CONFIG['sitearchdir']} "+$LDFLAGS
|
43
|
+
exit unless have_library("narray","na_make_object")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check FORTRAN Libraries
|
47
|
+
#
|
48
|
+
# SUN WorkShop FORTRAN 77 compiler ver5.0
|
49
|
+
# configure options: --with-sunws
|
50
|
+
if with_config("sunws")
|
51
|
+
$libs = "-lM77 -lsunmath "+$libs
|
52
|
+
exit unless find_library("F77", "f77_init", "/opt/SUNWspro/lib")
|
53
|
+
$defs.push "-DSPARC_FORTRAN"
|
54
|
+
#
|
55
|
+
# GNU FORTRAN v4
|
56
|
+
elsif have_library("gfortran")
|
57
|
+
$CFLAGS = "-Wall "+$CFLAGS
|
58
|
+
$defs.push "-DGNU_FORTRAN"
|
59
|
+
#
|
60
|
+
# GNU FORTRAN v3
|
61
|
+
elsif have_library("g77")
|
62
|
+
$CFLAGS = "-Wall "+$CFLAGS
|
63
|
+
$defs.push "-DGNU_FORTRAN"
|
64
|
+
else
|
65
|
+
puts "failed"
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check GrWin Library (for cygwin (and mingw32?))
|
70
|
+
# configure options: --with-grwin
|
71
|
+
if with_config("grwin")
|
72
|
+
#$LDFLAGS = "-Wl,--subsystem,console "+$LDFLAGS
|
73
|
+
if RUBY_PLATFORM =~ /cygwin|mingw/
|
74
|
+
$libs += " -mwindows"
|
75
|
+
end
|
76
|
+
exit unless have_library("GrWin", "GWinit")
|
77
|
+
end
|
78
|
+
#
|
79
|
+
# Check X11 Library
|
80
|
+
have_library("X11", "XOpenDisplay")
|
81
|
+
|
82
|
+
# Check PNG Library
|
83
|
+
libs_save = $libs
|
84
|
+
$libs = append_library($libs, "z")
|
85
|
+
if !have_library("png","png_create_write_struct")
|
86
|
+
$libs = libs_save
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check PGPLOT Library
|
90
|
+
$libs = append_library($libs, "pgplot")
|
91
|
+
exit unless find_library( "cpgplot", "cpgbeg", "/usr/lib",
|
92
|
+
"/usr/local/lib", "/usr/local/pgplot" )
|
93
|
+
|
94
|
+
$objs = %w(rb_pgplot.o kwarg.o)
|
95
|
+
|
96
|
+
# Generate Makefile
|
97
|
+
create_makefile("pgplot")
|