Commits
Takeshi Enomoto authored a7e60d1b2e2
1 + | --- examples/d/Makefile.examples.in.orig 2019-06-02 08:24:33.000000000 +0900 |
2 + | +++ examples/d/Makefile.examples.in 2019-08-12 14:25:35.000000000 +0900 |
3 + | |
4 + | EXEEXT = @EXEEXT@ |
5 + | |
6 + | PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ |
7 + | -install_tree_d_RPATHCMD = @install_tree_d_RPATHCMD@ |
8 + | +install_tree_d_RPATHCMD = |
9 + | |
10 + | EXECUTABLES_list = \ |
11 + | x00d$(EXEEXT) \ |
12 + | |
13 + | x13d$(EXEEXT) \ |
14 + | x14d$(EXEEXT) \ |
15 + | x15d$(EXEEXT) \ |
16 + | - x16d$(EXEEXT) \ |
17 + | x17d$(EXEEXT) \ |
18 + | x18d$(EXEEXT) \ |
19 + | x19d$(EXEEXT) \ |
20 + | |
21 + | rm -f $(EXECUTABLES_list) *.o |
22 + | |
23 + | .d.o: |
24 + | - $(DC) $< -c -o $@ $(shell $(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags plplot-d) |
25 + | + $(DC) $< -c -of=$@ $(shell $(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags plplot-d) |
26 + | |
27 + | # target_link_libraries(x${STRING_INDEX}d plplotdmd plplot ${MATH_LIB}) |
28 + | .o$(EXEEXT): |
29 + | - $(DC) $< -o $@ $(install_tree_d_RPATHCMD) $(shell $(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --libs plplot-d plplot) @MATH_LIB@ |
30 + | + $(DC) $< -of=$@ $(install_tree_d_RPATHCMD) $(shell $(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --libs plplot-d) @MATH_LIB@ |
31 + | |
32 + | .SUFFIXES: .d .o $(EXEEXT) |
33 + | --- examples/d/x01d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
34 + | +++ examples/d/x01d.d 2019-08-12 14:21:52.000000000 +0900 |
35 + | |
36 + | // xor mode enable erasing a line/point/text by replotting it again |
37 + | // it does not work in double buffering mode, however |
38 + | |
39 + | +/* |
40 + | if ( do_test && test_xor ) |
41 + | { |
42 + | writefln( "The -xor command line option can only be exercised if your " |
43 + | "system\nhas usleep(), which does not seem to happen." ); |
44 + | } |
45 + | +*/ |
46 + | } |
47 + | |
48 + | public void plot2() |
49 + | |
50 + | plcol0( 4 ); |
51 + | plline( x, y ); |
52 + | } |
53 + | -} |
54 + | \ No newline at end of file |
55 + | +} |
56 + | --- examples/d/x08d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
57 + | +++ examples/d/x08d.d 2019-08-12 14:21:52.000000000 +0900 |
58 + | |
59 + | import plplot; |
60 + | import std.string; |
61 + | import std.math; |
62 + | -import std.c.stdlib; |
63 + | +import core.stdc.stdlib; |
64 + | |
65 + | //-------------------------------------------------------------------------- |
66 + | // cmap1_init1 |
67 + | |
68 + | PLFLT[] alt = [ 60.0, 40.0 ]; |
69 + | PLFLT[] az = [ 30.0, -30.0 ]; |
70 + | |
71 + | - string title[] = [ "#frPLplot Example 8 - Alt=60, Az=30", |
72 + | + string[] title = [ "#frPLplot Example 8 - Alt=60, Az=30", |
73 + | "#frPLplot Example 8 - Alt=40, Az=-30" ]; |
74 + | |
75 + | // Parse and process command line arguments |
76 + | --- examples/d/x11d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
77 + | +++ examples/d/x11d.d 2019-08-12 14:21:52.000000000 +0900 |
78 + | |
79 + | PLFLT[] alt = [ 33.0, 17.0 ]; |
80 + | PLFLT[] az = [ 24.0, 115.0 ]; |
81 + | |
82 + | - string title[] = [ "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", |
83 + | + string[] title = [ "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", |
84 + | "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" ]; |
85 + | |
86 + | PLFLT xx, yy; |
87 + | --- examples/d/x15d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
88 + | +++ examples/d/x15d.d 2019-08-12 14:21:52.000000000 +0900 |
89 + | |
90 + | //-------------------------------------------------------------------------- |
91 + | public void plot2( PLFLT[][] z ) |
92 + | { |
93 + | - static PLINT nlin[10] = [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]; |
94 + | - static PLINT inc[10][2] = [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], |
95 + | + static PLINT[10] nlin = [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]; |
96 + | + static PLINT[2][10] inc = [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], |
97 + | [450, -450], [0, 900], [0, 450], [450, -450], [0, 900] ]; |
98 + | - static PLINT del[10][2] = [ [2000, 2000], [2000, 2000], [2000, 2000], |
99 + | + static PLINT[2][10] del = [ [2000, 2000], [2000, 2000], [2000, 2000], |
100 + | [2000, 2000], [2000, 2000], [2000, 2000], |
101 + | [2000, 2000], [2000, 2000], [4000, 4000], |
102 + | [4000, 2000] ]; |
103 + | |
104 + | //-------------------------------------------------------------------------- |
105 + | public void plot3() |
106 + | { |
107 + | - static PLFLT xx[2][5] = [ [-1.0, 1.0, 1.0, -1.0, -1.0], |
108 + | + static PLFLT[5][2] xx = [ [-1.0, 1.0, 1.0, -1.0, -1.0], |
109 + | [-1.0, 1.0, 1.0, -1.0, -1.0] ]; |
110 + | - static PLFLT yy[2][5] = [ [1.0, 1.0, 0.0, 0.0, 1.0], |
111 + | + static PLFLT[5][2] yy = [ [1.0, 1.0, 0.0, 0.0, 1.0], |
112 + | [-1.0, -1.0, 0.0, 0.0, -1.0] ]; |
113 + | - static PLFLT zz[2][5] = [ [0.0, 0.0, 1.0, 1.0, 0.0], |
114 + | + static PLFLT[5][2] zz = [ [0.0, 0.0, 1.0, 1.0, 0.0], |
115 + | [0.0, 0.0, 1.0, 1.0, 0.0] ]; |
116 + | |
117 + | pladv( 0 ); |
118 + | --- examples/d/x17d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
119 + | +++ examples/d/x17d.d 2019-08-12 14:21:52.000000000 +0900 |
120 + | |
121 + | import std.string; |
122 + | import std.math; |
123 + | import std.stdio; |
124 + | -import std.c.stdlib; |
125 + | +import core.stdc.stdlib; |
126 + | import plplot; |
127 + | |
128 + | |
129 + | --- examples/d/x18d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
130 + | +++ examples/d/x18d.d 2019-08-12 14:21:52.000000000 +0900 |
131 + | |
132 + | |
133 + | import plplot; |
134 + | |
135 + | -int opt[] = [ 1, 0, 1, 0 ]; |
136 + | -PLFLT alt[] = [ 20.0, 35.0, 50.0, 65.0 ]; |
137 + | -PLFLT az[] = [ 30.0, 40.0, 50.0, 60.0 ]; |
138 + | +int[] opt = [ 1, 0, 1, 0 ]; |
139 + | +PLFLT[] alt = [ 20.0, 35.0, 50.0, 65.0 ]; |
140 + | +PLFLT[] az = [ 30.0, 40.0, 50.0, 60.0 ]; |
141 + | |
142 + | //-------------------------------------------------------------------------- |
143 + | // main |
144 + | |
145 + | |
146 + | void test_poly( int k ) |
147 + | { |
148 + | - PLINT draw[][] = [ [ 1, 1, 1, 1 ], |
149 + | + PLINT[][] draw = [ [ 1, 1, 1, 1 ], |
150 + | [ 1, 0, 1, 0 ], |
151 + | [ 0, 1, 0, 1 ], |
152 + | [ 1, 1, 0, 0 ] ]; |
153 + | --- examples/d/x19d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
154 + | +++ examples/d/x19d.d 2019-08-12 14:21:52.000000000 +0900 |
155 + | |
156 + | |
157 + | import std.math; |
158 + | import std.string; |
159 + | -import std.c.string; |
160 + | +import core.stdc.string; |
161 + | |
162 + | import plplot; |
163 + | |
164 + | |
165 + | |
166 + | //variables for the shapelib example |
167 + | const PLINT nbeachareas = 2; |
168 + | - const PLINT beachareas[] = [ 23, 24 ]; |
169 + | + const PLINT[] beachareas = [ 23, 24 ]; |
170 + | const nwoodlandareas = 94; |
171 + | - PLINT woodlandareas[94]; |
172 + | + PLINT[94] woodlandareas; |
173 + | const PLINT nshingleareas = 22; |
174 + | - const PLINT shingleareas[] = [ 0, 1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 217, 2424, 2425, 2426, 2427, 2428, 2491, 2577 ]; |
175 + | + const PLINT[] shingleareas = [ 0, 1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 217, 2424, 2425, 2426, 2427, 2428, 2491, 2577 ]; |
176 + | const PLINT ncragareas = 2024; |
177 + | - PLINT cragareas[2024]; |
178 + | - const PLINT majorroads[] = [ 33, 48, 71, 83, 89, 90, 101, 102, 111 ]; |
179 + | + PLINT[2024] cragareas; |
180 + | + const PLINT[] majorroads = [ 33, 48, 71, 83, 89, 90, 101, 102, 111 ]; |
181 + | |
182 + | plinit(); |
183 + | |
184 + | |
185 + | // Show Baltimore, MD on the map |
186 + | plcol0( 2 ); |
187 + | plssym( 0.0, 2.0 ); |
188 + | - PLFLT x[1] = -76.6125; |
189 + | - PLFLT y[1] = 39.2902778; |
190 + | + PLFLT[1] x = -76.6125; |
191 + | + PLFLT[1] y = 39.2902778; |
192 + | plpoin( x, y, 18 ); |
193 + | plssym( 0.0, 1.0 ); |
194 + | plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); |
195 + | --- examples/d/x23d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
196 + | +++ examples/d/x23d.d 2019-08-12 14:21:52.000000000 +0900 |
197 + | |
198 + | if ( page == 11 ) |
199 + | { |
200 + | plsfci( fci[i] ); |
201 + | - text = format( "Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog", |
202 + | + text = format( "Page 12, %s, %s, %s: " ~ "The quick brown fox jumps over the lazy dog", |
203 + | family[family_index], style[style_index], weight[weight_index] ); |
204 + | } |
205 + | else if ( page == 12 ) |
206 + | { |
207 + | plsfont( family_index, style_index, weight_index ); |
208 + | - text = format( "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog", |
209 + | + text = format( "Page 13, %s, %s, %s: " ~ "The quick brown fox jumps over the lazy dog", |
210 + | family[family_index], style[style_index], weight[weight_index] ); |
211 + | } |
212 + | else if ( page == 13 ) |
213 + | { |
214 + | - text = format( "Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog", |
215 + | + text = format( "Page 14, %s, %s, %s: #<0x%x>" ~ "The quick brown fox jumps over the lazy dog", |
216 + | family[family_index], style[style_index], weight[weight_index], fci[i] ); |
217 + | } |
218 + | else if ( page == 14 ) |
219 + | { |
220 + | - text = format( "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>" |
221 + | + text = format( "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>" ~ |
222 + | "The quick brown fox jumps over the lazy dog", |
223 + | family[family_index], style[style_index], weight[weight_index], |
224 + | family_index, style_index, weight_index ); |
225 + | } |
226 + | else if ( page == 15 ) |
227 + | { |
228 + | - text = format( "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>" |
229 + | + text = format( "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>" ~ |
230 + | "The quick brown fox jumps over the lazy dog", |
231 + | family[family_index], style[style_index], weight[weight_index], |
232 + | family[family_index], style[style_index], weight[weight_index] ); |
233 + | --- examples/d/x33d.d.orig 2019-06-02 08:24:33.000000000 +0900 |
234 + | +++ examples/d/x33d.d 2019-08-12 15:13:03.000000000 +0900 |
235 + | |
236 + | import std.math; |
237 + | import std.string; |
238 + | |
239 + | -static PLINT position_options[16] = [ |
240 + | +static PLINT[16] position_options = [ |
241 + | PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, |
242 + | PL_POSITION_TOP | PL_POSITION_OUTSIDE, |
243 + | PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, |
244 + | |
245 + | ]; |
246 + | |
247 + | // Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). |
248 + | -static string special_symbols[5] = [ |
249 + | +static string[5] special_symbols = [ |
250 + | "✰", |
251 + | "✴", |
252 + | "✱", |
253 + | |
254 + | |
255 + | // Colorbar type options |
256 + | const int COLORBAR_KINDS = 4; |
257 + | -static PLINT colorbar_option_kinds[COLORBAR_KINDS] = [ |
258 + | +static PLINT[COLORBAR_KINDS] colorbar_option_kinds = [ |
259 + | PL_COLORBAR_SHADE, |
260 + | PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, |
261 + | PL_COLORBAR_IMAGE, |
262 + | PL_COLORBAR_GRADIENT |
263 + | ]; |
264 + | -static string colorbar_option_kind_labels[COLORBAR_KINDS] = [ |
265 + | +static string[COLORBAR_KINDS] colorbar_option_kind_labels = [ |
266 + | "Shade colorbars", |
267 + | "Shade colorbars with custom labels", |
268 + | "Image colorbars", |
269 + | |
270 + | |
271 + | // Which side of the page are we positioned relative to? |
272 + | const int COLORBAR_POSITIONS = 4; |
273 + | -static PLINT colorbar_position_options[COLORBAR_POSITIONS] = [ |
274 + | +static PLINT[COLORBAR_POSITIONS] colorbar_position_options = [ |
275 + | PL_POSITION_LEFT, |
276 + | PL_POSITION_RIGHT, |
277 + | PL_POSITION_TOP, |
278 + | PL_POSITION_BOTTOM |
279 + | ]; |
280 + | -static string colorbar_position_option_labels[COLORBAR_POSITIONS] = [ |
281 + | +static string[COLORBAR_POSITIONS] colorbar_position_option_labels = [ |
282 + | "Left", |
283 + | "Right", |
284 + | "Top", |
285 + | |
286 + | |
287 + | // Colorbar label positioning options |
288 + | const int COLORBAR_LABELS = 4; |
289 + | -static PLINT colorbar_label_options[COLORBAR_LABELS] = [ |
290 + | +static PLINT[COLORBAR_LABELS] colorbar_label_options = [ |
291 + | PL_COLORBAR_LABEL_LEFT, |
292 + | PL_COLORBAR_LABEL_RIGHT, |
293 + | PL_COLORBAR_LABEL_TOP, |
294 + | PL_COLORBAR_LABEL_BOTTOM |
295 + | ]; |
296 + | -static string colorbar_label_option_labels[COLORBAR_LABELS] = [ |
297 + | +static string[COLORBAR_LABELS] colorbar_label_option_labels = [ |
298 + | "Label left", |
299 + | "Label right", |
300 + | "Label top", |
301 + | |
302 + | |
303 + | // Colorbar cap options |
304 + | const int COLORBAR_CAPS = 4; |
305 + | -static PLINT colorbar_cap_options[COLORBAR_CAPS] = [ |
306 + | +static PLINT[COLORBAR_CAPS] colorbar_cap_options = [ |
307 + | PL_COLORBAR_CAP_NONE, |
308 + | PL_COLORBAR_CAP_LOW, |
309 + | PL_COLORBAR_CAP_HIGH, |
310 + | PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH |
311 + | ]; |
312 + | -static string colorbar_cap_option_labels[COLORBAR_CAPS] = [ |
313 + | +static string[COLORBAR_CAPS] colorbar_cap_option_labels = [ |
314 + | "No caps", |
315 + | "Low cap", |
316 + | "High cap", |
317 + | |
318 + | // Parameters for the colorbars on this page |
319 + | PLINT position_i, position, opt; |
320 + | PLFLT x, y, x_length, y_length; |
321 + | - PLFLT ticks[1] = [ 0.0 ]; |
322 + | - PLINT sub_ticks[1] = [ 0 ]; |
323 + | + PLFLT[1] ticks = [ 0.0 ]; |
324 + | + PLINT[1] sub_ticks = [ 0 ]; |
325 + | PLFLT low_cap_color, high_cap_color; |
326 + | PLINT vertical, ifn; |
327 + | PLINT n_axes = 1; |
328 + | string[] axis_opts; |
329 + | PLINT n_labels = 1; |
330 + | - PLINT label_opts[1] = [ 0 ]; |
331 + | + PLINT[1] label_opts = [ 0 ]; |
332 + | string[] label; |
333 + | string title; |
334 + | PLFLT colorbar_width, colorbar_height; |
335 + | - PLINT n_values_array[1]; |
336 + | + PLINT[1] n_values_array; |
337 + | PLFLT[][] values_array; |
338 + | |
339 + | axis_opts.length = 1; |
340 + | |
341 + | int i, k; |
342 + | PLINT opt; |
343 + | PLINT nlegend, nturn; |
344 + | - PLINT opt_array[MAX_NLEGEND]; |
345 + | - PLINT text_colors[MAX_NLEGEND]; |
346 + | - PLINT box_colors[MAX_NLEGEND]; |
347 + | - PLINT box_patterns[MAX_NLEGEND]; |
348 + | - PLFLT box_scales[MAX_NLEGEND]; |
349 + | - PLFLT box_line_widths[MAX_NLEGEND]; |
350 + | - PLINT line_colors[MAX_NLEGEND]; |
351 + | - PLINT line_styles[MAX_NLEGEND]; |
352 + | - PLFLT line_widths[MAX_NLEGEND]; |
353 + | - PLINT symbol_numbers[MAX_NLEGEND]; |
354 + | - PLINT symbol_colors[MAX_NLEGEND]; |
355 + | - PLFLT symbol_scales[MAX_NLEGEND]; |
356 + | - string text[MAX_NLEGEND]; |
357 + | - string symbols[MAX_NLEGEND]; |
358 + | + PLINT[MAX_NLEGEND] opt_array; |
359 + | + PLINT[MAX_NLEGEND] text_colors; |
360 + | + PLINT[MAX_NLEGEND] box_colors; |
361 + | + PLINT[MAX_NLEGEND] box_patterns; |
362 + | + PLFLT[MAX_NLEGEND] box_scales; |
363 + | + PLFLT[MAX_NLEGEND] box_line_widths; |
364 + | + PLINT[MAX_NLEGEND] line_colors; |
365 + | + PLINT[MAX_NLEGEND] line_styles; |
366 + | + PLFLT[MAX_NLEGEND] line_widths; |
367 + | + PLINT[MAX_NLEGEND] symbol_numbers; |
368 + | + PLINT[MAX_NLEGEND] symbol_colors; |
369 + | + PLFLT[MAX_NLEGEND] symbol_scales; |
370 + | + string[MAX_NLEGEND] text; |
371 + | + string[MAX_NLEGEND] symbols; |
372 + | PLFLT legend_width, legend_height, x, y, xstart, ystart; |
373 + | PLFLT max_height, text_scale; |
374 + | PLINT position, opt_base, nrow, ncolumn; |
375 + | |
376 + | if ( colorbar ) |
377 + | { |
378 + | // Color bar examples |
379 + | - PLFLT values_small[2] = [ -1.0e-20, 1.0e-20 ]; |
380 + | - PLFLT values_uneven[9] = [ -1.0e-20, 2.0e-20, 2.6e-20, 3.4e-20, 6.0e-20, 7.0e-20, 8.0e-20, 9.0e-20, 10.0e-20 ]; |
381 + | - PLFLT values_even[9] = [ -2.0e-20, -1.0e-20, 0.0e-20, 1.0e-20, 2.0e-20, 3.0e-20, 4.0e-20, 5.0e-20, 6.0e-20 ]; |
382 + | + PLFLT[2] values_small = [ -1.0e-20, 1.0e-20 ]; |
383 + | + PLFLT[9] values_uneven = [ -1.0e-20, 2.0e-20, 2.6e-20, 3.4e-20, 6.0e-20, 7.0e-20, 8.0e-20, 9.0e-20, 10.0e-20 ]; |
384 + | + PLFLT[9] values_even = [ -2.0e-20, -1.0e-20, 0.0e-20, 1.0e-20, 2.0e-20, 3.0e-20, 4.0e-20, 5.0e-20, 6.0e-20 ]; |
385 + | |
386 + | // Use unsaturated green background colour to contrast with black caps. |
387 + | plscolbg( 70, 185, 70 ); |