aboutsummaryrefslogtreecommitdiff
path: root/plotlib
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-05-11 00:27:49 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-05-11 00:27:49 +0000
commit0d4f43d355de79178b1142e9735902cf641670b6 (patch)
tree2ced2323f6351db2a51090b3fd13eb11f69ff53f /plotlib
Xfoil 6.97
Diffstat (limited to 'plotlib')
-rw-r--r--plotlib/CHAR.INC224
-rw-r--r--plotlib/Doc1004
-rw-r--r--plotlib/GPL-library481
-rw-r--r--plotlib/MATH.INC224
-rw-r--r--plotlib/Makefile164
-rw-r--r--plotlib/Notes219
-rw-r--r--plotlib/Readme127
-rw-r--r--plotlib/Readme.colors55
-rw-r--r--plotlib/SLAN.INC224
-rw-r--r--plotlib/SYMB.INC41
-rw-r--r--plotlib/Xwin.c1082
-rw-r--r--plotlib/Xwin1.c1078
-rw-r--r--plotlib/colors.inc59
-rw-r--r--plotlib/colorstuff/rgb.c814
-rw-r--r--plotlib/colorstuff/rgbtbl.h765
-rw-r--r--plotlib/colorstuff/rgbtest.c56
-rw-r--r--plotlib/config.make130
-rw-r--r--plotlib/config.make.DP129
-rw-r--r--plotlib/config.make.QP129
-rw-r--r--plotlib/config.make.SP130
-rw-r--r--plotlib/config.make.g77129
-rw-r--r--plotlib/examples/Makefile151
-rw-r--r--plotlib/examples/Makefile.NT187
-rw-r--r--plotlib/examples/Readme-examples95
-rw-r--r--plotlib/examples/cmap2.f222
-rw-r--r--plotlib/examples/cmap3.f198
-rw-r--r--plotlib/examples/colors.inc58
-rw-r--r--plotlib/examples/contest.f212
-rw-r--r--plotlib/examples/defmap.f133
-rw-r--r--plotlib/examples/gridtest.f108
-rw-r--r--plotlib/examples/masks.inc35
-rw-r--r--plotlib/examples/spectrum.f143
-rw-r--r--plotlib/examples/squares.f120
-rw-r--r--plotlib/examples/squares2.f126
-rw-r--r--plotlib/examples/squaresdoublebuff.f140
-rw-r--r--plotlib/examples/symbols.f124
-rw-r--r--plotlib/examples/symbolsall.f148
-rw-r--r--plotlib/examples/volts.f117
-rw-r--r--plotlib/examples/volts_old.f112
-rw-r--r--plotlib/examples/zoomtest.f123
-rw-r--r--plotlib/gw_subs.f625
-rw-r--r--plotlib/lines11
-rw-r--r--plotlib/masks.inc41
-rw-r--r--plotlib/misc/Makefile.linux.shared222
-rw-r--r--plotlib/misc/README17
-rw-r--r--plotlib/misc/Readme.absoft65
-rw-r--r--plotlib/misc/makesplitlib50
-rw-r--r--plotlib/plt.ftnchek12
-rw-r--r--plotlib/plt_3D.f405
-rw-r--r--plotlib/plt_base.f1026
-rw-r--r--plotlib/plt_color.f623
-rw-r--r--plotlib/plt_font.f767
-rw-r--r--plotlib/plt_old.f1455
-rw-r--r--plotlib/plt_util.f930
-rw-r--r--plotlib/pltlib.inc244
-rw-r--r--plotlib/ps_subs.f625
-rw-r--r--plotlib/ps_subs_old.f620
-rw-r--r--plotlib/set_subs.f774
-rw-r--r--plotlib/sym/Makefile65
-rw-r--r--plotlib/sym/Readme67
-rw-r--r--plotlib/sym/char.fnt93
-rw-r--r--plotlib/sym/math.fnt93
-rw-r--r--plotlib/sym/slan.fnt93
-rw-r--r--plotlib/sym/symb.fnt15
-rw-r--r--plotlib/sym/symgen.f1179
-rw-r--r--plotlib/sym/test.f159
-rw-r--r--plotlib/util-ops.f17
-rw-r--r--plotlib/version.inc2
-rw-r--r--plotlib/win32/Makefile.NT169
-rw-r--r--plotlib/win32/Readme-win3216
-rw-r--r--plotlib/win32/W32win.c1709
-rw-r--r--plotlib/win32/Xdefs.h60
-rw-r--r--plotlib/win32/rgbtbl.h765
73 files changed, 22830 insertions, 0 deletions
diff --git a/plotlib/CHAR.INC b/plotlib/CHAR.INC
new file mode 100644
index 0000000..925c3ee
--- /dev/null
+++ b/plotlib/CHAR.INC
@@ -0,0 +1,224 @@
+C Version 4.46 11/28/01
+
+ CHARACTER* 92 CHARS
+ INTEGER NODE(20, 92)
+
+ DIMENSION NODE0(20,10)
+ DIMENSION NODE1(20,10)
+ DIMENSION NODE2(20,10)
+ DIMENSION NODE3(20,10)
+ DIMENSION NODE4(20,10)
+ DIMENSION NODE5(20,10)
+ DIMENSION NODE6(20,10)
+ DIMENSION NODE7(20,10)
+ DIMENSION NODE8(20,10)
+ DIMENSION NODE9(20, 2)
+ EQUIVALENCE ( NODE(1, 1) , NODE0(1,1) )
+ EQUIVALENCE ( NODE(1, 11) , NODE1(1,1) )
+ EQUIVALENCE ( NODE(1, 21) , NODE2(1,1) )
+ EQUIVALENCE ( NODE(1, 31) , NODE3(1,1) )
+ EQUIVALENCE ( NODE(1, 41) , NODE4(1,1) )
+ EQUIVALENCE ( NODE(1, 51) , NODE5(1,1) )
+ EQUIVALENCE ( NODE(1, 61) , NODE6(1,1) )
+ EQUIVALENCE ( NODE(1, 71) , NODE7(1,1) )
+ EQUIVALENCE ( NODE(1, 81) , NODE8(1,1) )
+ EQUIVALENCE ( NODE(1, 91) , NODE9(1,1) )
+ DATA NCHARS / 92 /
+ DATA CHARS( 1: 26) / 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /
+ DATA CHARS( 27: 52) / 'abcdefghijklmnopqrstuvwxyz' /
+ DATA CHARS( 53: 78) / '0123456789,.;:`"!?@#$%&|()' /
+ DATA CHARS( 79: 92) / '[]{}<>_+-*=/^~' /
+ DATA NODE0 /
+ & 21616,11672,12183,12888,14488,15183,15672,15616,21650,15650,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,11688,14288,15284,15676,15668,15260,14256,15252,15644,
+ & 15628,15220,14216,11616,21656,14256, 0, 0, 0, 0,
+ & 25674,15183,14488,12888,12183,11672,11632,12121,12816,14416,
+ & 15121,15629, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21416,14416,15121,15632,15672,15183,14488,11488,21816,11888,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25616,11616,11688,15688,21656,14756, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,11688,15688,21656,14656, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25674,15183,14488,12888,12183,11672,11632,12121,12816,14416,
+ & 15121,15632,15650,14050, 0, 0, 0, 0, 0, 0,
+ & 21616,11688,25616,15688,21656,15656, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23888,13816,22616,15016,22688,15088, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21430,11921,12616,13916,14621,15132,15188,25788,13688, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE1 /
+ & 21688,11616,25688,11645,22858,15616, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22088,12016,16016, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21416,11488,13648,15888,15816, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,11688,15616,15688, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21632,11672,12183,12888,14488,15183,15672,15632,15121,14416,
+ & 12816,12121,11632, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,11688,14288,15283,15676,15662,15255,14250,11650, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21632,11672,12183,12888,14488,15183,15672,15632,15121,14416,
+ & 12816,12121,11632,24131,15616, 0, 0, 0, 0, 0,
+ & 21616,11688,14288,15283,15676,15662,15255,14250,11650,24250,
+ & 15816, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25676,15183,14288,13088,12183,11674,11670,12161,13056,14256,
+ & 15151,15642,15630,15121,14216,13016,12121,11630, 0, 0,
+ & 23688,13616,21488,15888, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE2 /
+ & 21688,11632,12121,12816,14416,15121,15632,15688, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21688,11682,13616,15682,15688, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21488,11452,11639,12516,13437,13646,13837,14716,15639,15852,
+ & 15888,23646,13654, 0, 0, 0, 0, 0, 0, 0,
+ & 21688,11682,15622,15616,25688,15682,11622,11616, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21688,11682,13656,15682,15688,23656,13616, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21688,15688,11616,15616,22756,14556, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22064,14264,15159,15650,15616,25642,12842,12038,11630,11628,
+ & 12020,12816,14416,15220,15628, 0, 0, 0, 0, 0,
+ & 21888,11816,21852,12260,13064,14664,15460,15852,15828,15420,
+ & 14616,13016,12220,11828, 0, 0, 0, 0, 0, 0,
+ & 25652,15260,14464,12864,12060,11652,11628,12020,12816,14416,
+ & 15220,15628, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25488,15416,25452,15060,14264,12664,11860,11452,11428,11820,
+ & 12616,14216,15020,15428, 0, 0, 0, 0, 0, 0 /
+ DATA NODE3 /
+ & 25626,15220,14416,12816,12020,11628,11652,12060,12864,14464,
+ & 15260,15652,15641,11641, 0, 0, 0, 0, 0, 0,
+ & 26072,15680,14884,13684,12880,12472,12416,21656,14256, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,12008,12804,14404,15208,15616,15664,25652,15260,14464,
+ & 12864,12060,11652,11637,12029,12825,14425,15229,15637, 0,
+ & 21688,11616,21652,12060,12864,14464,15260,15652,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22416,15216,24016,14062,12962,23377,13380,13582,13882,14080,
+ & 14077,13875,13575,13377, 0, 0, 0, 0, 0, 0,
+ & 21416,11808,12604,13804,14608,15016,15062,13862,24375,14177,
+ & 14180,14382,14682,14880,14877,14675,14375, 0, 0, 0,
+ & 21888,11816,21844,15268,22750,15816, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22316,14916,23616,13688,12788, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21464,11416,21453,11760,12364,12764,13360,13653,13960,14564,
+ & 14964,15560,15853,15816,23653,13624, 0, 0, 0, 0,
+ & 21664,11616,21652,12060,12864,14464,15260,15652,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE4 /
+ & 21628,11652,12060,12864,14464,15260,15652,15628,15220,14416,
+ & 12816,12020,11628, 0, 0, 0, 0, 0, 0, 0,
+ & 21864,11800,21852,12260,13064,14664,15460,15852,15836,15428,
+ & 14624,13024,12228,11836, 0, 0, 0, 0, 0, 0,
+ & 25464,15400,25452,15060,14264,12664,11860,11452,11436,11828,
+ & 12624,14224,15028,15436, 0, 0, 0, 0, 0, 0,
+ & 22064,12016,22052,12460,13264,14664,15460,15852, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25656,15361,14664,12664,11961,11654,11651,11945,12641,14641,
+ & 15337,15631,15626,15319,14616,12616,11919,11624, 0, 0,
+ & 22484,12428,12820,13616,14816,15620,16028,21666,14266, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21664,11628,12020,12816,14416,15220,15628,25664,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21664,11657,11849,13616,15449,15657,15664, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21464,11440,11630,12516,13429,13636,13829,14716,15630,15840,
+ & 15864,23636,13642, 0, 0, 0, 0, 0, 0, 0,
+ & 21864,15616,25464,11616, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE5 /
+ & 21664,11637,12029,12825,14425,15229,15637,25664,15616,15208,
+ & 14404,12804,12008,11616, 0, 0, 0, 0, 0, 0,
+ & 21864,15464,11616,15616,22742,14442, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21628,11676,12084,12888,14488,15284,15676,15628,15220,14416,
+ & 12816,12020,11628, 0, 0, 0, 0, 0, 0, 0,
+ & 22678,13688,13616,22616,14616, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21676,12084,12888,14488,15284,15676,15666,15258,12036,11628,
+ & 11616,15616, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21878,12284,13088,14488,15284,15676,15669,15261,14457,15253,
+ & 15644,15628,15220,14416,12816,12020,11626,24457,12857, 0,
+ & 25088,15016,24016,16016,26040,11640,11688, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25488,11688,11657,14457,15253,15645,15628,15220,14416,12816,
+ & 12020,11628, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25678,15284,14488,12888,12084,11676,11628,12020,12816,14416,
+ & 15220,15628,15645,15253,14457,12857,12053,11645, 0, 0,
+ & 21688,15688,15679,13228,13216, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE6 /
+ & 24757,12557,11667,11676,12084,12888,14488,15284,15676,15667,
+ & 14757,15647,15628,15220,14416,12816,12020,11628,11647,12557,
+ & 21626,12020,12816,14416,15220,15628,15676,15284,14488,12888,
+ & 12084,11676,11659,12051,12847,14447,15251,15659, 0, 0,
+ & 22604,13416,13424,12624,12616,13215,12604, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22624,13424,13416,12616,12624, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22604,13215,12616,12624,13424,13416,12604,22656,12648,13448,
+ & 13456,12656, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22624,12616,13416,13424,12624,22656,12648,13448,13456,12656,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25284,16268,15884,15284, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22184,12666,12784,12184,23784,14266,14384,13784, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23524,13316,13916,13724,13524,23639,14088,13288,13639,23685,
+ & 13646, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22074,12283,13088,14288,15083,15274,14866,14160,13754,13647,
+ & 13639,23524,13316,13916,13724,13524, 0, 0, 0, 0 /
+ DATA NODE7 /
+ & 24543,13738,12843,12854,13761,14758,14543,14939,15439,15949,
+ & 15865,15075,13877,12674,11863,11647,11931,13222,14422,15627,
+ & 23278,12622,24778,14122,21959,15759,21640,15440, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25176,12976,12273,11967,11959,12254,12852,14452,15050,15445,
+ & 15437,15031,14328,12128,23616,13688, 0, 0, 0, 0,
+ & 21616,15688,22488,12084,12079,12475,12975,13379,13384,12988,
+ & 12488,25116,15520,15525,15129,14629,14225,14220,14616,15116,
+ & 25636,15023,14418,13716,12816,12021,11629,11637,12246,13956,
+ & 14564,14572,14377,13880,13280,12677,12469,12758,15616, 0,
+ & 23696,13608, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25092,14382,13965,13850,13935,14318,15008,24417,14230,14150,
+ & 14270,14483, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22292,12982,13365,13450,13335,12918,12208,22883,13070,13150,
+ & 13030,12817, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25294,13894,13806,15206,24094,14006, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22094,13494,13406,12006,23294,13206, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE8 /
+ & 24896,13890,13853,12850,13846,13810,14804,24009,14045,13846,
+ & 24091,14054,13853, 0, 0, 0, 0, 0, 0, 0,
+ & 22496,13490,13453,14450,13446,13410,12304,23209,13245,13446,
+ & 23291,13254,13453, 0, 0, 0, 0, 0, 0, 0,
+ & 25666,11648,15630, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21666,15648,11630, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 20800,17200, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21648,15648,23668,13628, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21648,15648, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22765,14531,22731,14565,21748,15548, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21656,15656,21640,15640, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21208,16096, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE9 /
+ & 21854,13868,15854, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21546,11951,12754,13452,14344,14942,15745,16150, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
diff --git a/plotlib/Doc b/plotlib/Doc
new file mode 100644
index 0000000..26bed6a
--- /dev/null
+++ b/plotlib/Doc
@@ -0,0 +1,1004 @@
+/***********************************************************************
+ Module: Doc
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+
+Xplot11 Graphics Package "Documentation"
+
+C Version 4.46 11/28/01
+
+(submitted in partial fullfillment of the
+ necessity of documenting this package)
+
+
+History
+-------
+This plot package is an "extension" of the ancient Versatec graphics
+routines which are in turn descended from the even more ancient
+Plot10 package that ran Tektronics vector graphics tubes. This
+particular package started off life as a severely hacked version of
+the Versatec software that supported a wide range of graphics
+equipment at MIT's Gas Turbine Lab. At this point the package has
+been hacked and extended to the point where no trace of the original
+source code remains (that is definitely for the best...). Note that
+this package is not PLOT10 compatible, it is closer to a Versatec
+graphics library.
+
+The basic philosophy of page-by-page plotting for both the screen
+window and hardcopy output has been retained. At the device level,
+the major changes have been the use of X-Windows for screen display output,
+and PostScript for hardcopy output, neither of which existed when
+the original Versatec software was developed. Also, both B&W and Color
+output is supported. On the retro-technology side, vector fonts are still
+used to completely sidestep the headaches associated with using bitmaps for
+both X-graphics and PostScript.
+
+
+Intent
+------
+Xplot11 is a collection of routines intended for use in custom applications
+which require more flexibility and power than simple X-versus-Y line plot
+packages, but don't require the complexity of full event-driven screen
+graphics interaction. It has the following key features:
+
++ Direct move-to, draw-to
++ Polyline plot, polygon fill
++ Terminal-type WYSIWYG vector font
++ LaTex-like Greek and math symbol vector font
++ Automatic offset/scaling
++ Automatic zooming
++ Automatic clipping against arbitrary "box"
++ Automatic plot primitive storage in display list for X-window replot
+ and/or PostScript hardcopy.
++ Color X-graphics and color PostScript support (or black & white)
++ Cursor location query via mouse click
+
+Recently added do-dahs include
++ Double buffering
++ limited 3D support
+
+The last item represents the only capability for "interactive" graphics.
+The following features are NOT provided by design:
+
+- Bitmap constructs
+- Continuous X-event recognition
+- Read/Write Colormaps
+- Multiple X windows
+- full 3D support (you really ought to be using OpenGL at that point)
+
+
+
+Implementation
+--------------
+Xplot11 is implemented at three basic levels of routines, but only
+the first, user-level group is called in applications.
+
++ user level routines - these are in the files:
+ plt_base.f
+ plt_font.f
+ plt_color.f
+ plt_util.f
+ plt_3D.f ("3D" support routines for passive display of x,y,z objects)
+
+ plt_old.f (old Versatec-style graphics interface)
+
++ an intermediate level that scales between user and plot, clips and zooms,
+ and handles replotting - these are in the file:
+ set_subs.f
+
++ a hardware support level that interfaces to the postscript and X-windows
+ plotting devices - these are in the files:
+ ps_subs.f
+ gw_subs.f
+ Xwin.c
+
+One major purpose of the intermediate level is to permit the automatic
+generation of a logging list as a side-effect of the user-level calls.
+This list allows the entire current plot to be regenerated by a
+simple call, e.g.
+
+ CALL REPLOT(2)
+
+if the user wants to make a hardcopy of what's visible on the screen, say.
+This call to REPLOT simply takes the calls from the logging list, and calls
+the support-level routines again, but now with PostScript output enabled.
+
+
+Plot Devices
+------------
+
+As mentioned above the plot library only supports two devices, the X-window
+display and hardcopy in the form of output files in postscript. The plot
+device is selected for each plot in the PLOPEN statement which has the
+form:
+ CALL PLOPEN(relsize,lpsunit,idev)
+
+where idev selects the plotting destination as follows:
+
+ idev X-window PostScript
+ ---- -------- ----------
+ 1 x
+ 2 B & W
+ 3 x B & W
+ 4 Color
+ 5 x Color
+
+Note that odd idev's include plotting to the X-window, even values select
+postscript only and can be used with REPLOT to get a hardcopy of the
+current plot.
+
+The lpsunit input specifies the logical unit to use for the postscript output.
+If lpsunit=0 Xplot11 writes to unit 80 and to a file called "plot.ps". If
+lpsunit>0 the plot will be written to unit #lpsunit with the filename
+"plotunitNNN.ps" where NNN=lpsunit. If an open file is found on unit #lpsunit
+Xplot11 will assume the unit is under external program control and will only
+write postscript data to it, no OPENs, CLOSEs or REWINDs will be done. If
+lpsunit<0 is specified separate "plotNNN.ps" files are generated for each
+plot, written to logical unit 80. Separate plot files are numbered starting
+with NNN=000 (i.e. "plot000.ps") and file names are incremented for each plot.
+
+The first parameter, relsize, gives the relative window size and orientation
+to use for the graphics page. A relsize=0.6 gives a graphics window that is
+0.6 of the size of the root X-window. If relsize+>0 the page is in Landscape
+mode (11x8.5), if relsize<0 the page is in Portrait mode (8.5x11). Note that
+relsize does not specify the size for hardcopy, only the screen fraction to
+use to display the page on the screen (more on this below...).
+
+
+Automatic Replot
+----------------
+
+A call to REPLOT(idev) uses the same plotting destinations used in the
+PLOPEN call discussed above. Normally REPLOT is used for either zooming
+a previous plot (with REPLOT(1)) or to make a hardcopy of the current plot
+(with REPLOT(2) or REPLOT(4)).
+
+This automatic logging and replot capability means that the user program
+does not need to be structured to regenerate the plot on demand. This is
+well suited to the kind of program structure used for simple Fortran
+analysis codes (more casual than event-driven programming).
+
+Note that the current logging is done to an array (in memory) until the
+number of plot primitives hits the array limit (set in the parameters in
+pltlib.inc, normally 100,000 or more primitives are stored) then the array
+is paged out to a logging file "xplot11_logfile" that holds the overflow.
+This ensures that a replot can recreate any plot, no matter how complex.
+The log file is currently created on logical unit 81 (which is not available
+to the user as a postscript file unit) and is deleted automatically when the
+user closes plotting.
+
+
+Plotting coordinate systems
+----------------------------
+
+The Xplot11 user interface works with two plotting coordinate systems:
+
+* User units x,y (arbitrary units)
+* Absolute units X,Y (inches for PostScript, pseudo_inches for X-graphics)
+
+1 pseudo_inch on the X-window will show up as 1 inch on PostScript.
+For brevity, a pseudo_inch will be referred to simply as "Inch" henceforth.
+
+
+
+*************************************************************************
+******** Achtung Europeans and Un-American metric zealots !!! ********
+
+If you prefer doing all your plotting in centimeters rather than inches,
+you can make the following source code changes...
+
+In subroutine ps_init (in ps_subs.f):
+
+ccc if(P_SCALE.EQ.0.) P_SCALE = 72.
+ if(P_SCALE.EQ.0.) P_SCALE = 72. / 2.54
+
+
+In subroutine gw_init (in gw_subs.f):
+
+ccc DATA iwdefsize, w1size, w2size / 1000, 11.00, 8.50 /
+ DATA iwdefsize, w1size, w2size / 1000, 27.94, 21.59 /
+
+
+...and then translate "inch" to "centimeter" in this file.
+
+
+While you're at it, you might as well change w1size, w2size above
+to match your strange and unnatural paper dimensions in cm.
+
+*************************************************************************
+
+
+
+
+The absolute (X,Y) axes always span the X-window and PostScript page as
+shown below. The user (x,y) axes are relocatable within the screen or page,
+and are provided mainly for programming convenience:
+
+
+ Y_PAGE -------------------------------
+ | |
+ | |
+ | |
+ | | |
+ | | |
+ | y | |
+ Y | | user system |
+ | | |
+ | +------------- |
+ | x |
+ | |
+ | ABSOLUTE SYSTEM |
+ | |
+ 0 +-------------------------------
+
+ 0 X X_PAGE
+
+
+The transformation (x,y) -> (X,Y) is defined as
+
+ X = X_SCALE*x + X_ORG
+ Y = Y_SCALE*y + Y_ORG
+
+with the start-up values of the offset/scaling transformation parameters being
+
+ X_SCALE = 1.
+ Y_SCALE = 1.
+ X_ORG = 0.
+ Y_ORG = 0.
+
+so that (x,y) is initially the same as (X,Y) when a plot page is started.
+Different offsets and/or scaling factor can be set at any time by
+
+ CALL NEWORIGIN(X_ORG,Y_ORG)
+ CALL NEWFACTORS(X_SCALE,Y_SCALE)
+
+Alternatively one could use the "move-to & re-origin" PLOTABS call.
+
+ CALL PLOTABS(X_ORG,Y_ORG,-3)
+ CALL NEWFACTORS(X_SCALE,Y_SCALE)
+
+The effect of these specifications persists until these parameters are
+changed again or a new plot page is opened with CALL PLOPEN.
+
+
+Alternatively (and confusingly), one can also change the absolute
+transformation offsets X_ORG,Y_ORG via the current user coordinates by
+
+ CALL PLOT(x_org,y_org,-3)
+
+which derives the new absolute offsets directly from the current
+transformation:
+
+ (X_ORG)_new = X_SCALE*x_org + X_ORG
+ (Y_ORG)_new = Y_SCALE*y_org + Y_ORG
+
+In general, PLOT is affected by the current transformation parameters
+whereas PLOTABS is not, so the use of PLOTABS for origin-changing is
+conceptually much simpler.
+
+
+Another alternative way, rather than independently setting origins
+and scale factors, is to set the complete user-absolute
+transformation (offsets and scaling factors) at any time by
+
+ CALL NEWUSERTRANS(X_ORG,Y_ORG,X_SCALE,Y_SCALE)
+
+For convenience, transformation function routines for direct evaluation
+of x(X), y(Y), X(x), Y(y) are provided:
+
+ FUNCTION XABS2usr(X)
+ FUNCTION YABS2usr(Y)
+ FUNCTION xusr2ABS(x)
+ FUNCTION yusr2ABS(y)
+
+It is rarely necessary to use these in applications, however.
+
+Note that the user-to-absolute tranformation can be queried with
+
+ CALL GETUSERTRANS(X_ORG,Y_ORG,X_SCALE,Y_SCALE)
+
+or
+ CALL GETORIGIN(X_ORG,Y_ORG) and
+ CALL GETFACTORS(X_SCALE,Y_SCALE)
+
+
+* * *
+
+The default X-window size is (X_PAGE,Y_PAGE) = ( 11.0 , 8.5 ),
+and can be resized with the mouse via the Window Manager.
+
+For PostScript hardcopy, (X,Y) are inches, so that anything visible
+in the default X-window will just fit on a standard 8.5"x11.0" sheet
+in Landscape orientation.
+
+For the X-window, (X,Y) are "pseudo_inches", whose size depends
+on the physical size of the screen, and on the specified fraction
+of the screen taken up by the window. No matter what size the
+default X-window appears to be on the terminal, its contents
+will fit within a 11.0"x8.5" PostScript page. See "Window Resizing"
+section below.
+
+The alternative 8.5"x11.0" Portrait orientation for both the X-window
+and Postscript is specified via the PLOPEN call list when a new plot
+page is started.
+
+
+* * *
+
+Most Xplot11 routines come in two versions:
+
+ * User-coordinate routines, which receive the user coordinates (x,y)
+
+ * Absolute-coordinate routines, which receive the absolute coordinates (X,Y)
+
+These are essentially the same, except that the user-coordinate routines
+initially perform the transformation (x,y) --> (X,Y) using the current
+transformation parameters X_SCALE, Y_SCALE, X_ORG, YORG, previously
+set as described above.
+
+The absolute-coordinate plot-command routines are:
+
+ PLOTABS
+ POLYLINEABS
+ PLNUMBABS
+ PLCHARABS
+ PLSLANABS
+ PLMATHABS
+ PLSYMBABS
+ PLGRIDABS
+ NEWCLIPABS
+ NEWZOOMABS
+
+The following routines return information in absolute coordinates:
+
+ GETLASTXYABS
+ GETCURSORXYABS
+ GETCLIPABS
+ GETZOOMABS
+
+ GETORIGIN
+ GETWINSIZE
+ GETPAGESIZE
+
+
+Most of the above routines have user-coordinate counterparts,
+typically without the "ABS" name ending.
+
+
+Plot units, Sizing and Zooming
+------------------------------
+
+It should be mentioned that there are two additional coordinate
+systems used inside Xplot11,
+
+- (GX,GY) X-window pixel coordinates
+- (PX,PY) PostScript point coordinates
+
+which actually drive the screen and hardcopy output routines.
+The application does not need to be concerned with these, however.
+
+To further add to the confusion, there is another intermediate
+set of coordinates associated with the built-in zooming feature,
+which "pre-processes" the absolute (X,Y) coordinates before the
+actual X-window and PostScript coordinates are generated.
+The overall data stream is as follows:
+
+ User --> Absolute --> Zoomed-absolute --> X-window,PostScript
+
+ any --> Inches --> Magnified Inches --> pixels , points
+
+ (x,y) --> (X,Y) --> (X',Y') --> (GX,GY), (PX,PY)
+
+ X' = XFAC*(X + XOFF)
+ Y' = YFAC*(Y + YOFF)
+
+
+The interactive zoom routine
+
+ CALL USETZOOM(LXYsame,Lcursor)
+
+asks the user to specify two corners of a "zoom box" on the X-window,
+either by the cursor (if Lcursor = T), or by typing their x,y user coordinates
+or X,Y absolute coordinates (if Lcursor = F). This establishes the
+intermediate coordinate system (X',Y') which results in the selected zoom
+region taking up as much of the output plot page as possible.
+
+When the window is first opened, the zoom parameters are initialized to
+ XOFF = 0.
+ YOFF = 0.
+ XFAC = 1.
+ YFAC = 1.
+
+so that (X',Y') = (X,Y) and there is no zooming. Zooming differs
+from the usual re-origin and scale change in two key ways:
+
+1) It will distort the vector fonts (unless LXYsame = T)
+2) The zoom parameters are NOT reset if a new plot page is started
+ with PLOPEN
+
+The zoom offsets and factors can be directly specified with
+
+ CALL NEWZOOMABS(XOFF,YOFF,XFAC,YFAC)
+
+which explicitly sets the zoom parameters in absolute coordinate offsets and
+zoom factors from absolute->zoomed coordinates. These can be queried with
+
+ CALL GETZOOMABS(XOFF,YOFF,XFAC,YFAC)
+
+The zooming can be reset with
+
+ CALL CLRZOOM
+
+which just resets the zoom parameters to their default initial values.
+
+The simplest way to treat zooming is as a magnifying lens in front of the
+screen and/or hardcopy paper, to be placed and removed interactively at
+the whim of the user. NEWZOOMABS should not be used to do axis scaling,
+shifting, etc, in normal plot operations. That's what NEWFACTORS and
+PLOTABS are for.
+
+
+Window Resizing
+---------------
+
+The window dimensions in absolute units are X_WIND,Y_WIND. These are
+initialized to be the same as X_PAGE,Y_PAGE, these in turn having default
+values set in the parameter statements in pltlib.inc.
+
+If the window is resized with the mouse, then X_WIND,Y_WIND are reset
+appropriately on the next PLOPEN or REPLOT call. This resetting is done
+so that
+
+a) Y_WIND/X_WIND matches the window aspect ratio in pixels.
+b) X_WIND,Y_WIND do not exceed X_PAGE,Y_PAGE, respectively.
+
+The latter requirement ensures that whatever is visible in the window
+will fall within the X_PAGE,Y_PAGE limits, and hence will fall on the
+hardcopy page. Not all of the page will be "covered" by the graphics
+window if the window aspect ratio doesn't match the page aspect ratio.
+Two such possible situations are shown below.
+
+
+ Y_PAGE+---------------------+ Y_PAGE+---------------------+
+ Y_WIND|.............. | | |
+ |. . | | |
+ |. . | Y_WIND|.....................|
+ |. . | |. .|
+ |. . | |. .|
+ |. . | |. .|
+ |. . | |. .|
+ |.............. | |.....................|
+ 0 +---------------------+ 0 +---------------------+
+ 0 X_WIND 0 X_WIND
+ X_PAGE X_PAGE
+
+
+In general, interactively resizing the window has no effect on what
+comes out on hardcopy, but it obviously does affect what is visible
+on the screen. Adjusting of the plot aspect ratio to fit a resized
+window must be done by the application itself. The current window
+size can be interrogated with
+
+ CALL GETWINSIZE(X_WIND,Y_WIND)
+
+at any time.
+
+
+
+Color and Colormaps
+-------------------
+
+The original Versatec hardware (back when I was a lad...) supported
+only black and white plots. This is the 90's however and color
+graphics have become ubiquitous (and useful!).
+
+The two graphics output devices used for Xplot11, the Xwindows screen
+and the postscript output, both support color graphics. In the
+interests of portability, the color support for Xplot11 has been aimed
+primarily at a modern minimal configuration, an 8-bitplane color
+graphics system. In worst case, if the Xserver does not support at
+least 16 colors the package degrades gracefully to provide B&W screen
+graphics. Xplot11 can also generate either B&W postscript or color
+postscript output, as selected by the user.
+
+Colors in Xplot11 are manipulated by the use of a COLORMAP which contains up
+to 256 entries, each of which has an associated color value (red,green,blue).
+Unfortunately not all of these 256 may be available at all times. This
+limitation arises because Xplot11 uses a read-only Xwindow colormap where
+colors are allocated and shared with other applications. This limits the
+number of colors that an application may use but has the advantage that
+colors will not change as the input focus (mouse) moves through various
+windows that each try to reload the graphics hardware with their own private
+colormap. The extent of the X colormap used by other Xwindow applications is
+typically less than 30-40 colormap entries, depending on what other windows
+are displaying. For an 8-bit color depth, this leaves around 220 or so
+available for use by Xplot11. Note that this may not be true for your system
+if other color-hogging applications are running (such as a window manager with
+lots of pretty colored icons). You can monitor the number of colors used in
+the read-only colormap with the xcmap command (part of the X distribution, at
+least one of the X contributed programs that is typically available with X).
+
+Note that the number of colors available in postscript output is unlimited
+but Xplot11 has a 256 color limit.
+
+
+
+The default color setting for Xplot11 is to plot white lines on a black
+background to reduce glare and enhance color saturation. Some people prefer
+to use non-reverse video (black foreground on white background). Black
+plotting on white can be selected for Xplot11 plots by setting an environment
+variable:
+
+using the csh or tcsh shell
+ % setenv XPLOT11_BACKGROUND white
+using the sh or bash shell
+ % export XPLOT11_BACKGROUND=white
+
+To restore white-on-black video:
+
+using the csh or tcsh shell
+ % unsetenv XPLOT11_BACKGROUND
+or % setenv XPLOT11_BACKGROUND black
+using the sh or bash shell
+ % export XPLOT11_BACKGROUND=black
+
+Note that, even though this reverses black and white in the video,
+PostScript plots will still be done as black-on-white to save toner.
+Note that, internally, Xplot11 always assumes that "white" is the
+background color. In reverse-video mode the roles of black and white
+are reversed only to the X window, where the color "black" plots to the
+screen as white and the color "white" plots as black, all other colors
+are unaffected. This may be a little confusing if you are looking at a
+reverse video plot with white lines that are selected with the color "black".
+
+
+
+Colors can be allocated to the colormap in several ways.
+
+- A default map with 10 basic colors is set up by the package with
+ the corresponding colormap indices. These are set as parameters
+ in the convenient include file colors.inc .
+
+ BLACK = 1
+ WHITE = 2
+ RED = 3
+ ORANGE = 4
+ YELLOW = 5
+ GREEN = 6
+ CYAN = 7
+ BLUE = 8
+ MAGENTA = 9
+ VIOLET = 10
+
+Their RGB color components are defined in SUBR. COLORMAPDEFAULT,
+and can be easily tuned to personal preference. They can be displayed
+with the simple program defmap:
+
+ % make defmap
+ % defmap
+
+The default 8 RED...VIOLET colors are not fully saturated, but
+are darkened somewhat to be adequately visible on black and on white
+backgrounds alike (i.e. in both normal and reverse-video modes).
+They are well-suited for use with the 8 line styles implemented
+in SUBROUTINE XYLINE.
+
+
+- A color can be allocated or selected by name (like BLACK, ORANGE,
+ tan, steelblue,RED...) where the color names must be known to the Xwindows
+ server (look in the file /usr/lib/X11/rgb.txt for a complete definition)
+
+- A color can be allocated or selected by its red,green,blue components
+ e.g. R,G,B = (0-255,0-255,0-255)
+
+- A continuous range of colors can be allocated at once with a "spectrum"
+ colormap, by calling one of the following routines:
+
+ subroutine COLORSPECTRUMHUES(ncols,HUESTR)
+ subroutine COLORSPECTRUMTRP(ncols,NBASE,IRGBBASE,COLWIDTH)
+ subroutine COLORSPECTRUMRGB(NRGB,IRGB)
+
+ These create additional colors, and append them as a "Spectrum" to the
+ end of the current colormap. The spectrum colors are intended mainly
+ for use in color contouring, etc.
+
+ The three routines above have three different ways to specify the
+ "spectrum", with increasing levels of input detail, ranging from
+ a simple rainbow hue string "RYGB" to an array of r,g,b components
+ for each color in the "spectrum" (see their comment headers).
+
+Different hue strings can be tried out with program spectrum:
+
+ % make spectrum
+ % spectrum
+
+
+
+Once allocated, colors in the Xplot11 colormap may be selected, as mentioned
+above, with a color name
+
+ CALL NEWCOLORNAME('cyan')
+
+or the r,g,b components
+
+ CALL NEWCOLORRGB(0,255,255)
+
+or by an absolute color index,
+
+ CALL NEWCOLOR(7)
+
+or by a "Spectrum" color index.
+
+ CALL NEWCOLOR(-48)
+
+
+A positive color index can run from 1 to N_color (# of all colors allocated),
+although this is typically used to access the first 10 or so default colors
+for simple line plots, etc.
+
+A negative color index can only run from -1 to -N_spectrum (# of Spectrum
+colors allocated via one of the COLORSPECTRUMxxx routines). These colors
+are a subset of the full colormap, and are typically used to do orderly
+shading with the closely-spaced Spectrum colors.
+
+
+ _ _____
+ 1 |_rgb_|
+ | 2 |_____|
+ | 3 |_____|
+ 4 |_____|
+default 5 |_____|
+colors 6 |_____|
+ 7 |_____|
+ | 8 |_____|
+ | 9 |_____|
+ _ 10 |_____|
+ 11 |_____| -1 <- note that the first spectrum color may be
+ 12 |_____| -2 located at an index > 11 since the user may
+ 13 |_____| -3 allocate colors (named or RGB) before
+ . . . allocating the spectrum
+ . . .
+ _____
+ N_color |_____| -N_spectrum
+
+
+
+Double Buffering
+-----------------
+
+Xplot11 now supports double buffering (although this is getting kind of
+overly exotic for a simple plot package, it was so simple we added it).
+The double buffering can be used to do primitive animation without the screen
+flickering that would otherwise spoil the effect. You open a plot as usual
+but now you can redirect drawing to a pixmap buffer rather than to the X
+window. This done with a DRAWTOBUFFER call before you do any plotting.
+This will cause a redirection of the plot so that none of the buffer drawing
+will appear until a SHOWBUFFER or PLFLUSH is called. At this point the
+buffer pixmap is copied to the X window. Double buffering can be stopped
+with a DRAWTOSCREEN to change the plot destination back to the X window.
+
+The new double-buffering functions are
+
+ SUBROUTINE DRAWTOSCREEN Sets plotting destination to screen
+ SUBROUTINE DRAWTOBUFFER Sets plotting destination to background buffer
+ SUBROUTINE SHOWBUFFER Displays contents of background buffer to screen
+
+
+
+Fonts and Symbols
+-----------------
+
+Xplot11 supports only vector fonts as a matter of policy. Currently
+there are three fonts available, implemented in three routines which
+take character strings to be plotted as arguments:
+
+ SUBROUTINE PLCHAR Keyboard-style WYSIWYG ASCII characters
+ SUBROUTINE PLSLAN Slanted version of PLCHAR
+ SUBROUTINE PLMATH LaTex-like Greek letters and math symbols
+
+There is also a plotting symbol routine which plots simple geometric
+shape "characters" one at a time, indexed by an integer argument.
+
+ SUBROUTINE PLSYMB
+
+All font routines come in absolute-coordinate and user-coordinate
+versions, e.g.
+
+ CALL PLCHAR (x,y,ch,'ABCdef',0.0,6)
+ or CALL PLCHARABS(X,Y,CH,'ABCdef',0.0,6)
+
+The location x,y or X,Y positions the lower-left corner of the first
+character. The user-coordinate character width parameter ch passed
+to PLCHAR is converted to an absolute width by using X_SCALE (not Y_SCALE).
+Having different X_SCALE and Y_SCALE will not distort the fonts,
+since only X_SCALE is used to plot them.
+
+
+The font routines have their vector fonts encoded in DATA statements
+in four separate include files CHAR.INC, SLAN.INC, etc. New fonts
+can be created or the existing ones modified by the interactive program
+symgen in the sym/ directory. File sym/Readme has more information.
+
+To display the four available fonts and some sample character
+strings, run program test in the sym/ directory:
+
+ % cd sym
+ % make test
+ % test
+
+This will generate a screen display and the corresponding PostScript
+file plot.ps which can be printed as a handy programming reference.
+
+
+In addition to the basic vector font routines above, there is
+also a higher-level SUBROUTINE PLNUMB which takes a real argument
+and plots the corresponding numeral. This routine does not have
+an associated font, but instead calls PLCHAR to plot the individual
+digits, decimal point, etc. Like with the other font routines,
+an absolute-coordinate version PLNUMBABS is also available.
+
+
+
+Utility Routines
+----------------
+
+The source files plt_util.f and plt_3D.f contain frequently-used
+higher-level routines which are convenient for building applications.
+For example, a plain x-y plot can be made with three simple calls
+
+ CALL XAXIS(...)
+ CALL YAXIS(...)
+ CALL XYLINE(...)
+
+although a few preparatory calls to AXIS_ADJ or other scaling routines
+might be necessary to set up the appropriate call list parameters.
+Additional calls to PLCHAR, PLGRID, might also be desirable for
+annotation and grid overlay.
+
+
+The annotation routine is useful for interactive annotation,
+and is simply invoked with:
+
+ CALL ANNOT(char_size)
+
+Anything the user places on the screen while in ANNOT will be
+automatically logged and can be echoed to PostScript with
+
+ CALL REPLOT(2)
+
+as described earlier.
+
+
+
+==================================================================
+
+
+Typical application calling sequences are illustrated below.
+
+c==== This comment lead indicates a required call. All others are optional.
+
+
+
+c==== Initialize plot routines, sets up default (10 color) colormap
+ CALL PLINITIALIZE
+c
+c---- Additional "Spectrum" colormap with hardwired definitions
+c (1..64 colors ranging from Blue to Cyan to Green to Yellow)
+ CALL COLORSPECTRUMHUES(64,'BCGY')
+c
+c---- Alternative Spectrum-setup call are given below...
+c- (these are more general, but more awkward to set up)
+c
+c---- User-supplied "Spectrum" interpolated from base color RGB components
+c (in lieu of COLORSPECTRUMHUES call above)
+CCC CALL COLORSPECTRUMTRP(64,NBASE,IRGB,COLWIDTH)
+c
+c---- User-supplied "Spectrum" defined by RGB components
+c (in lieu of COLORSPECTRUMHUES or COLORSPECTRUMTRP call above)
+CCC CALL COLORSPECTRUMRGB(NRGB,IRGB)
+c
+c
+c==== start new X-window plot, Postscript output to default unit and file
+c normally "plot.ps" and logical unit 80, no PostScript yet
+ CALL PLOPEN(0.8,0,1)
+c
+c---- move origin +0.1,+0.1 Inches
+ CALL PLOT(0.1,0.1,-3)
+c
+c---- blow up everything 5x in both directions
+ CALL NEWFACTOR(5.0)
+c
+c---- draw some lines
+ CALL NEWPEN(3)
+
+ CALL PLOT(x,y,...
+
+ CALL PLOT(x,y,...
+c
+c---- select color #4 in colormap
+ CALL NEWCOLOR(4)
+c
+c---- alternative to NEWCOLOR call above (will add color if not defined)
+CCC CALL NEWCOLORNAME('orange')
+c
+c---- another alternative to NEWCOLOR call (will also add color if necessary)
+CCC ired = 250
+CCC igrn = 150
+CCC iblu = 0
+CCC CALL NEWCOLORRGB(ired,igrn,iblu)
+c
+c---- plot a number
+ CALL PLNUMB(x,y,...
+c
+c---- flush X buffer so everything is on screen
+ CALL PLFLUSH
+c
+c==== finish plot page
+ CALL PLEND
+c
+c
+c---- replot everything (since last PLOPEN call) to PostScript file "plot.ps"
+ CALL REPLOT(2)
+c
+c
+c---- query window size (might have been changed by user via mouse)
+ CALL GETWINSIZE(Xmax,Ymax)
+c
+c
+c
+c==== start another plot page in Portrait orientation, with simultaneous PS
+c (this resets all re-origins, scaling)
+ CALL PLOPEN(-0.8,0,3)
+c
+c---- blow up everything 10x, 5x
+ CALL NEWFACTORS(10.0,5.0)
+c
+c---- plot x,y axes
+ CALL XAXIS(x0,y0,xlen,dxlen,xann0,dxann,csize,-2)
+ CALL YAXIS(x0,y0,ylen,dylen,yann0,dyann,csize,-2)
+c
+c---- label x axis
+ CALL PLCHAR(x0+0.5*xlen,y0-3.0*csize,csize,'X_variable',0.0,10)
+c
+c---- select Spectrum color #33 and plot a grid
+ CALL NEWCOLOR(-33)
+ CALL PLGRID(x0,y0,...
+c
+c---- plot x(y) line with line pattern 3
+ CALL XYLINE(n,x,y,xoff,xwt,yoff,ywt,3)
+c
+c---- replot everything since last PLOPEN call, in case window got resized
+ CALL REPLOT(1)
+c
+ CALL PLOT(x,y,...
+ CALL PLOT(x,y,...
+ CALL PLFLUSH
+c
+c---- get cursor location in user coordinates x,y
+ CALL GETCURSORXY(x,y,chkey)
+c
+c---- get cursor location in absolute coordinates x,y
+ CALL GETCURSORXYABS(x,y,chkey)
+c
+ CALL NEWPEN(4)
+c
+c---- plot character(s) at cursor location in absolute coordinates
+ CALL PLCHARABS(X,Y,ch,'Test',0.0,4)
+c
+ CALL PLOT(x,y,...
+ CALL PLOT(x,y,...
+ CALL PLFLUSH
+c
+c---- ask user to specify zoom area (distortion OK, using cursor)
+ CALL USETZOOM(.FALSE.,.TRUE.)
+c
+ CALL PLOT(x,y,...
+ CALL PLOT(x,y,...
+c
+c---- clear zoom if next plot page is not to be zoomed
+ CALL CLRZOOM
+c
+c==== finish plot page
+ CALL PLEND
+c
+c---- same as PLEND call above
+ccc CALL PLOT(0.0,0.0,-999)
+c
+c
+c---- end of all plotting, close window, close PostScript file
+ CALL PLCLOSE
+c
+c---- same as PLCLOSE call above
+ccc CALL PLOT(0.0,0.0,+999)
+
+
+
+==================================================================
+
+To make a list of user interface routines, do the following...
+
+ % grep " subroutine" plt*.f
+
+
+The source file plt_old.f contains the equivalent of the old Versatec
+user interface routines (this set includes some of the basic routines
+that were retained in the extended package) provided for backwards
+compatibility. These routines should not be used in new applications,
+since the intent is to phase them out sometime in the 21st Century:-)
+
+
+The other source files set_subs.f, ps_subs.f, gw_subs.f, Xwin.c
+contain internal support routines. These are not intended to be
+called by applications (there's no reason to do so in any case).
+
+
+====================================================================
+
+
+Sample and test programs
+-------------------------
+
+volts.f - demo program that draws a simple, labeled plot with axes.
+
+volts_old.f - demo program that draws a simple, labeled plot with axes.
+ (uses old "Versatec" plot calls)
+
+squares.f - draws a sine wave in colored boxes with colored labels
+
+squaresdoublebuff.f - tests the double buffering with a sine wave with
+ dynamic color sequence in the colored boxes
+
+gridtest.f - tests the grid routines (obvious, aren't we...)
+
+symbols.f - display and test the basic vector fonts
+
+symbolsall.f - display and test all the vector fonts and symbols, has option
+ to test the separate plot file or external plot file options
+
+cmap2.f
+cmap3.f - used for interactive viewing of RGB color components:
+
+zoomtest.f - test of zooming, enter T T to prompt to keep scale, use cursor
+
+contest.f - test of contoured, filled plots
+
+defmap.f - displays the default colormap produced by CALL COLORMAPDEFAULT
+
+spectrum.f - displays the "Spectrum" produced by
+ CALL COLORSPECTRUMHUES(ncols, RYGCBM_string)
+ in pie and bar form.
+
+ Typical values for RYGCBM_string might be
+ 'RYG'
+ 'GYR'
+ 'MCY'
+ 'BMRY'
+ 'BCGYR', etc.
+
+ Choosing strongly non-contiguous sequences like 'RCB' is OK,
+ but will make a horrid-looking Spectrum.
+
+sym/test.f - display current vector fonts
+
+====================================================================
+
+
diff --git a/plotlib/GPL-library b/plotlib/GPL-library
new file mode 100644
index 0000000..eb685a5
--- /dev/null
+++ b/plotlib/GPL-library
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/plotlib/MATH.INC b/plotlib/MATH.INC
new file mode 100644
index 0000000..ac04cd9
--- /dev/null
+++ b/plotlib/MATH.INC
@@ -0,0 +1,224 @@
+C Version 4.46 11/28/01
+
+ CHARACTER* 92 CHARS
+ INTEGER NODE(20, 92)
+
+ DIMENSION NODE0(20,10)
+ DIMENSION NODE1(20,10)
+ DIMENSION NODE2(20,10)
+ DIMENSION NODE3(20,10)
+ DIMENSION NODE4(20,10)
+ DIMENSION NODE5(20,10)
+ DIMENSION NODE6(20,10)
+ DIMENSION NODE7(20,10)
+ DIMENSION NODE8(20,10)
+ DIMENSION NODE9(20, 2)
+ EQUIVALENCE ( NODE(1, 1) , NODE0(1,1) )
+ EQUIVALENCE ( NODE(1, 11) , NODE1(1,1) )
+ EQUIVALENCE ( NODE(1, 21) , NODE2(1,1) )
+ EQUIVALENCE ( NODE(1, 31) , NODE3(1,1) )
+ EQUIVALENCE ( NODE(1, 41) , NODE4(1,1) )
+ EQUIVALENCE ( NODE(1, 51) , NODE5(1,1) )
+ EQUIVALENCE ( NODE(1, 61) , NODE6(1,1) )
+ EQUIVALENCE ( NODE(1, 71) , NODE7(1,1) )
+ EQUIVALENCE ( NODE(1, 81) , NODE8(1,1) )
+ EQUIVALENCE ( NODE(1, 91) , NODE9(1,1) )
+ DATA NCHARS / 92 /
+ DATA CHARS( 1: 26) / 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /
+ DATA CHARS( 27: 52) / 'abcdefghijklmnopqrstuvwxyz' /
+ DATA CHARS( 53: 78) / '0123456789,.;:`"!?@#$%&|()' /
+ DATA CHARS( 79: 92) / '[]{}<>_+-*=/^~' /
+ DATA NODE0 /
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21688,12488,25288,16088,21616,12416,25216,16016,22016,15688,
+ & 21988,15516,22188,15716, 0, 0, 0, 0, 0, 0,
+ & 21216,13988,16416,11216,21318,16118,13884, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22816,14816,22888,14888,23788,13716,23988,13916,22575,11461,
+ & 11443,12529,15129,16243,16261,15175,12575, 0, 0, 0,
+ & 25888,16180,16188,11688,22288,12216,22488,12416,21616,13016,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 20490,11096,11064,21964,13196,23890,14396,15296,15691,15684,
+ & 13871,13864,15664, 0, 0, 0, 0, 0, 0, 0,
+ & 26694,16696,16396,16191,15982,15346,15014,14805,14600,14300,
+ & 14302,25014,15754,15982, 0, 0, 0, 0, 0, 0,
+ & 26396,16196,15891,15573,14923,14605,14300,14100,24956,14552,
+ & 14544,14940,15540,15944,15952,15556,14956, 0, 0, 0 /
+ DATA NODE1 /
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21516,12616,24916,16116,21816,13888,15816,25616,13784, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22890,13396,13362,22962,13762,20479,12079, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24416,16769,12169,14416,26565,12565,14518, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,14067,16416,11616, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22416,13216,24416,15216,22716,12788,22916,12988,24716,14788,
+ & 24916,14988,21888,11683,11688,16088,16083,15888, 0, 0,
+ & 22716,14816,15933,15971,14888,12888,11771,11733,12716,23052,
+ & 14652,23056,13048,24656,14648,21973,11931,25773,15731, 0,
+ & 23058,13658,14507,16196,17296,23658,13858,14613, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25616,16125,16016,11616,14654,12088,21688,15988,16179,21688,
+ & 14452, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21347,11755,12255,12451,12235,12422,12916,13816,14522,15134,
+ & 15552,15670,15582,14888,13988,13484,13277,13468,14362,16153 /
+ DATA NODE2 /
+ & 23016,14616,21674,11984,12588,13184,13766,13716,26074,15784,
+ & 15188,14584,13966,13916,23184,13966,24584,13766, 0, 0,
+ & 22124,13642,14456,14870,14983,14888,14688,14486,14080,13670,
+ & 13253,12935,12924,13118,13516,14216,15019,15926, 0, 0,
+ & 21522,11716,13016,11548,11567,12283,13188,14588,15483,16167,
+ & 16148,14616,15916,16122,21976,11758,11940,25776,15958,15740,
+ & 21626,11716,15916,16026,21678,11788,15988,16078,22660,12644,
+ & 25060,15044,22654,15054,22650,15050,21720,15920,21784,15984,
+ & 23088,14688,23016,14616,23788,13716,23988,13916,21474,11769,
+ & 11842,13029,14629,15842,15969,16274,21769,12040,25969,15640,
+ & 22088,11680,11688,16088,11816,16016,16025,15616,21816,11616,
+ & 15888, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26064,15554,14937,14323,13617,12916,12217,11722,11534,11746,
+ & 12256,12962,13564,14064,14460,14750,14737,14919,15416,16120,
+ & 21508,12655,13276,13986,14688,15287,15682,15671,15161,14256,
+ & 12757,24256,15449,15837,15626,14918,13816,13016,11820, 0,
+ & 21504,15866,25504,15104,14709,14317,13349,12662,12266,11866,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25184,14987,14588,13888,13485,13177,13267,13861,14857,15345,
+ & 15233,14722,13716,12816,11922,11734,12150,12857,13861, 0 /
+ DATA NODE3 /
+ & 25559,14664,13764,12760,12052,11739,11729,12220,13116,14116,
+ & 15220,21842,14142, 0, 0, 0, 0, 0, 0, 0,
+ & 21645,12057,12863,13864,14962,15556,15744,15332,14427,13326,
+ & 12427,11733,11645,23004,14388, 0, 0, 0, 0, 0,
+ & 21557,12164,12867,13662,14246,14325,14113,13804,13500,13305,
+ & 13416,13932,14950,16063, 0, 0, 0, 0, 0, 0,
+ & 21759,11962,12264,12563,12661,12755,11916,22755,13360,14164,
+ & 14864,15361,15556,15546,14804, 0, 0, 0, 0, 0,
+ & 23164,12424,12618,13016,14116,15018,15724, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22666,12060,11751,11740,12232,13329,14329,15333,15841,16049,
+ & 15958,15662,15064,14564,14160,13747,13004, 0, 0, 0,
+ & 22464,11616,25764,15264,14862,13448,12037,22843,13924,14218,
+ & 14616,15116, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22788,13288,13685,14074,14627,15018,15316,15716,21316,14256,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22764,11600,22130,12122,12517,12916,13716,14418,14922,15664,
+ & 24922,15017,15316,15616, 0, 0, 0, 0, 0, 0,
+ & 22064,12364,12562,12645,12631,12416,13825,15037,15753,15759,
+ & 15662,15564,15264, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE4 /
+ & 21641,12052,12962,13964,15062,15651,15641,15428,14418,13316,
+ & 12119,11628,11641, 0, 0, 0, 0, 0, 0, 0,
+ & 21559,11963,12566,15966,23266,12216,24766,14444,14430,14716,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25554,12154,12469,12779,13285,13988,14788,15285,15579,15669,
+ & 15554,15236,14824,14319,13816,13016,12519,12224,12036,12154,
+ & 21500,12244,12655,13161,13864,14764,15460,15752,15640,15330,
+ & 14223,13022,11923, 0, 0, 0, 0, 0, 0, 0,
+ & 26264,13964,12962,12052,11641,11628,12119,13316,14418,15428,
+ & 15641,15551,14961,13763, 0, 0, 0, 0, 0, 0,
+ & 21655,12061,12764,15964,23864,13016, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21958,12162,12464,12663,12658,12239,12224,12716,13716,14521,
+ & 15333,15645,15657,15463,15164, 0, 0, 0, 0, 0,
+ & 25660,14964,14264,13464,12761,12254,12147,12542,11936,11728,
+ & 12020,12816,13816,14618,15321,22542,14042, 0, 0, 0,
+ & 22764,12056,11645,11432,11621,12116,12716,13320,13816,14416,
+ & 15120,15731,15942,15953,15564,23320,13740, 0, 0, 0,
+ & 25386,14086,12977,12765,13357,14457,23357,12044,11733,12023,
+ & 13317,15016,15213,14810,24086,13392, 0, 0, 0, 0 /
+ DATA NODE5 /
+ & 21865,12163,12357,11947,11736,12025,12822,14222,15228,15938,
+ & 16051,15865,23004,14388, 0, 0, 0, 0, 0, 0,
+ & 25482,14482,13473,12560,11942,11931,12422,13617,15016,15314,
+ & 14809,23990,14482, 0, 0, 0, 0, 0, 0, 0,
+ & 21272,11864,13064,13672,13688,13096,11896,11288,11272, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21687,12496,12460,21660,13260, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21290,11896,13196,13690,13683,11268,11260,13660, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21391,11896,13196,13691,13684,13179,12079,23179,13674,13666,
+ & 13060,11860,11266, 0, 0, 0, 0, 0, 0, 0,
+ & 21296,11271,13771,23296,13260,22860,13560, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23696,11296,11280,13180,13675,13666,13060,11860,11266, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23691,13196,11896,11290,11266,11860,13060,13666,13675,13279,
+ & 11679,11275, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21296,13696,13692,12268,12260, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE6 /
+ & 21779,11284,11291,11796,13196,13691,13684,13179,13675,13665,
+ & 13060,11860,11265,11275,11779,13179, 0, 0, 0, 0,
+ & 23682,13177,11777,11282,11290,11896,13096,13690,13666,13060,
+ & 11860,11266, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22604,13215,12616,12624,13424,13416,12604, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22624,12616,13416,13424,12624, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21620,11616,12016,12020,11620,23820,13816,14216,14220,13820,
+ & 26020,16016,16416,16420,16020, 0, 0, 0, 0, 0,
+ & 21466,11890,12590,11466, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22696,13496,14092,14486,14478,14072,13468,12668,12072,11678,
+ & 11686,12092,12696, 0, 0, 0, 0, 0, 0, 0,
+ & 23130,12822,13622,13530,13130,23441,13588,14488,13441, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE7 /
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22064,15232,22032,15264, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23775,14380,15480,16075,16365,16242,15826,15016,13716,13021,
+ & 12834,13245,14153,15053,16249, 0, 0, 0, 0, 0,
+ & 21648,15648,23464,13460,13860,13864,13464,23436,13432,13832,
+ & 13836,13436, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22001,11201,10708,10716,11223,12023,13601,14401,14908,14916,
+ & 14423,13623,12001, 0, 0, 0, 0, 0, 0, 0,
+ & 23696,13608, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24872,14159,13941,14121,14808, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22472,13159,13340,13121,12408, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE8 /
+ & 24266,11648,14230,26066,13448,16030, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21666,14248,11630,23466,16048,13430, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 27280,14016,17216, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22282,15482,24882,14786,15882,14578,14882, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 20896,17296, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23668,13628,21648,15648, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21648,15648, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23146,13150,13453,13853,14150,14146,13843,13443,13146,23450,
+ & 13846,23850,13446, 0, 0, 0, 0, 0, 0, 0,
+ & 21656,15656,21640,15640, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21208,16096, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE9 /
+ & 22480,14088,15680, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22480,12985,13685,14479,15179,15684, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
diff --git a/plotlib/Makefile b/plotlib/Makefile
new file mode 100644
index 0000000..76bb09f
--- /dev/null
+++ b/plotlib/Makefile
@@ -0,0 +1,164 @@
+#***********************************************************************
+# Module: Makefile
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@mit.edu
+#***********************************************************************
+
+
+#================================#
+# Makefile for Xplot11 library #
+# edit the config.make file to #
+# set specific options for your #
+# system #
+#================================#
+
+# Point to your install directory
+#INSTALLDIR= $(HOME)/lib
+#INSTALLDIR= /usr/local/lib
+#INSTALLDIR= .
+
+# Use these to set default library name (overridden in config.make file)
+PLTLIB = libPlt.a
+#PLTLIB = libPltDP.a
+
+
+###========================================================
+### Basic plot library object files
+OBJ = plt_base.o plt_font.o plt_util.o plt_color.o \
+ set_subs.o gw_subs.o ps_subs.o Xwin.o
+OBJMISC =
+OBJ3D =
+OBJOLD =
+
+###
+###--------------------------------------------------------
+### Uncomment to add the old plot compatibility routines
+OBJOLD = plt_old.o
+###
+###--------------------------------------------------------
+### Uncomment to add the primitive 3D-view routines
+OBJ3D = plt_3D.o
+###
+###--------------------------------------------------------
+### Uncomment for f77 compiler w/o AND() and RSHIFT/LSHIFT functions.
+### This adds some functions to duplicate these using IAND and ISHFT
+### which often appear in these offending fortran's libraries.
+### The compilers that this has affected include:
+### HPUX f77
+### Absoft f77 on Linux
+###
+#OBJMISC = util-ops.o
+
+
+###================================================
+### Default compilers and flags, install commands
+FC = f77
+CC = cc
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+DEFINE = -DUNDERSCORE
+# Uncomment DP to make double-precision version
+#DP = -r8
+FFLAGS = -O $(DP)
+CFLAGS = -O $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+LINKLIB = -lX11
+###================================================
+
+
+
+###================================================
+### This line includes your compiler/make options
+### with definitions for compiler and flags
+
+include ./config.make
+
+###================================================
+
+
+
+###-------------------------------------------------------------------------
+### Basic make targets - build library, test programs
+
+$(PLTLIB): $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ $(AR) $(PLTLIB) $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ $(RANLIB) $(PLTLIB)
+
+test: $(PLTLIB)
+ (cd examples; make test)
+
+
+###-------------------------------------------------------------------------
+### Utility functions - install the library, clean the directory
+
+install: $(PLTLIB)
+ mv $(PLTLIB) $(INSTALLDIR)
+ $(RANLIB) $(INSTALLDIR)/$(PLTLIB)
+
+clean:
+ -/bin/rm $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ -/bin/rm $(PLTLIB)
+ -/bin/rm plot*.ps
+ (cd examples; make clean)
+
+
+###-------------------------------------------------------------------------
+### compile plot package routines
+
+plt_base.o: plt_base.f pltlib.inc
+ $(FC) -c $(FFLAGS) plt_base.f
+
+plt_color.o: plt_color.f pltlib.inc
+ $(FC) -c $(FFLAGS) plt_color.f
+
+plt_font.o: plt_font.f CHAR.INC SLAN.INC MATH.INC SYMB.INC
+ $(FC) -c $(FFLAGS) plt_font.f
+
+plt_util.o: plt_util.f
+ $(FC) -c $(FFLAGS) plt_util.f
+
+plt_3D.o: plt_3D.f
+ $(FC) -c $(FFLAGS) plt_3D.f
+
+plt_old.o: plt_old.f pltlib.inc
+ $(FC) -c $(FFLAGS) plt_old.f
+
+set_subs.o: set_subs.f pltlib.inc
+ $(FC) -c $(FFLAGS) set_subs.f
+
+gw_subs.o: gw_subs.f pltlib.inc
+ $(FC) -c $(FFLAGS) gw_subs.f
+
+ps_subs.o: ps_subs.f pltlib.inc
+ $(FC) -c $(FFLAGS) ps_subs.f
+
+util-ops.o: util-ops.f
+ $(FC) -c $(FFLAGS) util-ops.f
+
+Xwin.o: Xwin.c
+ $(CC) -c $(CFLAGS) Xwin.c
+
+
+### May need to specify these on a brain-dead make system
+#.f.o: $(FC) -c $(FFLAGS) $<
+#.c.o: $(CC) -c $(CFLAGS) $<
+
+
+
diff --git a/plotlib/Notes b/plotlib/Notes
new file mode 100644
index 0000000..60f0708
--- /dev/null
+++ b/plotlib/Notes
@@ -0,0 +1,219 @@
+/***********************************************************************
+ Module: Notes
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+Xplot11
+C Version 4.46 11/28/01
+
+Released under GNU Library License 8/5/96
+
+
+Notes:
+
+These routines can be compiled either single or double precision by simply
+setting a flag in the Makefile. No source changes.
+
+Two makefiles are supplied, one single precision, one double precision.
+Make a link to one to define the Makefile (eg. ln -s Makefile.SP Makefile)
+
+An option exists for the old Versatec compatibility routine SYMBOL (in
+plt_old.f) to take an integer or byte argument containing either the string
+or an integer specifying a plot symbol. The current arrangement uses
+character string arguments and handles plot symbols with the SYMBL routine.
+This problem comes up with f77 compilers that do not support the older style
+cramming of literal characters into an integer argument. These compilers
+add additional length arguments to the argument list for literal character
+strings that are flagged as errors by the compiler (this happens for BSD f77
+compilers). If you want old-style Versatec SYMBOL calls look at plt_old.f
+and make the suggested source changes. You do lose the ability to call
+SYMBOL with character variables but you can always use the newer PLCHAR
+to plot character strings.
+
+
+
+
+The only known bugs at this time are:
+
+On IBM AIX systems there appears to be a compiler bug with the xlf compiler
+that shows up when compiling the library double precision. The polyline
+routines are affected, getting every other data point. This was discovered
+in July 1996, compiler version unknown. No fix, doesn't affect the single
+precision library or other routines in double precision.
+
+Some Xservers have shown problems with the grid routines, this showed up on
+OSF 3.2 on the DEC Alpha with the 8 bit X server running on a Mach32 card.
+The characteristic is that the masked grid lines show the wrong background
+color. This is a server error, complain to your vendor.
+
+
+Version 4.33 8/30/96
+
+Added logfile for complex plots, fixed xaxis, yaxis to allow non-annotated
+but hash-marked axes. Fixes to ps_linepattern to limit to 8 pattern entries.
+
+Note: to make a more versatile library it may be better to break the routines
+that make up the library into separate modules to permit linking with routines
+of the same name that are user supplied. This will probably be done later but,
+if you need to make a split library you can always use the makesplitlib shell
+script provided here (crude but it works).
+
+Additional notes 9/5/96
+
+Changes were made to the ps_subs.f and Xwin.c to improve the linepattern
+routines, separating the fortran and C code a bit more with a fortran version
+of mskbits (bitpat) for the postscript side. The Makefile.DP was changed
+to make the DP version of Xplot11 work with xlf90 on the RS6000. This really
+should go in the new version (4.34)...HHY
+
+Version 4.34 10/30/96
+
+Changes were made to the bitpat routine in ps_subs.f to replace the iand() and ishft() calls with and() and rshift() calls that are more universal with f77 compilers, in particular f2c which is used on Linux. Note that if you have any trouble with these calls you might replace and(xxx,yyy) with iand(xxx,yyy) and rshift(xxx,n) with ishft(xxx,-n)...HHY
+
+
+Version 4.35 2/6/97
+
+Fixed logfile to work for plots that replot and then add plot items. Now
+the block size is written before each block of log data. Makefiles revised.
+Linux makefile added that includes target for shared ELF library. ...HHY
+
+
+Version 4.36 2/24/97
+
+Updated symbol definitions in sym directory and in the xxx.INC character
+font include files.
+
+
+Version 4.37 6/24/97
+
+Includes MD fix for XAXIS/YAXIS buglet of 5/24/97
+Includes HY fix for AXISADJ bug of 4/97
+Includes MD fix for gw_curs calling bug of 6/28/97
+
+HY & MD
+
+
+Version 4.38 3/8/98 HY
+
+Fixed bug for unfilled polylines that do not close and are "closed"
+automatically but incorrectly by the Sutherland-Hodgman clipper. These
+unfilled polylines are now processed by the regular line clipper by plotting
+them as separate line segments.
+
+Added double-buffering by defining pixmap and three new routines to set
+graphics destination (screen or buffer) and display buffer contents to screen.
+
+Fixed bug in fortran passing of string colornames to C interface routines
+(problem showed up for fortran's that did not terminate strings with nulls).
+
+Fixed buffering bug (initializing counter) for plot primitive overflow file.
+
+
+
+Version 4.39 5/3/98 HY
+
+Fixed bug in GETCOLOR index assignments (index hack, off by 1)
+
+Fixed C compiler warning on n = n++ in Xwin.c
+
+More cleanup of gwxcolorname2rgb in Xwin.c, added error message for color name
+truncation
+
+Put optional defines for UNDERSCORE to improve portability of fortran to C
+interface in Xwin.c for all C routine names.
+
+Added integer declarations for AND to plt_old.f for Absoft f77
+
+Added to documentation a bit...
+
+
+Version 4.39a 6/12/98
+
+Discovered bug in ancient LINE routine for lines plotted with symbols only.
+
+
+Version 4.41 7/5/98 HHY
+
+Problems with window resizing on Linux for XROTOR prompted changes to gw_subs.f
+and Xwin.c to ensure that a resized window (resized using the PLOTS call)
+properly changes size before any plotting is done in it. This is done by
+repetitively calling the window status until the resized window actually
+changes size.
+
+
+Version 4.42 12/10/98 HHY
+
+Bug found in ps_subs.f for linepatterns with longer dot patterns. Used
+nsegmax rather than nseg for writing pattern to .ps file.
+Revised Makefiles.
+
+
+Version 4.43 6/99 HHY
+
+Bug fixes. Revised Makefiles. No recollection of other changes...
+
+
+Version 4.44 10/19/00 HHY
+
+Bug fixes. Problem found in plt_color.f for error return value check from
+ired in gw_cname2rgb(colorname,ired,igreen,iblue) causing bad color table
+mapping for colors with red component=0.
+Revised ps_setup.f and plt_base.f to clean up flags for hardcopy processing.
+
+Added capability to specify nunit<0 for separate sequential "plotNNN.ps" files
+for each plot. Changed name of plot file for specified unit number to
+"plotunitNNN.ps" to keep distinct from separate plot files.
+
+Revised Notes, Doc files. Added Makefile.SP and Makefile.DP to main and
+example directories
+
+Version 4.45 01/22/01 HHY
+
+Bug fixes. Problem found in plt_base.f for handling end of postscript plot.
+ Changed gw_subs.f to put initial cursor warp to middle of window
+ into initialization code (fix from MD 02/26/01).
+ Fix to plt_util.f AXISADJ routine to correct ntics value.
+
+ New alternate Makefile.SPnew,Makefile.DPnew,config.make make
+ options that consolidate compiler settings into config.make file.
+
+
+Version 4.46 10/28/01 HHY
+
+Bug fixes. Problem found in ps_subs.f where Postscript DSC conventions
+ were not followed on %%Page line in postscript output.
+
+ Fix added to properly close each postcript plot before starting
+ a new plot.
+
+ Revised Makefiles.
+ Revised Notes file.
+
+
+Version 4.47 12 Nov 07 MD
+
+Bug fixes. Fixed the Postscript output of solid-fill polygons.
+ Previously these sometimes showed up as unfilled squares.
+ There's no change in on-screen graphics.
+
+Additions. Added SUBROUTINE VIEWR to plt_3D.f .
+ This is just a version of SUBROUTINE VIEW, with a different
+ passed-array indexing convention.
diff --git a/plotlib/Readme b/plotlib/Readme
new file mode 100644
index 0000000..637ef2c
--- /dev/null
+++ b/plotlib/Readme
@@ -0,0 +1,127 @@
+/***********************************************************************
+ Module: Readme
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+C Version 4.46 11/28/01
+
+
+Make the plotlib under Unix by:
+
+ Before anything is compiled, the config.make file needs to be changed
+ to reflect your compiler and library options. Two versions of config.make
+ are supplied (config.make.SP and config.make.DP) which contain options for
+ making single and double precision versions of the plotlib. Note that there
+ are sample declarations several architectures in the Makefile, you may need
+ to be comment or uncomment options for your machine. Note that under Unix
+ you can simply make a symbolic link to one of these config.make.xx files to
+ define config.make using:
+
+ %ln -s config.make.SP config.make
+
+ Then do the make using
+ % make
+
+
+
+Make the plotlib under Windoze:
+
+ You need Visual C and either the Compaq Visual Fortran compiler or the Intel
+ Fortran compiler. You should check the options in Makefile.NT to ensure that
+ they match your system. The supplied files match the Intel Fortran compiler.
+
+ Compile and link with command in DOS window:
+ C:\Xfoil\plotlib: cd win32
+ C:\Xfoil\plotlib\win32: nmake /f Makefile.NT
+
+ This places all the .obj files in the win32 directory and copies libPltxx.lib
+ to the parent plotlib directory.
+
+ Alternatively you could load all the files into a Visual Studio project and
+ create the library that way.
+
+
+To create plot library libPlt.a (single precision) you can normally just type:
+ % make
+ provided the file config.make matches your machine. The supplied config.make
+ matches the config.make.SP single precision options file.
+
+To create plot library libPltDP.a (double precision version):
+ Link or copy file config.make.DP to config.make and check that the options
+ match your machine. Then type:
+ % make
+
+If you don't have a file config.make.DP your alternative is to to this:
+ go into the config.make and uncomment the line
+#PLTLIB = libPltDP.a
+ set the DP flag for your compiler (uncomment appropriate line) and then:
+ % make
+
+
+To install plot library libPlt.a:
+ check the config.make and Makefile for proper install options and
+ destination for your system
+ % make install
+
+
+To create test, example and color selection programs (all optional):
+ % make test
+
+OR, go into the examples directory and do a:
+ % make
+
+if you want to put the examples in the parent library directory as well:
+ % make test
+
+To create the test and examples under Windoze:
+ C:\Xfoil\plotlib: cd examples
+ C:\Xfoil\plotlib\examples: nmake /f Makefile.NT
+
+
+
+To set black-on-white video, define Unix variable as follows:
+ % setenv XPLOT11_BACKGROUND white
+
+
+To restore white-on-black video:
+ % unsetenv XPLOT11_BACKGROUND
+
+
+
+
+See the following files for more info:
+
+ Doc Discussion, sample application calls, some routine descriptions
+ pltlib.inc Description of all global plot data (for tinkering with source)
+
+ plt_base.f Routine headers describe call lists
+ plt_font.f "
+ plt_util.f "
+ plt_color.f "
+ plt_3D.f "
+
+ sym/Readme Description of vector font generation and/or modification
+
+ Readme-examples Description of test and example programs
+ Readme.absoft Info on Absoft Linux f77 for Xplot11 compile
+
+examples/Readme-examples
+
diff --git a/plotlib/Readme.colors b/plotlib/Readme.colors
new file mode 100644
index 0000000..51fb75c
--- /dev/null
+++ b/plotlib/Readme.colors
@@ -0,0 +1,55 @@
+/***********************************************************************
+ Module: Readme.colors
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+Xplot11
+C Version 4.46 11/28/01
+
+
+This Readme file pertains to problems with colors under some window managers.
+
+The color routines used here employ shared colormaps to avoid the major screen
+color dislocations that accompany switching mouse focus with private colormaps.
+When the window manager leaves a sufficient number of color entries unallocated
+this approach works fine. Newer window managers, notably the fvwm-95 variants
+that are now supplied with the Linux distributions, appear to eat up almost
+the complete colormap for themselves with allocations for many pixmaps for
+icons. This causes heartaches when using Xplot11 as you get lots of messages
+about trouble allocating colors (and the colors are messed up in the plot).
+
+This could be avoided by allocating private colormaps but this gets into the
+color flashing problem alluded to above.
+
+For the time being I suggest using a window manager that doesn't go overboard
+allocating lots of colors. Twm works fine, I use plain old fvwm with xfm
+for my usual interface, I set up an .fvwmrc file that does not use
+too many wasteful color features (like lots of pixmap icons). This leaves
+around 200 free colors most of the time. Note that if you run something like
+xv displaying a typical color gif file you will eat up most or all the free
+colors while that application is running. Once you quit xv (or whatever) the
+colors are freed and clashes with Xplot11 disappear.
+
+If there is a sufficient problem with this I will make an option of allocating
+a private colormap when no color space is available in the shared colormap...
+
+HY
+
diff --git a/plotlib/SLAN.INC b/plotlib/SLAN.INC
new file mode 100644
index 0000000..35f70ab
--- /dev/null
+++ b/plotlib/SLAN.INC
@@ -0,0 +1,224 @@
+C Version 4.46 11/28/01
+
+ CHARACTER* 92 CHARS
+ INTEGER NODE(20, 92)
+
+ DIMENSION NODE0(20,10)
+ DIMENSION NODE1(20,10)
+ DIMENSION NODE2(20,10)
+ DIMENSION NODE3(20,10)
+ DIMENSION NODE4(20,10)
+ DIMENSION NODE5(20,10)
+ DIMENSION NODE6(20,10)
+ DIMENSION NODE7(20,10)
+ DIMENSION NODE8(20,10)
+ DIMENSION NODE9(20, 2)
+ EQUIVALENCE ( NODE(1, 1) , NODE0(1,1) )
+ EQUIVALENCE ( NODE(1, 11) , NODE1(1,1) )
+ EQUIVALENCE ( NODE(1, 21) , NODE2(1,1) )
+ EQUIVALENCE ( NODE(1, 31) , NODE3(1,1) )
+ EQUIVALENCE ( NODE(1, 41) , NODE4(1,1) )
+ EQUIVALENCE ( NODE(1, 51) , NODE5(1,1) )
+ EQUIVALENCE ( NODE(1, 61) , NODE6(1,1) )
+ EQUIVALENCE ( NODE(1, 71) , NODE7(1,1) )
+ EQUIVALENCE ( NODE(1, 81) , NODE8(1,1) )
+ EQUIVALENCE ( NODE(1, 91) , NODE9(1,1) )
+ DATA NCHARS / 92 /
+ DATA CHARS( 1: 26) / 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /
+ DATA CHARS( 27: 52) / 'abcdefghijklmnopqrstuvwxyz' /
+ DATA CHARS( 53: 78) / '0123456789,.;:`"!?@#$%&|()' /
+ DATA CHARS( 79: 92) / '[]{}<>_+-*=/^~' /
+ DATA NODE0 /
+ & 21616,12472,13183,13888,15488,16183,16472,15616,22150,16150,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,12688,15188,16184,16476,16368,15860,14856,15752,16044,
+ & 15728,15220,14216,11616,22256,14856, 0, 0, 0, 0,
+ & 26474,16183,15488,13888,13183,12472,11832,12121,12816,14416,
+ & 15121,15729, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21416,14416,15121,15832,16472,16183,15488,12488,21816,12888,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25616,11616,12688,16688,22256,15356, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,12688,16688,22256,15256, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26474,16183,15488,13888,13183,12472,11832,12121,12816,14416,
+ & 15121,15832,16150,14550, 0, 0, 0, 0, 0, 0,
+ & 21616,12688,25616,16688,22256,16256, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24888,13816,22616,15016,23688,16088, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21630,11921,12616,13916,14621,15332,16188,26788,14688, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE1 /
+ & 22688,11616,26688,12045,23458,15616, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23088,12016,16016, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21416,12488,14048,16888,15816, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,12688,15616,16688, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21832,12472,13183,13888,15488,16183,16472,15832,15121,14416,
+ & 12816,12121,11832, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,12688,15188,16183,16476,16262,15755,14750,12150, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21832,12472,13183,13888,15488,16183,16472,15832,15121,14416,
+ & 12816,12121,11832,24331,15616, 0, 0, 0, 0, 0,
+ & 21616,12688,15188,16183,16476,16262,15755,14750,12150,24750,
+ & 15816, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26576,16183,15288,14088,13183,12474,12470,12761,13656,14856,
+ & 15651,15942,15830,15121,14216,13016,12121,11830, 0, 0,
+ & 24688,13616,22488,16888, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE2 /
+ & 22688,11832,12121,12816,14416,15121,15832,16688, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22688,12582,13616,16582,16688, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22488,11952,11939,12516,13737,14046,14137,14716,15939,16352,
+ & 16888,24046,14154, 0, 0, 0, 0, 0, 0, 0,
+ & 22688,12582,15622,15616,26688,16582,11622,11616, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22688,12582,14256,16582,16688,24256,13616, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22688,16688,11616,15616,23356,15156, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22764,14964,15759,16150,15616,25942,13142,12338,11730,11728,
+ & 12020,12816,14416,15220,15728, 0, 0, 0, 0, 0,
+ & 22888,11816,22352,12860,13764,15364,16060,16252,15928,15420,
+ & 14616,13016,12220,12028, 0, 0, 0, 0, 0, 0,
+ & 26152,15860,15164,13564,12660,12152,11728,12020,12816,14416,
+ & 15220,15728, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26488,15416,25952,15660,14964,13364,12460,11952,11528,11820,
+ & 12616,14216,15020,15528, 0, 0, 0, 0, 0, 0 /
+ DATA NODE3 /
+ & 25726,15220,14416,12816,12020,11728,12152,12660,13564,15164,
+ & 15860,16152,15941,11941, 0, 0, 0, 0, 0, 0,
+ & 26872,16680,15884,14684,13880,13272,12416,22256,14856, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,11908,12704,14304,15108,15616,16364,26152,15860,15164,
+ & 13564,12660,12152,11937,12129,12925,14525,15329,15937, 0,
+ & 22688,11616,22152,12660,13564,15164,15860,16152,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22416,15216,24016,14662,13562,24277,14280,14482,14782,14980,
+ & 14977,14675,14375,14277, 0, 0, 0, 0, 0, 0,
+ & 21416,11708,12504,13704,14508,15016,15662,14462,25175,15077,
+ & 15080,15282,15582,15780,15777,15475,15175, 0, 0, 0,
+ & 22888,11816,22244,15968,23250,15816, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22316,14916,23616,14688,13788, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22164,11416,22053,12360,13064,13464,13960,14153,14560,15264,
+ & 15664,16160,16353,15816,24153,13724, 0, 0, 0, 0,
+ & 22364,11616,22152,12660,13564,15164,15860,16152,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE4 /
+ & 21728,12152,12660,13564,15164,15860,16152,15728,15220,14416,
+ & 12816,12020,11728, 0, 0, 0, 0, 0, 0, 0,
+ & 22564,11600,22352,12860,13764,15364,16060,16352,16136,15528,
+ & 14724,13124,12328,12136, 0, 0, 0, 0, 0, 0,
+ & 26164,15200,25952,15660,14964,13364,12460,11952,11736,11928,
+ & 12724,14324,15128,15736, 0, 0, 0, 0, 0, 0,
+ & 22764,12016,22552,13060,13964,15364,16060,16352, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26256,15961,15364,13364,12661,12255,12151,12345,12941,14941,
+ & 15637,15831,15726,15319,14616,12616,11919,11724, 0, 0,
+ & 23484,12528,12820,13616,14816,15620,16128,22366,14966, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22364,11728,12020,12816,14416,15220,15728,26364,15616, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22364,12154,13616,16154,16364, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22164,11840,11830,12516,13529,13936,14029,14716,15830,16140,
+ & 16564,23936,14042, 0, 0, 0, 0, 0, 0, 0,
+ & 22564,15616,26164,11616, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE5 /
+ & 22364,11937,12129,12925,14525,15329,15937,26364,15616,15108,
+ & 14304,12704,11908,11616, 0, 0, 0, 0, 0, 0,
+ & 22564,16164,11616,15616,23042,14742, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21728,12576,13084,13888,15488,16284,16576,15728,15220,14416,
+ & 12816,12020,11728, 0, 0, 0, 0, 0, 0, 0,
+ & 23578,14688,13616,22616,14616, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22576,13084,13888,15488,16284,16576,16466,15858,12336,11728,
+ & 11616,15616, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22778,13284,14088,15488,16284,16576,16469,15861,15057,15753,
+ & 16044,15728,15220,14416,12816,12020,11726,25057,13457, 0,
+ & 26088,15016,24016,16016,26340,11940,12688, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26488,12688,12257,15057,15753,16045,15728,15220,14416,12816,
+ & 12020,11728, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26578,16284,15488,13888,13084,12576,11728,12020,12816,14416,
+ & 15220,15728,16045,15753,15057,13457,12553,12045, 0, 0,
+ & 22688,16688,16579,13328,13216, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE6 /
+ & 25357,13157,12467,12576,13084,13888,15488,16284,16576,16367,
+ & 15357,16047,15728,15220,14416,12816,12020,11728,12047,13157,
+ & 21726,12020,12816,14416,15220,15728,16576,16284,15488,13888,
+ & 13084,12576,12259,12551,13247,14847,15751,16259, 0, 0,
+ & 22002,12916,13024,12224,12116,12515,12002, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22224,13024,12916,12116,12224, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22002,12515,12116,12224,13024,12916,12002,22656,12548,13348,
+ & 13456,12656, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22224,12116,12916,13024,12224,22656,12548,13348,13456,12656,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25784,16468,16384,15784, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22684,12866,13284,12684,24284,14466,14884,14284, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23124,12816,13416,13324,13124,23439,14588,13788,13439,24185,
+ & 13546, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22374,12783,13588,14788,15583,15574,15066,14260,13754,13547,
+ & 13439,23124,12816,13416,13324,13124, 0, 0, 0, 0 /
+ DATA NODE7 /
+ & 24443,13538,12743,12854,13861,14858,14443,14739,15239,15849,
+ & 16065,15375,14277,12974,12063,11547,11631,12722,13922,15227,
+ & 23678,12223,25178,13723,21859,15859,21440,15340, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25576,13376,12573,12167,12059,12254,12852,14452,15050,15345,
+ & 15237,14731,13928,11728,23116,14188, 0, 0, 0, 0,
+ & 21116,16188,22888,12484,12479,12875,13375,13779,13784,13388,
+ & 12888,24616,15020,15025,14629,14129,13725,13720,14116,14616,
+ & 25436,14623,13918,13216,12316,11521,11229,11437,12146,14056,
+ & 14764,14872,14777,14280,13680,13077,12669,12858,15116, 0,
+ & 23696,13608, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 26092,15282,14665,14350,14235,14418,14808,24515,14430,14650,
+ & 15072,15485, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23492,13882,14065,13950,13635,13018,12208,23784,13870,13650,
+ & 13229,12816, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 25794,14494,13306,14606,24694,13506, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22794,14094,12906,11606,23894,12706, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE8 /
+ & 25696,14490,13853,12750,13746,13310,14304,23509,13945,13746,
+ & 24691,14054,13853, 0, 0, 0, 0, 0, 0, 0,
+ & 23096,14090,13453,14450,13346,12910,11804,22709,13145,13346,
+ & 23890,13254,13453, 0, 0, 0, 0, 0, 0, 0,
+ & 25866,11548,15330, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21866,15548,11330, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 20600,17000, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21648,15648,23668,13628, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21648,15648, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22265,14031,22231,14065,21248,15048, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21656,15656,21640,15640, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 20608,16696, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE9 /
+ & 21634,15634,21648,15648,21662,15662, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21636,15636,21653,12059,12862,13459,13854,14452,15255,15661,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
diff --git a/plotlib/SYMB.INC b/plotlib/SYMB.INC
new file mode 100644
index 0000000..35ded37
--- /dev/null
+++ b/plotlib/SYMB.INC
@@ -0,0 +1,41 @@
+C Version 4.46 11/28/01
+
+ CHARACTER* 14 CHARS
+ INTEGER NODE(20, 14)
+
+ DIMENSION NODE0(20,10)
+ DIMENSION NODE1(20, 4)
+ EQUIVALENCE ( NODE(1, 1) , NODE0(1,1) )
+ EQUIVALENCE ( NODE(1, 11) , NODE1(1,1) )
+ DATA NCHARS / 14 /
+ DATA CHARS( 1: 14) / '0123456789ABCD' /
+ DATA NODE0 /
+ & 24848,14880,18080,18016,11616,11680,14880, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24848,14880,16480,18064,18032,16416,13216,11632,11664,13280,
+ & 14880, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24848,14886,18128,11528,14886, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24885,14811,21148,18548, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 22175,17521,22121,17575, 0, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24848,14882,18248,14814,11448,14882, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24848,14868,18168,14810,11568,14868, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21669,14848,14810,24848,18069, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24886,14848,11627,24848,18027, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 23078,16618,23018,16678,21448,18248, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
+ DATA NODE1 /
+ & 21866,17830,21830,17866,24882,14814, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21680,18016,11616,18080,11680, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 21616,18080,18016,11680,11616, 0, 0, 0, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ & 24848,14859,11559,16917,14884,12717,18159,14859, 0, 0,
+ & 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /
diff --git a/plotlib/Xwin.c b/plotlib/Xwin.c
new file mode 100644
index 0000000..1e19035
--- /dev/null
+++ b/plotlib/Xwin.c
@@ -0,0 +1,1082 @@
+/***********************************************************************
+ Module: Xwin.c
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+/***********************************************************************
+* Xplot11 C-level X11 interface
+C Version 4.46 11/28/01
+*
+* Defines graphics primitives for window management and line drawing
+* Primitives include:
+* gwxrevflag - checks environment variables for background color
+* gwxopen - initializes X display and returns size and depth of display
+* gwxwinopen - opens X plotting window with specified x,y size and position
+* gwxclear - clears plotting window
+* gwxstatus - gets current window size and location
+* gwxresize - resizes current window to specified size
+
+* gwxreset - resets plotting defaults for window
+* gwxclose - closes plotting to X display
+* gwxflush - flushes out graphics primitives in buffers
+* gwxline - plots line segment
+
+* gwxdash - sets line pattern from integer mask
+* gwxcurs - gets graphics cursor position and key pressed
+* gwxpen - sets line width in pixels
+*
+* More advanced routines beyond the original PLOT-10 requirements
+* gwxdestroy - closes plot window
+* gwxlinez - plots polyline
+* gwxpoly - plots filled polygon
+* gwxstring - plots string
+*
+* Color routines
+* gwxsetcolor - sets foreground color from color map
+* gwxsetbgcolor - sets background color from color map
+* gwxcolorname2rgb - find color components of color specified by name string
+* gwxallocrgbcolor - allocate a color specified by r,g,b components
+* gwxfreecolor - frees an allocated color from colormap
+*
+* Utility routines
+* mskbits - converts integer mask into dot/dash array
+*
+* Double-buffer routines
+* gwxdisplaybuffer - switches background buffer with foreground window
+* gwxdrawtobuffer - sets drawing to background buffer
+* gwxdrawtowindow - sets drawing to foreground window
+************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+
+
+/* Handle various system requirements for trailing underscores, or other
+ fortran-to-C interface shenanigans thru defines for routine names
+ The provided set gives the option of setting a compile flag -DUNDERSCORE
+ to include underscores on C routine name symbols */
+
+#ifdef UNDERSCORE
+
+#define MSKBITS mskbits_
+#define GWXREVFLAG gwxrevflag_
+#define GWXOPEN gwxopen_
+#define GWXWINOPEN gwxwinopen_
+#define GWXCLEAR gwxclear_
+#define GWXSTATUS gwxstatus_
+#define GWXRESIZE gwxresize_
+#define GWXRESET gwxreset_
+#define GWXCLOSE gwxclose_
+#define GWXFLUSH gwxflush_
+#define GWXLINE gwxline_
+#define GWXDASH gwxdash_
+#define GWXCURS gwxcurs_
+#define GWXPEN gwxpen_
+#define GWXDESTROY gwxdestroy_
+#define GWXLINEZ gwxlinez_
+#define GWXPOLY gwxpoly_
+#define GWXSTRING gwxstring_
+#define GWXSETCOLOR gwxsetcolor_
+#define GWXSETBGCOLOR gwxsetbgcolor_
+#define GWXCOLORNAME2RGB gwxcolorname2rgb_
+#define GWXALLOCRGBCOLOR gwxallocrgbcolor_
+#define GWXFREECOLOR gwxfreecolor_
+#define GWXDISPLAYBUFFER gwxdisplaybuffer_
+#define GWXDRAWTOBUFFER gwxdrawtobuffer_
+#define GWXDRAWTOWINDOW gwxdrawtowindow_
+
+#else
+
+#define MSKBITS mskbits
+#define GWXREVFLAG gwxrevflag
+#define GWXOPEN gwxopen
+#define GWXWINOPEN gwxwinopen
+#define GWXCLEAR gwxclear
+#define GWXSTATUS gwxstatus
+#define GWXRESIZE gwxresize
+#define GWXRESET gwxreset
+#define GWXCLOSE gwxclose
+#define GWXFLUSH gwxflush
+#define GWXLINE gwxline
+#define GWXDASH gwxdash
+#define GWXCURS gwxcurs
+#define GWXPEN gwxpen
+#define GWXDESTROY gwxdestroy
+#define GWXLINEZ gwxlinez
+#define GWXPOLY gwxpoly
+#define GWXSTRING gwxstring
+#define GWXSETCOLOR gwxsetcolor
+#define GWXSETBGCOLOR gwxsetbgcolor
+#define GWXCOLORNAME2RGB gwxcolorname2rgb
+#define GWXALLOCRGBCOLOR gwxallocrgbcolor
+#define GWXFREECOLOR gwxfreecolor
+#define GWXDISPLAYBUFFER gwxdisplaybuffer
+#define GWXDRAWTOBUFFER gwxdrawtobuffer
+#define GWXDRAWTOWINDOW gwxdrawtowindow
+
+#endif
+
+
+/* Maximum number of polyline points per polyline call,
+ increase if necessary */
+#define MAXPTS 1000
+
+#define argc 0
+#define argv (char **) NULL
+
+Display *display;
+Window window;
+Pixmap pixmap;
+Drawable buffer;
+Cursor cursor;
+GC gc;
+unsigned long fgcolor, bgcolor;
+int height, width;
+int line_width;
+int root_width, root_height, root_depth;
+int reversevideo;
+static Window parent_window;
+Colormap cmap;
+
+void MSKBITS(int*,int*,int*);
+
+
+/**********************************************************************/
+
+
+
+
+/* gwxrevflag
+ Get XPLOT11 background default from users environment
+ Parameters:
+ revflag (int*) reverse video flag (0 for white, 1 for black)
+*/
+
+void
+GWXREVFLAG(revflag)
+ int *revflag;
+{
+
+ char *bufp, *tmp;
+
+/* check environment variable XPLOT11_BACKGROUND for background color
+ XPLOT11_BACKGROUND = white gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND != white gives white on black plotting (reverse video)
+*/
+ *revflag = 1;
+ bufp = getenv("XPLOT11_BACKGROUND");
+
+/* check lowercased environment for "white" for non-reverse video */
+ if(bufp) {
+ for(tmp = bufp; *tmp; tmp++)
+ *tmp = tolower((int) *tmp);
+ *revflag = (strcmp(bufp,"white")!=0);
+ }
+}
+
+
+/* gwxopen
+ Open X window display and get size and depth of root window
+ Parameters:
+ xsize,ysize (int*) desired window size
+ idepth (int*) screen color depth (pixel depth)
+ revflag (int*) reverse video flag
+*/
+
+void
+GWXOPEN(xsizeroot, ysizeroot, depth)
+ int *xsizeroot, *ysizeroot, *depth;
+{
+
+ int revert;
+
+/* check environment variables for default background color
+ XPLOT11_BACKGROUND != black gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND = black gives white on black plotting (reverse video) */
+ GWXREVFLAG(&reversevideo);
+
+
+/* open the display */
+ display = XOpenDisplay(NULL);
+ /* XSynchronize(display,1); */
+ if (display == NULL)
+
+ {printf(" Cannot open display...aborting\n");
+ exit(1);
+ }
+
+/* get old window focus to use later for cursor positioning */
+ XGetInputFocus(display,&parent_window,&revert);
+
+
+/* get root window size and depth attributes */
+ root_width = DisplayWidth(display, DefaultScreen(display));
+ root_height = DisplayHeight(display, DefaultScreen(display));
+ root_depth = DefaultDepth(display, DefaultScreen(display));
+
+ *xsizeroot = root_width;
+ *ysizeroot = root_height;
+ *depth = root_depth;
+}
+
+
+
+/* gwxwinopen
+ Open window of specified size and position, return size and depth
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+
+void
+GWXWINOPEN(xstart, ystart, xsize, ysize)
+ int *xstart, *ystart, *xsize, *ysize;
+{
+ XSizeHints hints;
+ XSetWindowAttributes wattrib;
+ unsigned long wattrib_mask;
+ unsigned long pixel_white,pixel_black;
+ XEvent event;
+ XColor fgcurs, bgcurs;
+ Font font;
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ char *fontname = "6x12";
+
+
+/* Define a crosshair cursor */
+ Pixmap curs;
+ unsigned int curs_width=16;
+ unsigned int curs_height=16;
+ unsigned int curs_x_hot=7;
+ unsigned int curs_y_hot=8; /* Was: curs_y_hot=7 MD 3/12/96 */
+ static unsigned char curs_bits[] =
+ { 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0xff,0x7f,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00 };
+
+/* check for open display */
+ if (display == NULL)
+
+ {printf(" Cannot open display...aborting in gwxwinopen\n");
+ exit(1);
+ }
+
+ width = *xsize;
+ height = *ysize;
+/* printf("gwxwinopen size x %d y %d \n",width,height); */
+
+/* set up window attributes and create window */
+ pixel_white = WhitePixel(display, DefaultScreen(display));
+ pixel_black = BlackPixel(display, DefaultScreen(display));
+ if(reversevideo) {
+ fgcolor = pixel_white;
+ bgcolor = pixel_black;
+ }
+ else {
+ fgcolor = pixel_black;
+ bgcolor = pixel_white;
+ }
+
+
+/* define a colormap and window attributes*/
+ cmap = DefaultColormap(display, DefaultScreen(display));
+
+
+ wattrib.colormap = cmap;
+ wattrib.background_pixel = bgcolor;
+ wattrib.border_pixel = fgcolor;
+ wattrib.event_mask = ExposureMask | ConfigureNotify |
+
+ KeyPressMask | ButtonPressMask;
+ wattrib_mask = CWColormap | CWEventMask |
+
+ CWBackPixel | CWBorderPixel;
+
+/* Use backing store (if Expose events are to regen the display,
+
+ comment out these references to backing store */
+ wattrib.backing_store = WhenMapped;
+ wattrib.backing_planes = AllPlanes;
+
+ wattrib.bit_gravity = SouthWestGravity;
+
+ wattrib.win_gravity = NorthWestGravity;
+
+ wattrib_mask = wattrib_mask |
+
+ CWBitGravity | CWBackingStore |
+ CWWinGravity | CWBackingPlanes;
+
+
+/* create the window using these parameters */
+ window = XCreateWindow(display, DefaultRootWindow(display),
+ *xstart, *ystart, width, height, 2, root_depth,
+ InputOutput, CopyFromParent,
+ wattrib_mask, &wattrib);
+
+/* Set pixmap initally pointing to NULL to indicate it is yet not created
+ to do double buffering */
+ pixmap = (Pixmap) NULL;
+
+/* set initial drawing destination to foreground window */
+ buffer = window;
+
+
+/* set up interaction with the window manager */
+ hints.flags = USPosition | USSize;
+ hints.width = width;
+ hints.height = height;
+ hints.x = *xstart;
+ hints.y = *ystart;
+ XSetNormalHints(display, window, &hints);
+ XSetStandardProperties(display, window, "Xplot11\0", "Xplot11\0",
+ None, argv, argc, &hints);
+
+/* set up cursor */
+ fgcurs.pixel = fgcolor;
+ bgcurs.pixel = bgcolor;
+ XQueryColor(display,cmap,&fgcurs);
+ XQueryColor(display,cmap,&bgcurs);
+
+ if((curs=XCreateBitmapFromData(display,window,(char*)curs_bits,
+ curs_width,curs_height))!= None)
+ { cursor = XCreatePixmapCursor(display,curs,curs,
+ &fgcurs,&bgcurs,curs_x_hot,curs_y_hot); }
+ else
+ { cursor = XCreateFontCursor(display,XC_draft_small); };
+
+ XDefineCursor(display, window, cursor);
+ XRecolorCursor(display, cursor, &fgcurs, &bgcurs);
+
+
+/* create the gc */
+ line_width = 0;
+ gcv.function = GXcopy;
+ gcv.foreground = fgcolor;
+ gcv.background = bgcolor;
+ gcv.line_width = line_width;
+ gcv.line_style = LineSolid;
+ gcv.cap_style = CapButt;
+ gcv.fill_style = FillSolid;
+ gcv.join_style = JoinMiter;
+
+ gcv_mask = GCFunction | GCForeground | GCBackground | GCLineWidth |
+
+ GCLineStyle | GCCapStyle | GCFillStyle | GCJoinStyle;
+
+ gc = XCreateGC(display, window, gcv_mask, &gcv);
+
+/* load the font */
+ font = XLoadFont(display, fontname);
+ XSetFont(display, gc, font);
+
+/* map the window and wait for an expose event to proceed */
+ XMapWindow(display, window);
+ while(1)
+ { XNextEvent(display, &event);
+ if(event.type==Expose) break; }
+
+/* clear the window */
+/* XClearWindow(display,window); */
+}
+
+
+/* gwxclear
+ Clear current plot window
+ Parameters: None
+*/
+void
+GWXCLEAR()
+{
+ if(buffer == window)
+ { XClearWindow(display,window);
+/* printf("clearing window\n"); */
+ }
+ else
+ { XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, buffer, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+/* printf("clearing buffer\n"); */
+ };
+}
+
+
+
+/* gwxstatus
+ Return current window status (position, size)
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+void
+GWXSTATUS(xstart, ystart, xsize, ysize)
+ int *xstart, *ystart, *xsize, *ysize;
+{
+ XWindowAttributes xwa;
+ Window w_root, w_parent, *w_children;
+ unsigned int nchildren;
+
+ XGetWindowAttributes(display, window, &xwa);
+ *xsize = xwa.width;
+ *ysize = xwa.height;
+ *xstart = xwa.x;
+ *ystart = xwa.y;
+/* printf("gwxstatus size x %d y %d \n",*xsize,*ysize); */
+
+/* Position of window is meaningless under window manager, which remaps each
+ window under a new parent. Find parent, if not root, get the parent's
+ position */
+ if(XQueryTree(display,window,&w_root,&w_parent,&w_children,&nchildren))
+ {
+ XFree((void*) w_children); /* Free the list of child windows */
+ if(w_parent!=DefaultRootWindow(display))
+
+ { XGetWindowAttributes(display, w_parent, &xwa);
+ *xstart = xwa.x;
+ *ystart = xwa.y;
+ }
+
+ }
+}
+
+
+/* gwxclose
+ Close current windows, buffers and display
+ Parameters: None
+*/
+void
+GWXCLOSE()
+{
+
+ XFreeCursor(display, cursor);
+ XFreeGC(display, gc);
+ if(pixmap != (Pixmap) NULL) XFreePixmap(display, pixmap);
+ XCloseDisplay(display);
+}
+
+
+/* gwxdestroy
+ Close current window and display
+ Parameters: None
+*/
+void
+GWXDESTROY()
+{ XDestroyWindow(display,window);
+}
+
+
+/* gwxflush
+ Flush all pending graphics requests to the screen
+ Parameters: None
+*/
+void
+GWXFLUSH()
+{ if(buffer == pixmap)
+ { XCopyArea(display, pixmap, window, gc, 0, 0, width, height, 0, 0);
+/* printf("copying pixmap to window x %d y %d\n",width,height); */
+ };
+
+ XFlush(display);
+}
+
+
+/* gwxdisplaybuffer
+ Switches background buffer onto foreground window, displaying accumulated
+ graphics
+ Parameters: None
+*/
+void
+GWXDISPLAYBUFFER()
+{ GWXFLUSH();
+}
+
+
+/* gwxdrawtobuffer
+ Switches graphics to draw to the background buffer
+ Parameters: None
+*/
+void
+GWXDRAWTOBUFFER()
+{
+/* create and clear the pixmap */
+ if(pixmap == (Pixmap) NULL)
+ { pixmap = XCreatePixmap(display, window, width, height, root_depth);
+ XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, pixmap, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+ }
+
+/* point graphics to the pixmap */
+ buffer = pixmap;
+/* printf("called gwxdrawtobuffer\n"); */
+}
+
+/* gwxdrawtowindow
+ Switches graphics to draw to the foreground window
+ Parameters: None
+*/
+void
+GWXDRAWTOWINDOW()
+{ buffer = window;
+/* printf("called gwxdrawtowindow\n"); */
+}
+
+
+/* gwxline
+ Draw line from x1,y1 to x2,y2
+ Parameters:
+ x1,y1 (int*) starting position for line
+ x2,y2 (int*) ending position for line
+*/
+void
+GWXLINE(x1, y1, x2, y2)
+ int *x1, *y1, *x2, *y2;
+{ XDrawLine(display, buffer, gc, *x1, *y1, *x2, *y2);
+}
+
+
+/* gwxresize
+ Resize screen window to x width, y height
+ Parameters:
+ x (int*) new width
+ y (int*) new height
+*/
+void
+GWXRESIZE(x, y)
+ int *x, *y;
+{ unsigned int xsiz, ysiz;
+ unsigned int xsize, ysize, xstart, ystart;
+ int i;
+ XEvent event;
+ long event_mask;
+
+/* printf("called gwxresize\n"); */
+ event_mask = ExposureMask | ResizeRedirectMask;
+
+
+/* Clear the window events before resizing to setup for post resize Expose */
+ while(XPending(display))
+ XNextEvent(display, &event);
+
+ xsiz = *x;
+ ysiz = *y;
+/* printf("gwxresize to x %d y %d\n",xsiz,ysiz); */
+ XResizeWindow(display, window, xsiz, ysiz);
+ XMapRaised(display, window);
+ XFlush(display);
+
+/* check for window size change */
+ i = 0;
+ while(1)
+ { GWXSTATUS(&xstart, &ystart, &xsize, &ysize);
+ if( (xsize==xsiz) && (ysize==ysiz) )
+ break;
+/* printf("resize status check count = %d\n",i++); */
+ }
+
+/* update window size */
+ width = xsiz;
+ height = ysiz;
+/* destroy old back buffer pixmap and create new one in proper size */
+ if(pixmap != (Pixmap) NULL)
+ { XFreePixmap(display, pixmap);
+/* printf("create new pixmap sized to x %d y %d\n",width,height); */
+ pixmap = XCreatePixmap(display, window, width, height, root_depth);
+ if(buffer != window) buffer = pixmap;
+/* clear the pixmap */
+ XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, pixmap, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+ }
+
+
+/* Raise the window and wait for an expose event to do anything in it */
+/* while(1)
+ { XWindowEvent(display, window, event_mask, &event);
+ switch(event.type) {
+ case Expose:
+ printf("Expose event \n");
+ break;
+ case NoExpose:
+ printf("NoExpose event \n");
+ break;
+ case ResizeRequest:
+ printf("resizerequest event \n");
+ break;
+ }
+ } */
+}
+
+
+/* gwxlinez
+ Draw polyline on display window in current color and pen
+ Parameters:
+ ix (int*) array of x coordinates on polyline
+ iy (int*) array of y coordinates on polyline
+ n (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void
+GWXLINEZ(ix, iy, n)
+ int *n, *ix, *iy;
+{ XPoint points[MAXPTS];
+ int i;
+
+ if (*n > MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxlinez: Too many points in polyline\n");
+ printf("Xplot11.gwxlinez: Too many points in polyline\n");
+ return;
+ }
+
+ for(i=0; i < *n; i++) {
+ points[i].x = ix[i];
+ points[i].y = iy[i];
+/* printf("gwxlinez x %d y %d \n",ix[i],iy[i]); */
+ }
+ XDrawLines(display, buffer, gc, points, *n, CoordModeOrigin);
+}
+
+
+/* gwxpoly
+ Draw filled polyline on display window in current color and pen
+ Parameters:
+ x_coord (int*) array of x coordinates on polyline
+ y_coord (int*) array of y coordinates on polyline
+ n_coord (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void
+GWXPOLY(x_coord, y_coord, n_coord)
+ int *x_coord, *y_coord, *n_coord;
+{ XPoint points[MAXPTS];
+ int i,n;
+
+ if (*n_coord >= MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxpoly: Too many points in polyline\n");
+ printf("Xplot11.gwxpoly: Too many points in polyline\n");
+ return;
+ }
+
+ for (i=0; i < *n_coord; i++) {
+ points[i].x = x_coord[i];
+ points[i].y = y_coord[i];
+
+ }
+ n = *n_coord;
+/* if the polyline is not closed, duplicate first point to ensure closed
+
+ perimeter (speeds up X graphics drastically) */
+ if ( (points[n-1].x != points[0].x) ||
+
+ (points[n-1].y != points[0].y) ) {
+ points[n].x = points[0].x;
+ points[n].y = points[0].y;
+ n++;
+ }
+
+ XFillPolygon(display, buffer, gc, points, n,
+ Nonconvex, CoordModeOrigin);
+}
+
+
+/* gwxsetcolor
+ Set foreground color to pixel value
+ Parameters:
+ pixel (int*) pixel value (mapped in colormap)
+*/
+void
+GWXSETCOLOR(pixel)
+ int *pixel;
+{ fgcolor = *pixel;
+ XSetForeground(display, gc, fgcolor);
+}
+
+
+
+/* gwxsetbgcolor
+ Set background color to pixel value
+ Parameters:
+ pixel (int*) pixel value (mapped in colormap)
+*/
+void
+GWXSETBGCOLOR(pixel)
+ int *pixel;
+{ bgcolor = *pixel;
+ XSetForeground(display, gc, bgcolor);
+}
+
+
+
+/* gwxcolorname2rgb
+ Find r,g,b components for color specified by name string
+ Parameters:
+ red,grn,blu (int*) output color components (0-255)
+ nc (int*) string length (# of chars)
+ colorname (char*) string containing name of valid color
+ Note: color names are not case sensitive
+ len (int) fortran appended string length (passed by value)
+
+ Valid color names are any color name that is known to X11 color database
+ Examples are "Black","White","Yellow","Orange","Red","Green",
+ "Cyan","Blue","Magenta", "ivory", etc.
+*/
+void
+GWXCOLORNAME2RGB(int *red, int *grn, int *blu,
+ int *nc, char *colorname, int len)
+{
+ XColor color_def;
+ char cname[32];
+ int n;
+
+ n = *nc;
+
+ /* copy string to avoid overwriting possibly static input string
+ Note that string length is explicitly passed to avoid compatibility
+ problems with by fortran character arg length */
+
+ if(n>31) {
+ n = 31;
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",cname);
+ }
+ strncpy(cname,colorname,n);
+ cname[n] = '\0';
+
+ *red = -1;
+ *grn = -1;
+ *blu = -1;
+ if (!XParseColor(display, cmap,cname,&color_def)) {
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' not found\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' not found\n",cname);
+ return;
+ }
+ *red = color_def.red /256;
+ *grn = color_def.green/256;
+ *blu = color_def.blue /256;
+}
+
+
+/* gwxallocrgbcolor
+ Allocate a color in colormap specified by r,g,b components
+
+ Parameters:
+ red,grn,blu (int*) input color components (0-255)
+ ic (int*) returned color index or pixel value
+*/
+void
+GWXALLOCRGBCOLOR(int *red, int *grn, int *blu, int *ic)
+{
+ XColor color_def;
+
+ color_def.red = *red * 256;
+ color_def.green = *grn * 256;
+ color_def.blue = *blu * 256;
+ *ic = -1;
+
+ if (!XAllocColor (display, cmap, &color_def)) {
+ /* fprintf (stderr,"Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ printf ("Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ */
+ return;
+ }
+ *ic = color_def.pixel;
+}
+
+
+/* gwxfreecolor
+ Free a color from color map
+ Parameters:
+ pix (int*) pixel in colormap
+*/
+void
+GWXFREECOLOR(int *pix)
+{ unsigned long lpix;
+
+ lpix = *pix;
+ XFreeColors(display,cmap,&lpix,1,0L);
+}
+
+
+/* gwxstring
+ Draw string on display at specified position in current font and color
+ Parameters:
+ x (int*) array of x coordinates on polyline
+ y (int*) array of y coordinates on polyline
+ string (char*) character string
+ length (int*) length of string
+
+*/
+void
+GWXSTRING(x, y, string, length)
+ int *x, *y, *length;
+ char *string;
+{ XDrawString(display, buffer, gc, *x, *y, string, *length);
+}
+
+
+
+/* gwxdash
+ Set line drawing pattern to mask pattern
+ Parameters:
+ mask (int*) integer mask value (bits set pen pattern for lines)
+*/
+void
+GWXDASH(int* lmask)
+{
+char dashes[16];
+int idash[16], nchrs, ioff, i;
+
+ if(*lmask==0)
+
+ XSetLineAttributes(display, gc, line_width,
+
+ LineSolid, CapButt, JoinMiter);
+ else if(*lmask==-1)
+ XSetLineAttributes(display, gc, line_width,
+
+ LineSolid, CapButt, JoinMiter);
+ else
+
+ {
+ (void) MSKBITS(lmask,idash,&nchrs);
+ for(i=1;i<=nchrs;i++) dashes[i-1]=idash[i-1];
+/* for(i=1;i<=nchrs;i++) printf("%d dashes %d\n",i,dashes[i-1]); */
+
+ ioff = 0;
+ XSetDashes(display, gc, ioff, dashes, nchrs);
+/* use LineOnOffDash to only write "on" pixels in dashed lines (fg only) */
+/* use LineDoubleDash to overwrite all pixels in dashed lines (fg AND bg) */
+ XSetLineAttributes(display, gc, line_width,
+
+ LineOnOffDash, CapButt, JoinMiter);
+ }
+}
+
+
+
+/* gwxreset
+ Reset graphics context to default
+ Parameters: None
+*/
+void
+GWXRESET()
+{
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ line_width = 0;
+ gcv.function = GXcopy;
+ gcv.foreground = fgcolor;
+ gcv.background = bgcolor;
+ gcv.line_width = line_width;
+ gcv.line_style = LineSolid;
+ gcv.cap_style = CapButt;
+ gcv.fill_style = FillSolid;
+ gcv.join_style = JoinMiter;
+ gcv_mask = GCFunction | GCForeground | GCBackground | GCLineWidth |
+ GCLineStyle | GCCapStyle | GCFillStyle | GCJoinStyle;
+ XChangeGC(display, gc, gcv_mask, &gcv);
+
+}
+
+
+
+/* gwxpen
+ Set pen width for line drawing
+ Parameters:
+ ipen (int*) integer pen width
+*/
+void
+GWXPEN(int* ipen)
+{
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ line_width = *ipen;
+ gcv.line_width = line_width;
+ gcv.cap_style = CapButt;
+ gcv.join_style = JoinMiter;
+ gcv_mask = GCLineWidth | GCCapStyle | GCJoinStyle;
+ XChangeGC(display, gc, gcv_mask, &gcv);
+}
+
+
+/* gwxcurs
+ Get cursor position and key pressed (waits for keypress or buttonpress)
+ Parameters:
+ x (int*) output cursor x coordinate
+ y (int*) output cursor y coordinate
+ state (int*) key pressed
+
+*/
+void
+GWXCURS(x, y, state)
+ int *x, *y, *state;
+{ XEvent report;
+ KeySym key;
+ int count,buffer_len,last_event;
+ long event_mask;
+ char buffer[2];
+/* int idev = 1; */
+
+/* XRaiseWindow(display,window); */
+ /* XSetInputFocus(display,window,RevertToNone,CurrentTime); */
+/* warp to passed-in x,y (typ. previous cursor location) */
+/* printf("GWXCURS input x %d y %d\n",*x,*y); */
+ XWarpPointer(display, None, window, 0, 0, 0, 0, *x, *y);
+
+ event_mask = ExposureMask | ConfigureNotify |
+ KeyPressMask | ButtonPressMask;
+
+/* clear any pending events */
+
+ while(XPending(display))
+ XNextEvent(display, &report);
+
+ *state = 0;
+ last_event = 0;
+ while(! *state)
+
+ { XWindowEvent(display, window, event_mask, &report);
+ switch(report.type) {
+ case Expose:
+ if(last_event != Expose)
+
+ { /* replot_(&idev); */
+ XSetInputFocus(display,window,RevertToNone,CurrentTime); }
+ break;
+ case ConfigureNotify:
+ break;
+ case ButtonPress:
+ *state = report.xbutton.button;
+ *x = report.xbutton.x;
+ *y = report.xbutton.y;
+ break;
+ case KeyPress:
+ *x = report.xkey.x;
+ *y = report.xkey.y;
+ buffer_len = 1;
+ count = XLookupString(&report.xkey, buffer, buffer_len, &key, NULL);
+ /*
+ if (count == 0) printf("gwxcurs: Zero length string returned.\n");
+ */
+ *state = key;
+ break;
+ }
+ last_event = report.type;
+ }
+/* XRaiseWindow(display,parent_window); */
+/* XSetInputFocus(display,parent_window,RevertToNone,CurrentTime); */
+ }
+
+
+
+/* mskbits
+ Utility routine to convert lower 16 bits of pattern mask
+ into pattern array of on/off bit lengths. The 16
+ bits of ipat can contain up to 16 on/off bit lengths.
+ i.e. 0XAAAAAAA produces ibits=(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
+ i.e. 0XCCCCCCC produces ibits=(2,2,2,2,2,2,2,2)
+ The output pattern stored in integer array ibits=(#on,#off,#on,#off,etc.)
+ Parameters:
+ mask (int*) input mask
+ ibits (int*) output pattern string (#on, #off...)
+ ndash (int*) number of entries in pattern array
+*/
+void
+MSKBITS(int* mask, int* ibits, int* ndash)
+{
+#define BITSINMASK 16 /* use only lower 16 bits of mask word */
+
+int i,ic,ibit,ibitold;
+int nbits, nshft;
+unsigned short lmask;
+
+/* shift mask until low bit is 1, filling high bits with 0's */
+ lmask = *mask;
+ nshft = ibitold = 0;
+
+ if(lmask!=0) {
+ while (!(ibitold = (lmask & 0x01)))
+ lmask >>= 1;
+ nshft++;
+ }
+/* if no 1 bits just exit with no dashes set */
+ if(ibitold==0) {
+ *ndash = 0;
+ exit;
+ }
+
+/* cycle through the lower 'length-nshft' bits
+ checking for number of contiguous same bits,
+ store into ibits array */
+ nbits = ic = ibit = 0;
+
+ for (i=0; i<(BITSINMASK-nshft); ++i) {
+
+ ibit=(lmask & 0x01);
+
+ if(ibit != ibitold) {
+ ibits[ic++] = nbits;
+ nbits = 0;
+ }
+
+ ibitold = ibit;
+ nbits++;
+
+ lmask >>= 1;
+ }
+
+/* add bits at end of shifted bits including any initial shift
+ to find the first 1 in the low bit */
+ if(ibit==1) {
+
+ ibits[ic++] = nbits;
+ if(nshft>0)
+ ibits[ic++] = nshft;
+
+ }
+ else
+ ibits[ic++] = nbits + nshft;
+
+ *ndash = ic;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/Xwin1.c b/plotlib/Xwin1.c
new file mode 100644
index 0000000..50a4977
--- /dev/null
+++ b/plotlib/Xwin1.c
@@ -0,0 +1,1078 @@
+/***********************************************************************
+ Module: Xwin.c
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+/***********************************************************************
+* Xplot11 C-level X11 interface
+C Version 4.46 11/28/01
+*
+* Defines graphics primitives for window management and line drawing
+* Primitives include:
+* gwxrevflag - checks environment variables for background color
+* gwxopen - initializes X display and returns size and depth of display
+* gwxwinopen - opens X plotting window with specified x,y size and position
+* gwxclear - clears plotting window
+* gwxstatus - gets current window size and location
+* gwxresize - resizes current window to specified size
+
+* gwxreset - resets plotting defaults for window
+* gwxclose - closes plotting to X display
+* gwxflush - flushes out graphics primitives in buffers
+* gwxline - plots line segment
+
+* gwxdash - sets line pattern from integer mask
+* gwxcurs - gets graphics cursor position and key pressed
+* gwxpen - sets line width in pixels
+*
+* More advanced routines beyond the original PLOT-10 requirements
+* gwxdestroy - closes plot window
+* gwxlinez - plots polyline
+* gwxpoly - plots filled polygon
+* gwxstring - plots string
+*
+* Color routines
+* gwxsetcolor - sets foreground color from color map
+* gwxsetbgcolor - sets background color from color map
+* gwxcolorname2rgb - find color components of color specified by name string
+* gwxallocrgbcolor - allocate a color specified by r,g,b components
+* gwxfreecolor - frees an allocated color from colormap
+*
+* Utility routines
+* mskbits - converts integer mask into dot/dash array
+*
+* Double-buffer routines
+* gwxdisplaybuffer - switches background buffer with foreground window
+* gwxdrawtobuffer - sets drawing to background buffer
+* gwxdrawtowindow - sets drawing to foreground window
+************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+
+
+/* Handle various system requirements for trailing underscores, or other
+ fortran-to-C interface shenanigans thru defines for routine names
+ The provided set gives the option of setting a compile flag -DUNDERSCORE
+ to include underscores on C routine name symbols */
+
+#ifdef UNDERSCORE
+
+#define MSKBITS mskbits_
+#define GWXREVFLAG gwxrevflag_
+#define GWXOPEN gwxopen_
+#define GWXWINOPEN gwxwinopen_
+#define GWXCLEAR gwxclear_
+#define GWXSTATUS gwxstatus_
+#define GWXRESIZE gwxresize_
+#define GWXRESET gwxreset_
+#define GWXCLOSE gwxclose_
+#define GWXFLUSH gwxflush_
+#define GWXLINE gwxline_
+#define GWXDASH gwxdash_
+#define GWXCURS gwxcurs_
+#define GWXPEN gwxpen_
+#define GWXDESTROY gwxdestroy_
+#define GWXLINEZ gwxlinez_
+#define GWXPOLY gwxpoly_
+#define GWXSTRING gwxstring_
+#define GWXSETCOLOR gwxsetcolor_
+#define GWXSETBGCOLOR gwxsetbgcolor_
+#define GWXCOLORNAME2RGB gwxcolorname2rgb_
+#define GWXALLOCRGBCOLOR gwxallocrgbcolor_
+#define GWXFREECOLOR gwxfreecolor_
+#define GWXDISPLAYBUFFER gwxdisplaybuffer_
+#define GWXDRAWTOBUFFER gwxdrawtobuffer_
+#define GWXDRAWTOWINDOW gwxdrawtowindow_
+
+#else
+
+#define MSKBITS mskbits
+#define GWXREVFLAG gwxrevflag
+#define GWXOPEN gwxopen
+#define GWXWINOPEN gwxwinopen
+#define GWXCLEAR gwxclear
+#define GWXSTATUS gwxstatus
+#define GWXRESIZE gwxresize
+#define GWXRESET gwxreset
+#define GWXCLOSE gwxclose
+#define GWXFLUSH gwxflush
+#define GWXLINE gwxline
+#define GWXDASH gwxdash
+#define GWXCURS gwxcurs
+#define GWXPEN gwxpen
+#define GWXDESTROY gwxdestroy
+#define GWXLINEZ gwxlinez
+#define GWXPOLY gwxpoly
+#define GWXSTRING gwxstring
+#define GWXSETCOLOR gwxsetcolor
+#define GWXSETBGCOLOR gwxsetbgcolor
+#define GWXCOLORNAME2RGB gwxcolorname2rgb
+#define GWXALLOCRGBCOLOR gwxallocrgbcolor
+#define GWXFREECOLOR gwxfreecolor
+#define GWXDISPLAYBUFFER gwxdisplaybuffer
+#define GWXDRAWTOBUFFER gwxdrawtobuffer
+#define GWXDRAWTOWINDOW gwxdrawtowindow
+
+#endif
+
+
+/* Maximum number of polyline points per polyline call,
+ increase if necessary */
+#define MAXPTS 1000
+
+#define argc 0
+#define argv (char **) NULL
+
+Display *display;
+Window window;
+Pixmap pixmap;
+Drawable buffer;
+Cursor cursor;
+GC gc;
+unsigned long fgcolor, bgcolor;
+int height, width;
+int line_width;
+int root_width, root_height, root_depth;
+int reversevideo;
+static Window parent_window;
+Colormap cmap;
+
+void MSKBITS(int*,int*,int*);
+
+
+/**********************************************************************/
+
+
+
+
+/* gwxrevflag
+ Get XPLOT11 background default from users environment
+ Parameters:
+ revflag (int*) reverse video flag (0 for white, 1 for black)
+*/
+
+void
+GWXREVFLAG(revflag)
+ int *revflag;
+{
+
+ char *bufp, *tmp;
+
+/* check environment variable XPLOT11_BACKGROUND for background color
+ XPLOT11_BACKGROUND = white gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND != white gives white on black plotting (reverse video)
+*/
+ *revflag = 1;
+ bufp = getenv("XPLOT11_BACKGROUND");
+
+/* check lowercased environment for "white" for non-reverse video */
+ if(bufp) {
+ for(tmp = bufp; *tmp; tmp++)
+ *tmp = tolower(*tmp);
+ *revflag = (strcmp(bufp,"white")!=0);
+ }
+}
+
+
+/* gwxopen
+ Open X window display and get size and depth of root window
+ Parameters:
+ xsize,ysize (int*) desired window size
+ idepth (int*) screen color depth (pixel depth)
+ revflag (int*) reverse video flag
+*/
+
+void
+GWXOPEN(xsizeroot, ysizeroot, depth)
+ int *xsizeroot, *ysizeroot, *depth;
+{
+
+ int revert,i;
+
+/* check environment variables for default background color
+ XPLOT11_BACKGROUND != black gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND = black gives white on black plotting (reverse video) */
+ GWXREVFLAG(&reversevideo);
+
+
+/* open the display */
+ display = XOpenDisplay(NULL);
+ /* XSynchronize(display,1); */
+ if (display == NULL)
+
+ {printf(" Cannot open display...aborting\n");
+ exit(1);
+ }
+
+/* get old window focus to use later for cursor positioning */
+ XGetInputFocus(display,&parent_window,&revert);
+
+
+/* get root window size and depth attributes */
+ root_width = DisplayWidth(display, DefaultScreen(display));
+ root_height = DisplayHeight(display, DefaultScreen(display));
+ root_depth = DefaultDepth(display, DefaultScreen(display));
+
+ *xsizeroot = root_width;
+ *ysizeroot = root_height;
+ *depth = root_depth;
+}
+
+
+
+/* gwxwinopen
+ Open window of specified size and position, return size and depth
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+
+void
+GWXWINOPEN(xstart, ystart, xsize, ysize)
+ int *xstart, *ystart, *xsize, *ysize;
+{
+ XSizeHints hints;
+ XSetWindowAttributes wattrib;
+ unsigned long wattrib_mask;
+ int x,y,win_x,win_y;
+ unsigned long pixel_white,pixel_black;
+ XEvent event;
+ XColor fgcurs, bgcurs;
+ Font font;
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ char *fontname = "6x12";
+
+
+/* Define a crosshair cursor */
+ Pixmap curs;
+ unsigned int curs_width=16;
+ unsigned int curs_height=16;
+ unsigned int curs_x_hot=7;
+ unsigned int curs_y_hot=8; /* Was: curs_y_hot=7 MD 3/12/96 */
+ static unsigned char curs_bits[] =
+ { 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0xff,0x7f,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00 };
+
+/* check for open display */
+ if (display == NULL)
+
+ {printf(" Cannot open display...aborting in gwxwinopen\n");
+ exit(1);
+ }
+
+ width = *xsize;
+ height = *ysize;
+/* printf("gwxwinopen size x %d y %d \n",width,height); */
+
+/* set up window attributes and create window */
+ pixel_white = WhitePixel(display, DefaultScreen(display));
+ pixel_black = BlackPixel(display, DefaultScreen(display));
+ if(reversevideo) {
+ fgcolor = pixel_white;
+ bgcolor = pixel_black;
+ }
+ else {
+ fgcolor = pixel_black;
+ bgcolor = pixel_white;
+ }
+
+
+/* define a colormap and window attributes*/
+ cmap = DefaultColormap(display, DefaultScreen(display));
+
+
+ wattrib.colormap = cmap;
+ wattrib.background_pixel = bgcolor;
+ wattrib.border_pixel = fgcolor;
+ wattrib.event_mask = ExposureMask | ConfigureNotify |
+
+ KeyPressMask | ButtonPressMask;
+ wattrib_mask = CWColormap | CWEventMask |
+
+ CWBackPixel | CWBorderPixel;
+
+/* Use backing store (if Expose events are to regen the display,
+
+ comment out these references to backing store */
+ wattrib.backing_store = WhenMapped;
+ wattrib.backing_planes = AllPlanes;
+
+ wattrib.bit_gravity = SouthWestGravity;
+
+ wattrib.win_gravity = NorthWestGravity;
+
+ wattrib_mask = wattrib_mask |
+
+ CWBitGravity | CWBackingStore |
+ CWWinGravity | CWBackingPlanes;
+
+
+/* create the window using these parameters */
+ window = XCreateWindow(display, DefaultRootWindow(display),
+ *xstart, *ystart, width, height, 2, root_depth,
+ InputOutput, CopyFromParent,
+ wattrib_mask, &wattrib);
+
+/* Set pixmap initally pointing to NULL to indicate it is yet not created
+ to do double buffering */
+ pixmap = (Pixmap) NULL;
+
+/* set initial drawing destination to foreground window */
+ buffer = window;
+
+
+/* set up interaction with the window manager */
+ hints.flags = USPosition | USSize;
+ hints.width = width;
+ hints.height = height;
+ hints.x = *xstart;
+ hints.y = *ystart;
+ XSetNormalHints(display, window, &hints);
+ XSetStandardProperties(display, window, "Xplot11\0", "Xplot11\0",
+ None, argv, argc, &hints);
+
+/* set up cursor */
+ fgcurs.pixel = fgcolor;
+ bgcurs.pixel = bgcolor;
+ XQueryColor(display,cmap,&fgcurs);
+ XQueryColor(display,cmap,&bgcurs);
+
+ if((curs=XCreateBitmapFromData(display,window,(char*) curs_bits,
+ curs_width,curs_height))!= None)
+ { cursor = XCreatePixmapCursor(display,curs,curs,
+ &fgcurs,&bgcurs,curs_x_hot,curs_y_hot); }
+ else
+ { cursor = XCreateFontCursor(display,XC_draft_small); };
+
+ XDefineCursor(display, window, cursor);
+ XRecolorCursor(display, cursor, &fgcurs, &bgcurs);
+
+
+/* create the gc */
+ line_width = 0;
+ gcv.function = GXcopy;
+ gcv.foreground = fgcolor;
+ gcv.background = bgcolor;
+ gcv.line_width = line_width;
+ gcv.line_style = LineSolid;
+ gcv.cap_style = CapButt;
+ gcv.fill_style = FillSolid;
+ gcv.join_style = JoinMiter;
+
+ gcv_mask = GCFunction | GCForeground | GCBackground | GCLineWidth |
+
+ GCLineStyle | GCCapStyle | GCFillStyle | GCJoinStyle;
+
+ gc = XCreateGC(display, window, gcv_mask, &gcv);
+
+/* load the font */
+ font = XLoadFont(display, fontname);
+ XSetFont(display, gc, font);
+
+/* map the window and wait for an expose event to proceed */
+ XMapWindow(display, window);
+ while(1)
+ { XNextEvent(display, &event);
+ if(event.type==Expose) break; }
+
+/* clear the window */
+/* XClearWindow(display,window); */
+}
+
+
+/* gwxclear
+ Clear current plot window
+ Parameters: None
+*/
+void
+GWXCLEAR()
+{
+ if(buffer == window)
+ { XClearWindow(display,window);
+/* printf("clearing window\n"); */
+ }
+ else
+ { XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, buffer, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+/* printf("clearing buffer\n"); */
+ };
+}
+
+
+
+/* gwxstatus
+ Return current window status (position, size)
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+void
+GWXSTATUS(xstart, ystart, xsize, ysize)
+ int *xstart, *ystart, *xsize, *ysize;
+{
+ XWindowAttributes xwa;
+ Window w_root, w_parent, *w_children;
+ unsigned int nchildren;
+
+ XGetWindowAttributes(display, window, &xwa);
+ *xsize = xwa.width;
+ *ysize = xwa.height;
+ *xstart = xwa.x;
+ *ystart = xwa.y;
+/* printf("gwxstatus size x %d y %d \n",*xsize,*ysize); */
+
+/* Position of window is meaningless under window manager, which remaps each
+ window under a new parent. Find parent, if not root, get the parent's
+ position */
+ if(XQueryTree(display,window,&w_root,&w_parent,&w_children,&nchildren))
+ {
+ XFree((void*) w_children); /* Free the list of child windows */
+ if(w_parent!=DefaultRootWindow(display))
+
+ { XGetWindowAttributes(display, w_parent, &xwa);
+ *xstart = xwa.x;
+ *ystart = xwa.y;
+ }
+
+ }
+}
+
+
+/* gwxclose
+ Close current windows, buffers and display
+ Parameters: None
+*/
+void
+GWXCLOSE()
+{
+
+ XFreeCursor(display, cursor);
+ XFreeGC(display, gc);
+ if(pixmap != (Pixmap) NULL) XFreePixmap(display, pixmap);
+ XCloseDisplay(display);
+}
+
+
+/* gwxdestroy
+ Close current window and display
+ Parameters: None
+*/
+void
+GWXDESTROY()
+{ XDestroyWindow(display,window);
+}
+
+
+/* gwxflush
+ Flush all pending graphics requests to the screen
+ Parameters: None
+*/
+void
+GWXFLUSH()
+{ if(buffer == pixmap)
+ { XCopyArea(display, pixmap, window, gc, 0, 0, width, height, 0, 0);
+/* printf("copying pixmap to window x %d y %d\n",width,height); */
+ };
+
+ XFlush(display);
+}
+
+
+/* gwxdisplaybuffer
+ Switches background buffer onto foreground window, displaying accumulated
+ graphics
+ Parameters: None
+*/
+void
+GWXDISPLAYBUFFER()
+{ GWXFLUSH();
+}
+
+
+/* gwxdrawtobuffer
+ Switches graphics to draw to the background buffer
+ Parameters: None
+*/
+void
+GWXDRAWTOBUFFER()
+{
+/* create and clear the pixmap */
+ if(pixmap == (Pixmap) NULL)
+ { pixmap = XCreatePixmap(display, window, width, height, root_depth);
+ XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, pixmap, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+ }
+
+/* point graphics to the pixmap */
+ buffer = pixmap;
+/* printf("called gwxdrawtobuffer\n"); */
+}
+
+/* gwxdrawtowindow
+ Switches graphics to draw to the foreground window
+ Parameters: None
+*/
+void
+GWXDRAWTOWINDOW()
+{ buffer = window;
+/* printf("called gwxdrawtowindow\n"); */
+}
+
+
+/* gwxline
+ Draw line from x1,y1 to x2,y2
+ Parameters:
+ x1,y1 (int*) starting position for line
+ x2,y2 (int*) ending position for line
+*/
+void
+GWXLINE(x1, y1, x2, y2)
+ int *x1, *y1, *x2, *y2;
+{ XDrawLine(display, buffer, gc, *x1, *y1, *x2, *y2);
+}
+
+
+/* gwxresize
+ Resize screen window to x width, y height
+ Parameters:
+ x (int*) new width
+ y (int*) new height
+*/
+void
+GWXRESIZE(x, y)
+ int *x, *y;
+{ unsigned int xsiz, ysiz;
+ unsigned int xsize, ysize, xstart, ystart;
+ int i;
+ XEvent event;
+ long event_mask;
+
+/* printf("called gwxresize\n"); */
+ event_mask = ExposureMask | ResizeRedirectMask;
+
+
+/* Clear the window events before resizing to setup for post resize Expose */
+ while(XPending(display))
+ XNextEvent(display, &event);
+
+ xsiz = *x;
+ ysiz = *y;
+/* printf("gwxresize to x %d y %d\n",xsiz,ysiz); */
+ XResizeWindow(display, window, xsiz, ysiz);
+ XMapRaised(display, window);
+ XFlush(display);
+
+/* check for window size change */
+ i = 0;
+ while(1)
+ { GWXSTATUS(&xstart, &ystart, &xsize, &ysize);
+ if( (xsize==xsiz) && (ysize==ysiz) )
+ break;
+/* printf("resize status check count = %d\n",i++); */
+ }
+
+/* update window size */
+ width = xsiz;
+ height = ysiz;
+/* destroy old back buffer pixmap and create new one in proper size */
+ if(pixmap != (Pixmap) NULL)
+ { XFreePixmap(display, pixmap);
+/* printf("create new pixmap sized to x %d y %d\n",width,height); */
+ pixmap = XCreatePixmap(display, window, width, height, root_depth);
+ if(buffer != window) buffer = pixmap;
+/* clear the pixmap */
+ XSetForeground(display, gc, bgcolor);
+ XFillRectangle(display, pixmap, gc, 0, 0, width, height);
+ XSetForeground(display, gc, fgcolor);
+ }
+
+
+/* Raise the window and wait for an expose event to do anything in it */
+/* while(1)
+ { XWindowEvent(display, window, event_mask, &event);
+ switch(event.type) {
+ case Expose:
+ printf("Expose event \n");
+ break;
+ case NoExpose:
+ printf("NoExpose event \n");
+ break;
+ case ResizeRequest:
+ printf("resizerequest event \n");
+ break;
+ }
+ } */
+}
+
+
+/* gwxlinez
+ Draw polyline on display window in current color and pen
+ Parameters:
+ ix (int*) array of x coordinates on polyline
+ iy (int*) array of y coordinates on polyline
+ n (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void
+GWXLINEZ(ix, iy, n)
+ int *n, *ix, *iy;
+{ XPoint points[MAXPTS];
+ int i;
+
+ if (*n > MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxlinez: Too many points in polyline\n");
+ printf("Xplot11.gwxlinez: Too many points in polyline\n");
+ return;
+ }
+
+ for(i=0; i < *n; i++) {
+ points[i].x = ix[i];
+ points[i].y = iy[i];
+/* printf("gwxlinez x %d y %d \n",ix[i],iy[i]); */
+ }
+ XDrawLines(display, buffer, gc, points, *n, CoordModeOrigin);
+}
+
+
+/* gwxpoly
+ Draw filled polyline on display window in current color and pen
+ Parameters:
+ x_coord (int*) array of x coordinates on polyline
+ y_coord (int*) array of y coordinates on polyline
+ n_coord (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void
+GWXPOLY(x_coord, y_coord, n_coord)
+ int *x_coord, *y_coord, *n_coord;
+{ XPoint points[MAXPTS];
+ int i,n;
+
+ if (*n_coord >= MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxpoly: Too many points in polyline\n");
+ printf("Xplot11.gwxpoly: Too many points in polyline\n");
+ return;
+ }
+
+ for (i=0; i < *n_coord; i++) {
+ points[i].x = x_coord[i];
+ points[i].y = y_coord[i];
+
+ }
+ n = *n_coord;
+/* if the polyline is not closed, duplicate first point to ensure closed
+
+ perimeter (speeds up X graphics drastically) */
+ if ( (points[n-1].x != points[0].x) ||
+
+ (points[n-1].y != points[0].y) ) {
+ points[n].x = points[0].x;
+ points[n].y = points[0].y;
+ n++;
+ }
+
+ XFillPolygon(display, buffer, gc, points, n,
+ Nonconvex, CoordModeOrigin);
+}
+
+
+/* gwxsetcolor
+ Set foreground color to pixel value
+ Parameters:
+ pixel (int*) pixel value (mapped in colormap)
+*/
+void
+GWXSETCOLOR(pixel)
+ int *pixel;
+{ fgcolor = *pixel;
+ XSetForeground(display, gc, fgcolor);
+}
+
+
+
+/* gwxsetbgcolor
+ Set background color to pixel value
+ Parameters:
+ pixel (int*) pixel value (mapped in colormap)
+*/
+void
+GWXSETBGCOLOR(pixel)
+ int *pixel;
+{ bgcolor = *pixel;
+ XSetForeground(display, gc, bgcolor);
+}
+
+
+
+/* gwxcolorname2rgb
+ Find r,g,b components for color specified by name string
+ Parameters:
+ red,grn,blu (int*) output color components (0-255)
+ nc (int*) string length (# of chars)
+ colorname (char*) string containing name of valid color
+ Note: color names are not case sensitive
+ len (int) fortran appended string length (passed by value)
+
+ Valid color names are any color name that is known to X11 color database
+ Examples are "Black","White","Yellow","Orange","Red","Green",
+ "Cyan","Blue","Magenta", "ivory", etc.
+*/
+void
+GWXCOLORNAME2RGB(int *red, int *grn, int *blu,
+ int *nc, char *colorname, int len)
+{
+ XColor color_def;
+ char cname[32];
+ int i,n;
+
+ n = *nc;
+
+ /* copy string to avoid overwriting possibly static input string
+ Note that string length is explicitly passed to avoid compatibility
+ problems with by fortran character arg length */
+
+ if(n>31) {
+ n = 31;
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",cname);
+ }
+ strncpy(cname,colorname,n);
+ cname[n] = '\0';
+
+ *red = -1;
+ *grn = -1;
+ *blu = -1;
+ if (!XParseColor(display, cmap,cname,&color_def)) {
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' not found\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' not found\n",cname);
+ return;
+ }
+ *red = color_def.red /256;
+ *grn = color_def.green/256;
+ *blu = color_def.blue /256;
+}
+
+
+/* gwxallocrgbcolor
+ Allocate a color in colormap specified by r,g,b components
+
+ Parameters:
+ red,grn,blu (int*) input color components (0-255)
+ ic (int*) returned color index or pixel value
+*/
+void
+GWXALLOCRGBCOLOR(int *red, int *grn, int *blu, int *ic)
+{
+ XColor color_def;
+
+ color_def.red = *red * 256;
+ color_def.green = *grn * 256;
+ color_def.blue = *blu * 256;
+ *ic = -1;
+
+ if (!XAllocColor (display, cmap, &color_def)) {
+ fprintf (stderr,"Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ printf ("Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ return;
+ }
+ *ic = color_def.pixel;
+}
+
+
+/* gwxfreecolor
+ Free a color from color map
+ Parameters:
+ pix (int*) pixel in colormap
+*/
+void
+GWXFREECOLOR(int *pix)
+{ unsigned long lpix;
+
+ lpix = *pix;
+ XFreeColors(display,cmap,&lpix,1,0L);
+}
+
+
+/* gwxstring
+ Draw string on display at specified position in current font and color
+ Parameters:
+ x (int*) array of x coordinates on polyline
+ y (int*) array of y coordinates on polyline
+ string (char*) character string
+ length (int*) length of string
+
+*/
+void
+GWXSTRING(x, y, string, length)
+ int *x, *y, *length;
+ char *string;
+{ XDrawString(display, buffer, gc, *x, *y, string, *length);
+}
+
+
+
+/* gwxdash
+ Set line drawing pattern to mask pattern
+ Parameters:
+ mask (int*) integer mask value (bits set pen pattern for lines)
+*/
+void
+GWXDASH(int* lmask)
+{
+char dashes[16];
+int idash[16], nchrs, ioff, i;
+
+ if(*lmask==0)
+
+ XSetLineAttributes(display, gc, line_width,
+
+ LineSolid, CapButt, JoinMiter);
+ else if(*lmask==-1)
+ XSetLineAttributes(display, gc, line_width,
+
+ LineSolid, CapButt, JoinMiter);
+ else
+
+ {
+ (void) MSKBITS(lmask,idash,&nchrs);
+ for(i=1;i<=nchrs;i++) dashes[i-1]=idash[i-1];
+/* for(i=1;i<=nchrs;i++) printf("%d dashes %d\n",i,dashes[i-1]); */
+
+ ioff = 0;
+ XSetDashes(display, gc, ioff, dashes, nchrs);
+/* use LineOnOffDash to only write "on" pixels in dashed lines (fg only) */
+/* use LineDoubleDash to overwrite all pixels in dashed lines (fg AND bg) */
+ XSetLineAttributes(display, gc, line_width,
+
+ LineOnOffDash, CapButt, JoinMiter);
+ }
+}
+
+
+
+/* gwxreset
+ Reset graphics context to default
+ Parameters: None
+*/
+void
+GWXRESET()
+{
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ line_width = 0;
+ gcv.function = GXcopy;
+ gcv.foreground = fgcolor;
+ gcv.background = bgcolor;
+ gcv.line_width = line_width;
+ gcv.line_style = LineSolid;
+ gcv.cap_style = CapButt;
+ gcv.fill_style = FillSolid;
+ gcv.join_style = JoinMiter;
+ gcv_mask = GCFunction | GCForeground | GCBackground | GCLineWidth |
+ GCLineStyle | GCCapStyle | GCFillStyle | GCJoinStyle;
+ XChangeGC(display, gc, gcv_mask, &gcv);
+
+}
+
+
+
+/* gwxpen
+ Set pen width for line drawing
+ Parameters:
+ ipen (int*) integer pen width
+*/
+void
+GWXPEN(int* ipen)
+{
+ XGCValues gcv;
+ unsigned long gcv_mask;
+
+ line_width = *ipen;
+ gcv.line_width = line_width;
+ gcv.cap_style = CapButt;
+ gcv.join_style = JoinMiter;
+ gcv_mask = GCLineWidth | GCCapStyle | GCJoinStyle;
+ XChangeGC(display, gc, gcv_mask, &gcv);
+}
+
+
+/* gwxcurs
+ Get cursor position and key pressed (waits for keypress or buttonpress)
+ Parameters:
+ x (int*) output cursor x coordinate
+ y (int*) output cursor y coordinate
+ state (int*) key pressed
+
+*/
+void
+GWXCURS(x, y, state)
+ int *x, *y, *state;
+{ XEvent report;
+ KeySym key;
+ int count,buffer_len,last_event;
+ long event_mask;
+ char buffer[2];
+/* int idev = 1; */
+
+/* XRaiseWindow(display,window); */
+ /* XSetInputFocus(display,window,RevertToNone,CurrentTime); */
+/* warp to passed-in x,y (typ. previous cursor location) */
+/* printf("GWXCURS input x %d y %d\n",*x,*y); */
+ XWarpPointer(display, None, window, 0, 0, 0, 0, *x, *y);
+
+ event_mask = ExposureMask | ConfigureNotify |
+ KeyPressMask | ButtonPressMask;
+
+/* clear any pending events */
+
+ while(XPending(display))
+ XNextEvent(display, &report);
+
+ *state = 0;
+ last_event = 0;
+ while(! *state)
+
+ { XWindowEvent(display, window, event_mask, &report);
+ switch(report.type) {
+ case Expose:
+ if(last_event != Expose)
+
+ { /* replot_(&idev); */
+ XSetInputFocus(display,window,RevertToNone,CurrentTime); }
+ break;
+ case ConfigureNotify:
+ break;
+ case ButtonPress:
+ *state = report.xbutton.button;
+ *x = report.xbutton.x;
+ *y = report.xbutton.y;
+ break;
+ case KeyPress:
+ *x = report.xkey.x;
+ *y = report.xkey.y;
+ buffer_len = 1;
+ count = XLookupString(&report.xkey, buffer, buffer_len, &key, NULL);
+ if (count == 0) printf("gwxcurs: Zero length string returned.\n");
+ *state = key;
+ break;
+ }
+ last_event = report.type;
+ }
+/* XRaiseWindow(display,parent_window); */
+/* XSetInputFocus(display,parent_window,RevertToNone,CurrentTime); */
+ }
+
+
+
+/* mskbits
+ Utility routine to convert lower 16 bits of pattern mask
+ into pattern array of on/off bit lengths. The 16
+ bits of ipat can contain up to 16 on/off bit lengths.
+ i.e. 0XAAAAAAA produces ibits=(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
+ i.e. 0XCCCCCCC produces ibits=(2,2,2,2,2,2,2,2)
+ The output pattern stored in integer array ibits=(#on,#off,#on,#off,etc.)
+ Parameters:
+ mask (int*) input mask
+ ibits (int*) output pattern string (#on, #off...)
+ ndash (int*) number of entries in pattern array
+*/
+void
+MSKBITS(int* mask, int* ibits, int* ndash)
+{
+#define BITSINMASK 16 /* use only lower 16 bits of mask word */
+
+int i,ic,ibit,ibitold;
+int nbits, nshft;
+unsigned short lmask;
+
+/* shift mask until low bit is 1, filling high bits with 0's */
+ lmask = *mask;
+ nshft = 0;
+
+ if(lmask!=0) {
+ while (!(ibitold = (lmask & 0x01)))
+ lmask >>= 1;
+ nshft++;
+ }
+/* if no 1 bits just exit with no dashes set */
+ if(ibitold==0) {
+ *ndash = 0;
+ exit;
+ }
+
+/* cycle through the lower 'length-nshft' bits
+ checking for number of contiguous same bits,
+ store into ibits array */
+ nbits = ic = 0;
+
+ for (i=0; i<(BITSINMASK-nshft); ++i) {
+
+ ibit=(lmask & 0x01);
+
+ if(ibit != ibitold) {
+ ibits[ic++] = nbits;
+ nbits = 0;
+ }
+
+ ibitold = ibit;
+ nbits++;
+
+ lmask >>= 1;
+ }
+
+/* add bits at end of shifted bits including any initial shift
+ to find the first 1 in the low bit */
+ if(ibit==1) {
+
+ ibits[ic++] = nbits;
+ if(nshft>0)
+ ibits[ic++] = nshft;
+
+ }
+ else
+ ibits[ic++] = nbits + nshft;
+
+ *ndash = ic;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/colors.inc b/plotlib/colors.inc
new file mode 100644
index 0000000..f1765f3
--- /dev/null
+++ b/plotlib/colors.inc
@@ -0,0 +1,59 @@
+C***********************************************************************
+C Module: colors.inc
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C Version 4.41 7/5/98
+C
+C******************************************
+C Default color definitions for Xplot11
+C For use as arguments to NEWCOLOR, e.g.
+C
+C CALL NEWCOLOR(GREEN)
+C
+C
+C Alternatively, can also use...
+C
+C CALL NEWCOLORNAME('GREEN')
+C
+C******************************************
+C
+ Integer BLACK,
+ & WHITE,
+ & RED,
+ & ORANGE,
+ & YELLOW,
+ & GREEN,
+ & CYAN,
+ & BLUE,
+ & VIOLET,
+ & MAGENTA
+C
+ parameter (BLACK = 1)
+ parameter (WHITE = 2)
+ parameter (RED = 3)
+ parameter (ORANGE = 4)
+ parameter (YELLOW = 5)
+ parameter (GREEN = 6)
+ parameter (CYAN = 7)
+ parameter (BLUE = 8)
+ parameter (VIOLET = 9)
+ parameter (MAGENTA = 10)
diff --git a/plotlib/colorstuff/rgb.c b/plotlib/colorstuff/rgb.c
new file mode 100644
index 0000000..3980f6c
--- /dev/null
+++ b/plotlib/colorstuff/rgb.c
@@ -0,0 +1,814 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+typedef struct {
+ char *name;
+ unsigned int rgb;
+} Colordef;
+
+Colordef colordef[] = {
+"snow", 16775930,
+"ghost white", 16316671,
+"GhostWhite", 16316671,
+"white smoke", 16119285,
+"WhiteSmoke", 16119285,
+"gainsboro", 14474460,
+"floral white", 16775920,
+"FloralWhite", 16775920,
+"old lace", 16643558,
+"OldLace", 16643558,
+"linen", 16445670,
+"antique white", 16444375,
+"AntiqueWhite", 16444375,
+"papaya whip", 16773077,
+"PapayaWhip", 16773077,
+"blanched almond", 16772045,
+"BlanchedAlmond", 16772045,
+"bisque", 16770244,
+"peach puff", 16767673,
+"PeachPuff", 16767673,
+"navajo white", 16768685,
+"NavajoWhite", 16768685,
+"moccasin", 16770229,
+"cornsilk", 16775388,
+"ivory", 16777200,
+"lemon chiffon", 16775885,
+"LemonChiffon", 16775885,
+"seashell", 16774638,
+"honeydew", 15794160,
+"mint cream", 16121850,
+"MintCream", 16121850,
+"azure", 15794175,
+"alice blue", 15792383,
+"AliceBlue", 15792383,
+"lavender", 15132410,
+"lavender blush", 16773365,
+"LavenderBlush", 16773365,
+"misty rose", 16770273,
+"MistyRose", 16770273,
+"white", 16777215,
+"black", 0,
+"dark slate gray", 3100495,
+"DarkSlateGray", 3100495,
+"dark slate grey", 3100495,
+"DarkSlateGrey", 3100495,
+"dim gray", 6908265,
+"DimGray", 6908265,
+"dim grey", 6908265,
+"DimGrey", 6908265,
+"slate gray", 7372944,
+"SlateGray", 7372944,
+"slate grey", 7372944,
+"SlateGrey", 7372944,
+"light slate gray", 7833753,
+"LightSlateGray", 7833753,
+"light slate grey", 7833753,
+"LightSlateGrey", 7833753,
+"gray", 12500670,
+"grey", 12500670,
+"light grey", 13882323,
+"LightGrey", 13882323,
+"light gray", 13882323,
+"LightGray", 13882323,
+"midnight blue", 1644912,
+"MidnightBlue", 1644912,
+"navy", 128,
+"navy blue", 128,
+"NavyBlue", 128,
+"cornflower blue", 6591981,
+"CornflowerBlue", 6591981,
+"dark slate blue", 4734347,
+"DarkSlateBlue", 4734347,
+"slate blue", 6970061,
+"SlateBlue", 6970061,
+"medium slate blue", 8087790,
+"MediumSlateBlue", 8087790,
+"light slate blue", 8679679,
+"LightSlateBlue", 8679679,
+"medium blue", 205,
+"MediumBlue", 205,
+"royal blue", 4286945,
+"RoyalBlue", 4286945,
+"blue", 255,
+"dodger blue", 2003199,
+"DodgerBlue", 2003199,
+"deep sky blue", 49151,
+"DeepSkyBlue", 49151,
+"sky blue", 8900331,
+"SkyBlue", 8900331,
+"light sky blue", 8900346,
+"LightSkyBlue", 8900346,
+"steel blue", 4620980,
+"SteelBlue", 4620980,
+"light steel blue", 11584734,
+"LightSteelBlue", 11584734,
+"light blue", 11393254,
+"LightBlue", 11393254,
+"powder blue", 11591910,
+"PowderBlue", 11591910,
+"pale turquoise", 11529966,
+"PaleTurquoise", 11529966,
+"dark turquoise", 52945,
+"DarkTurquoise", 52945,
+"medium turquoise", 4772300,
+"MediumTurquoise", 4772300,
+"turquoise", 4251856,
+"cyan", 65535,
+"light cyan", 14745599,
+"LightCyan", 14745599,
+"cadet blue", 6266528,
+"CadetBlue", 6266528,
+"medium aquamarine", 6737322,
+"MediumAquamarine", 6737322,
+"aquamarine", 8388564,
+"dark green", 25600,
+"DarkGreen", 25600,
+"dark olive green", 5597999,
+"DarkOliveGreen", 5597999,
+"dark sea green", 9419919,
+"DarkSeaGreen", 9419919,
+"sea green", 3050327,
+"SeaGreen", 3050327,
+"medium sea green", 3978097,
+"MediumSeaGreen", 3978097,
+"light sea green", 2142890,
+"LightSeaGreen", 2142890,
+"pale green", 10025880,
+"PaleGreen", 10025880,
+"spring green", 65407,
+"SpringGreen", 65407,
+"lawn green", 8190976,
+"LawnGreen", 8190976,
+"green", 65280,
+"chartreuse", 8388352,
+"medium spring green", 64154,
+"MediumSpringGreen", 64154,
+"green yellow", 11403055,
+"GreenYellow", 11403055,
+"lime green", 3329330,
+"LimeGreen", 3329330,
+"yellow green", 10145074,
+"YellowGreen", 10145074,
+"forest green", 2263842,
+"ForestGreen", 2263842,
+"olive drab", 7048739,
+"OliveDrab", 7048739,
+"dark khaki", 12433259,
+"DarkKhaki", 12433259,
+"khaki", 15787660,
+"pale goldenrod", 15657130,
+"PaleGoldenrod", 15657130,
+"light goldenrod yellow", 16448210,
+"LightGoldenrodYellow", 16448210,
+"light yellow", 16777184,
+"LightYellow", 16777184,
+"yellow", 16776960,
+"gold", 16766720,
+"light goldenrod", 15654274,
+"LightGoldenrod", 15654274,
+"goldenrod", 14329120,
+"dark goldenrod", 12092939,
+"DarkGoldenrod", 12092939,
+"rosy brown", 12357519,
+"RosyBrown", 12357519,
+"indian red", 13458524,
+"IndianRed", 13458524,
+"saddle brown", 9127187,
+"SaddleBrown", 9127187,
+"sienna", 10506797,
+"peru", 13468991,
+"burlywood", 14596231,
+"beige", 16119260,
+"wheat", 16113331,
+"sandy brown", 16032864,
+"SandyBrown", 16032864,
+"tan", 13808780,
+"chocolate", 13789470,
+"firebrick", 11674146,
+"brown", 10824234,
+"dark salmon", 15308410,
+"DarkSalmon", 15308410,
+"salmon", 16416882,
+"light salmon", 16752762,
+"LightSalmon", 16752762,
+"orange", 16753920,
+"dark orange", 16747520,
+"DarkOrange", 16747520,
+"coral", 16744272,
+"light coral", 15761536,
+"LightCoral", 15761536,
+"tomato", 16737095,
+"orange red", 16729344,
+"OrangeRed", 16729344,
+"red", 16711680,
+"hot pink", 16738740,
+"HotPink", 16738740,
+"deep pink", 16716947,
+"DeepPink", 16716947,
+"pink", 16761035,
+"light pink", 16758465,
+"LightPink", 16758465,
+"pale violet red", 14381203,
+"PaleVioletRed", 14381203,
+"maroon", 11546720,
+"medium violet red", 13047173,
+"MediumVioletRed", 13047173,
+"violet red", 13639824,
+"VioletRed", 13639824,
+"magenta", 16711935,
+"violet", 15631086,
+"plum", 14524637,
+"orchid", 14315734,
+"medium orchid", 12211667,
+"MediumOrchid", 12211667,
+"dark orchid", 10040012,
+"DarkOrchid", 10040012,
+"dark violet", 9699539,
+"DarkViolet", 9699539,
+"blue violet", 9055202,
+"BlueViolet", 9055202,
+"purple", 10494192,
+"medium purple", 9662683,
+"MediumPurple", 9662683,
+"thistle", 14204888,
+"snow1", 16775930,
+"snow2", 15657449,
+"snow3", 13486537,
+"snow4", 9144713,
+"seashell1", 16774638,
+"seashell2", 15656414,
+"seashell3", 13485503,
+"seashell4", 9143938,
+"AntiqueWhite1", 16773083,
+"AntiqueWhite2", 15654860,
+"AntiqueWhite3", 13484208,
+"AntiqueWhite4", 9143160,
+"bisque1", 16770244,
+"bisque2", 15652279,
+"bisque3", 13481886,
+"bisque4", 9141611,
+"PeachPuff1", 16767673,
+"PeachPuff2", 15649709,
+"PeachPuff3", 13479829,
+"PeachPuff4", 9140069,
+"NavajoWhite1", 16768685,
+"NavajoWhite2", 15650721,
+"NavajoWhite3", 13480843,
+"NavajoWhite4", 9140574,
+"LemonChiffon1", 16775885,
+"LemonChiffon2", 15657407,
+"LemonChiffon3", 13486501,
+"LemonChiffon4", 9144688,
+"cornsilk1", 16775388,
+"cornsilk2", 15657165,
+"cornsilk3", 13486257,
+"cornsilk4", 9144440,
+"ivory1", 16777200,
+"ivory2", 15658720,
+"ivory3", 13487553,
+"ivory4", 9145219,
+"honeydew1", 15794160,
+"honeydew2", 14741216,
+"honeydew3", 12701121,
+"honeydew4", 8620931,
+"LavenderBlush1", 16773365,
+"LavenderBlush2", 15655141,
+"LavenderBlush3", 13484485,
+"LavenderBlush4", 9143174,
+"MistyRose1", 16770273,
+"MistyRose2", 15652306,
+"MistyRose3", 13481909,
+"MistyRose4", 9141627,
+"azure1", 15794175,
+"azure2", 14741230,
+"azure3", 12701133,
+"azure4", 8620939,
+"SlateBlue1", 8613887,
+"SlateBlue2", 8021998,
+"SlateBlue3", 6904269,
+"SlateBlue4", 4668555,
+"RoyalBlue1", 4749055,
+"RoyalBlue2", 4419310,
+"RoyalBlue3", 3825613,
+"RoyalBlue4", 2572427,
+"blue1", 255,
+"blue2", 238,
+"blue3", 205,
+"blue4", 139,
+"DodgerBlue1", 2003199,
+"DodgerBlue2", 1869550,
+"DodgerBlue3", 1602765,
+"DodgerBlue4", 1068683,
+"SteelBlue1", 6535423,
+"SteelBlue2", 6073582,
+"SteelBlue3", 5215437,
+"SteelBlue4", 3564683,
+"DeepSkyBlue1", 49151,
+"DeepSkyBlue2", 45806,
+"DeepSkyBlue3", 39629,
+"DeepSkyBlue4", 26763,
+"SkyBlue1", 8900351,
+"SkyBlue2", 8306926,
+"SkyBlue3", 7120589,
+"SkyBlue4", 4878475,
+"LightSkyBlue1", 11592447,
+"LightSkyBlue2", 10802158,
+"LightSkyBlue3", 9287373,
+"LightSkyBlue4", 6323083,
+"SlateGray1", 13034239,
+"SlateGray2", 12178414,
+"SlateGray3", 10467021,
+"SlateGray4", 7109515,
+"LightSteelBlue1", 13296127,
+"LightSteelBlue2", 12374766,
+"LightSteelBlue3", 10663373,
+"LightSteelBlue4", 7240587,
+"LightBlue1", 12578815,
+"LightBlue2", 11722734,
+"LightBlue3", 10141901,
+"LightBlue4", 6849419,
+"LightCyan1", 14745599,
+"LightCyan2", 13758190,
+"LightCyan3", 11849165,
+"LightCyan4", 8031115,
+"PaleTurquoise1", 12320767,
+"PaleTurquoise2", 11464430,
+"PaleTurquoise3", 9883085,
+"PaleTurquoise4", 6720395,
+"CadetBlue1", 10024447,
+"CadetBlue2", 9364974,
+"CadetBlue3", 8046029,
+"CadetBlue4", 5473931,
+"turquoise1", 62975,
+"turquoise2", 58862,
+"turquoise3", 50637,
+"turquoise4", 34443,
+"cyan1", 65535,
+"cyan2", 61166,
+"cyan3", 52685,
+"cyan4", 35723,
+"DarkSlateGray1", 9961471,
+"DarkSlateGray2", 9301742,
+"DarkSlateGray3", 7982541,
+"DarkSlateGray4", 5409675,
+"aquamarine1", 8388564,
+"aquamarine2", 7794374,
+"aquamarine3", 6737322,
+"aquamarine4", 4557684,
+"DarkSeaGreen1", 12713921,
+"DarkSeaGreen2", 11857588,
+"DarkSeaGreen3", 10210715,
+"DarkSeaGreen4", 6916969,
+"SeaGreen1", 5570463,
+"SeaGreen2", 5172884,
+"SeaGreen3", 4443520,
+"SeaGreen4", 3050327,
+"PaleGreen1", 10157978,
+"PaleGreen2", 9498256,
+"PaleGreen3", 8179068,
+"PaleGreen4", 5540692,
+"SpringGreen1", 65407,
+"SpringGreen2", 61046,
+"SpringGreen3", 52582,
+"SpringGreen4", 35653,
+"green1", 65280,
+"green2", 60928,
+"green3", 52480,
+"green4", 35584,
+"chartreuse1", 8388352,
+"chartreuse2", 7794176,
+"chartreuse3", 6737152,
+"chartreuse4", 4557568,
+"OliveDrab1", 12648254,
+"OliveDrab2", 11791930,
+"OliveDrab3", 10145074,
+"OliveDrab4", 6916898,
+"DarkOliveGreen1", 13303664,
+"DarkOliveGreen2", 12381800,
+"DarkOliveGreen3", 10669402,
+"DarkOliveGreen4", 7244605,
+"khaki1", 16774799,
+"khaki2", 15656581,
+"khaki3", 13485683,
+"khaki4", 9143886,
+"LightGoldenrod1", 16772235,
+"LightGoldenrod2", 15654018,
+"LightGoldenrod3", 13483632,
+"LightGoldenrod4", 9142604,
+"LightYellow1", 16777184,
+"LightYellow2", 15658705,
+"LightYellow3", 13487540,
+"LightYellow4", 9145210,
+"yellow1", 16776960,
+"yellow2", 15658496,
+"yellow3", 13487360,
+"yellow4", 9145088,
+"gold1", 16766720,
+"gold2", 15649024,
+"gold3", 13479168,
+"gold4", 9139456,
+"goldenrod1", 16761125,
+"goldenrod2", 15643682,
+"goldenrod3", 13474589,
+"goldenrod4", 9136404,
+"DarkGoldenrod1", 16759055,
+"DarkGoldenrod2", 15641870,
+"DarkGoldenrod3", 13473036,
+"DarkGoldenrod4", 9135368,
+"RosyBrown1", 16761281,
+"RosyBrown2", 15643828,
+"RosyBrown3", 13474715,
+"RosyBrown4", 9136489,
+"IndianRed1", 16738922,
+"IndianRed2", 15623011,
+"IndianRed3", 13456725,
+"IndianRed4", 9124410,
+"sienna1", 16745031,
+"sienna2", 15628610,
+"sienna3", 13461561,
+"sienna4", 9127718,
+"burlywood1", 16765851,
+"burlywood2", 15648145,
+"burlywood3", 13478525,
+"burlywood4", 9139029,
+"wheat1", 16771002,
+"wheat2", 15653038,
+"wheat3", 13482646,
+"wheat4", 9141862,
+"tan1", 16753999,
+"tan2", 15637065,
+"tan3", 13468991,
+"tan4", 9132587,
+"chocolate1", 16744228,
+"chocolate2", 15627809,
+"chocolate3", 13461021,
+"chocolate4", 9127187,
+"firebrick1", 16724016,
+"firebrick2", 15608876,
+"firebrick3", 13444646,
+"firebrick4", 9116186,
+"brown1", 16728128,
+"brown2", 15612731,
+"brown3", 13447987,
+"brown4", 9118499,
+"salmon1", 16747625,
+"salmon2", 15630946,
+"salmon3", 13463636,
+"salmon4", 9129017,
+"LightSalmon1", 16752762,
+"LightSalmon2", 15635826,
+"LightSalmon3", 13468002,
+"LightSalmon4", 9131842,
+"orange1", 16753920,
+"orange2", 15636992,
+"orange3", 13468928,
+"orange4", 9132544,
+"DarkOrange1", 16744192,
+"DarkOrange2", 15627776,
+"DarkOrange3", 13460992,
+"DarkOrange4", 9127168,
+"coral1", 16740950,
+"coral2", 15624784,
+"coral3", 13458245,
+"coral4", 9125423,
+"tomato1", 16737095,
+"tomato2", 15621186,
+"tomato3", 13455161,
+"tomato4", 9123366,
+"OrangeRed1", 16729344,
+"OrangeRed2", 15613952,
+"OrangeRed3", 13448960,
+"OrangeRed4", 9118976,
+"red1", 16711680,
+"red2", 15597568,
+"red3", 13434880,
+"red4", 9109504,
+"DeepPink1", 16716947,
+"DeepPink2", 15602313,
+"DeepPink3", 13439094,
+"DeepPink4", 9112144,
+"HotPink1", 16740020,
+"HotPink2", 15624871,
+"HotPink3", 13459600,
+"HotPink4", 9124450,
+"pink1", 16758213,
+"pink2", 15641016,
+"pink3", 13472158,
+"pink4", 9134956,
+"LightPink1", 16756409,
+"LightPink2", 15639213,
+"LightPink3", 13470869,
+"LightPink4", 9133925,
+"PaleVioletRed1", 16745131,
+"PaleVioletRed2", 15628703,
+"PaleVioletRed3", 13461641,
+"PaleVioletRed4", 9127773,
+"maroon1", 16725171,
+"maroon2", 15610023,
+"maroon3", 13445520,
+"maroon4", 9116770,
+"VioletRed1", 16727702,
+"VioletRed2", 15612556,
+"VioletRed3", 13447800,
+"VioletRed4", 9118290,
+"magenta1", 16711935,
+"magenta2", 15597806,
+"magenta3", 13435085,
+"magenta4", 9109643,
+"orchid1", 16745466,
+"orchid2", 15629033,
+"orchid3", 13461961,
+"orchid4", 9127817,
+"plum1", 16759807,
+"plum2", 15642350,
+"plum3", 13473485,
+"plum4", 9135755,
+"MediumOrchid1", 14706431,
+"MediumOrchid2", 13721582,
+"MediumOrchid3", 11817677,
+"MediumOrchid4", 8009611,
+"DarkOrchid1", 12533503,
+"DarkOrchid2", 11680494,
+"DarkOrchid3", 10105549,
+"DarkOrchid4", 6824587,
+"purple1", 10170623,
+"purple2", 9514222,
+"purple3", 8201933,
+"purple4", 5577355,
+"MediumPurple1", 11240191,
+"MediumPurple2", 10451438,
+"MediumPurple3", 9005261,
+"MediumPurple4", 6113163,
+"thistle1", 16769535,
+"thistle2", 15651566,
+"thistle3", 13481421,
+"thistle4", 9141131,
+"gray0", 0,
+"grey0", 0,
+"gray1", 197379,
+"grey1", 197379,
+"gray2", 328965,
+"grey2", 328965,
+"gray3", 526344,
+"grey3", 526344,
+"gray4", 657930,
+"grey4", 657930,
+"gray5", 855309,
+"grey5", 855309,
+"gray6", 986895,
+"grey6", 986895,
+"gray7", 1184274,
+"grey7", 1184274,
+"gray8", 1315860,
+"grey8", 1315860,
+"gray9", 1513239,
+"grey9", 1513239,
+"gray10", 1710618,
+"grey10", 1710618,
+"gray11", 1842204,
+"grey11", 1842204,
+"gray12", 2039583,
+"grey12", 2039583,
+"gray13", 2171169,
+"grey13", 2171169,
+"gray14", 2368548,
+"grey14", 2368548,
+"gray15", 2500134,
+"grey15", 2500134,
+"gray16", 2697513,
+"grey16", 2697513,
+"gray17", 2829099,
+"grey17", 2829099,
+"gray18", 3026478,
+"grey18", 3026478,
+"gray19", 3158064,
+"grey19", 3158064,
+"gray20", 3355443,
+"grey20", 3355443,
+"gray21", 3552822,
+"grey21", 3552822,
+"gray22", 3684408,
+"grey22", 3684408,
+"gray23", 3881787,
+"grey23", 3881787,
+"gray24", 4013373,
+"grey24", 4013373,
+"gray25", 4210752,
+"grey25", 4210752,
+"gray26", 4342338,
+"grey26", 4342338,
+"gray27", 4539717,
+"grey27", 4539717,
+"gray28", 4671303,
+"grey28", 4671303,
+"gray29", 4868682,
+"grey29", 4868682,
+"gray30", 5066061,
+"grey30", 5066061,
+"gray31", 5197647,
+"grey31", 5197647,
+"gray32", 5395026,
+"grey32", 5395026,
+"gray33", 5526612,
+"grey33", 5526612,
+"gray34", 5723991,
+"grey34", 5723991,
+"gray35", 5855577,
+"grey35", 5855577,
+"gray36", 6052956,
+"grey36", 6052956,
+"gray37", 6184542,
+"grey37", 6184542,
+"gray38", 6381921,
+"grey38", 6381921,
+"gray39", 6513507,
+"grey39", 6513507,
+"gray40", 6710886,
+"grey40", 6710886,
+"gray41", 6908265,
+"grey41", 6908265,
+"gray42", 7039851,
+"grey42", 7039851,
+"gray43", 7237230,
+"grey43", 7237230,
+"gray44", 7368816,
+"grey44", 7368816,
+"gray45", 7566195,
+"grey45", 7566195,
+"gray46", 7697781,
+"grey46", 7697781,
+"gray47", 7895160,
+"grey47", 7895160,
+"gray48", 8026746,
+"grey48", 8026746,
+"gray49", 8224125,
+"grey49", 8224125,
+"gray50", 8355711,
+"grey50", 8355711,
+"gray51", 8553090,
+"grey51", 8553090,
+"gray52", 8750469,
+"grey52", 8750469,
+"gray53", 8882055,
+"grey53", 8882055,
+"gray54", 9079434,
+"grey54", 9079434,
+"gray55", 9211020,
+"grey55", 9211020,
+"gray56", 9408399,
+"grey56", 9408399,
+"gray57", 9539985,
+"grey57", 9539985,
+"gray58", 9737364,
+"grey58", 9737364,
+"gray59", 9868950,
+"grey59", 9868950,
+"gray60", 10066329,
+"grey60", 10066329,
+"gray61", 10263708,
+"grey61", 10263708,
+"gray62", 10395294,
+"grey62", 10395294,
+"gray63", 10592673,
+"grey63", 10592673,
+"gray64", 10724259,
+"grey64", 10724259,
+"gray65", 10921638,
+"grey65", 10921638,
+"gray66", 11053224,
+"grey66", 11053224,
+"gray67", 11250603,
+"grey67", 11250603,
+"gray68", 11382189,
+"grey68", 11382189,
+"gray69", 11579568,
+"grey69", 11579568,
+"gray70", 11776947,
+"grey70", 11776947,
+"gray71", 11908533,
+"grey71", 11908533,
+"gray72", 12105912,
+"grey72", 12105912,
+"gray73", 12237498,
+"grey73", 12237498,
+"gray74", 12434877,
+"grey74", 12434877,
+"gray75", 12566463,
+"grey75", 12566463,
+"gray76", 12763842,
+"grey76", 12763842,
+"gray77", 12895428,
+"grey77", 12895428,
+"gray78", 13092807,
+"grey78", 13092807,
+"gray79", 13224393,
+"grey79", 13224393,
+"gray80", 13421772,
+"grey80", 13421772,
+"gray81", 13619151,
+"grey81", 13619151,
+"gray82", 13750737,
+"grey82", 13750737,
+"gray83", 13948116,
+"grey83", 13948116,
+"gray84", 14079702,
+"grey84", 14079702,
+"gray85", 14277081,
+"grey85", 14277081,
+"gray86", 14408667,
+"grey86", 14408667,
+"gray87", 14606046,
+"grey87", 14606046,
+"gray88", 14737632,
+"grey88", 14737632,
+"gray89", 14935011,
+"grey89", 14935011,
+"gray90", 15066597,
+"grey90", 15066597,
+"gray91", 15263976,
+"grey91", 15263976,
+"gray92", 15461355,
+"grey92", 15461355,
+"gray93", 15592941,
+"grey93", 15592941,
+"gray94", 15790320,
+"grey94", 15790320,
+"gray95", 15921906,
+"grey95", 15921906,
+"gray96", 16119285,
+"grey96", 16119285,
+"gray97", 16250871,
+"grey97", 16250871,
+"gray98", 16448250,
+"grey98", 16448250,
+"gray99", 16579836,
+"grey99", 16579836,
+"gray100", 16777215,
+"grey100", 16777215,
+"dark grey", 11119017,
+"DarkGrey", 11119017,
+"dark gray", 11119017,
+"DarkGray", 11119017,
+"dark blue", 139,
+"DarkBlue", 139,
+"dark cyan", 35723,
+"DarkCyan", 35723,
+"dark magenta", 9109643,
+"DarkMagenta", 9109643,
+"dark red", 9109504,
+"DarkRed", 9109504,
+"light green", 9498256,
+"LightGreen", 9498256
+};
+
+
+main(argc,argv)
+char **argv;
+int argc;
+{
+
+int IC,ic,ncols;
+int i,n,ired,igrn,iblu;
+char teststr[50], c;
+
+IC = sizeof(Colordef);
+ic = sizeof(colordef);
+ncols = ic/IC;
+
+printf("Colordef %d\n",IC);
+printf("colordef %d\n",ic);
+printf("#entries %d\n",ncols);
+
+printf("\nEnter color string: ");
+
+/*if ((c=fgetc(stdin)) != '\n')
+ungetc(c,stdin); */
+
+fgets(teststr,50,stdin);
+printf("strlen = %d\n",strlen(teststr));
+
+if ((n=strlen(teststr)) != 0) {
+ while(n > 0 && teststr[--n] == '\n')
+ teststr[n] = '\0'; }
+
+/*fscanf(stdin,"%s",teststr);*/
+printf("\nTest string = %s\n",teststr);
+
+for (i=0; i < ncols; i++) {
+ if(!strcasecmp(colordef[i].name,teststr)) {
+
+ printf("test string %s found at %d\n",teststr,i);
+ printf("found string %s code %d\n",colordef[i].name,colordef[i].rgb);
+
+ ired = 0x000000ff & (colordef[i].rgb >> 16);
+ igrn = 0x000000ff & (colordef[i].rgb >> 8);
+ iblu = 0x000000ff & (colordef[i].rgb);
+
+ printf("red = %d\ngrn = %d\nblu = %d\n",ired,igrn,iblu);
+ }
+}
+
+}
+
diff --git a/plotlib/colorstuff/rgbtbl.h b/plotlib/colorstuff/rgbtbl.h
new file mode 100644
index 0000000..f63ce20
--- /dev/null
+++ b/plotlib/colorstuff/rgbtbl.h
@@ -0,0 +1,765 @@
+/* RGB lookup table
+ duplicates Xwindows rgb.txt as a color name to integer RGB table
+ H.Youngren 3/99
+*/
+
+typedef struct {
+ char *name;
+ unsigned int rgb;
+} Colordef;
+
+static Colordef colordef[] = {
+"snow", 16775930,
+"ghost white", 16316671,
+"GhostWhite", 16316671,
+"white smoke", 16119285,
+"WhiteSmoke", 16119285,
+"gainsboro", 14474460,
+"floral white", 16775920,
+"FloralWhite", 16775920,
+"old lace", 16643558,
+"OldLace", 16643558,
+"linen", 16445670,
+"antique white", 16444375,
+"AntiqueWhite", 16444375,
+"papaya whip", 16773077,
+"PapayaWhip", 16773077,
+"blanched almond", 16772045,
+"BlanchedAlmond", 16772045,
+"bisque", 16770244,
+"peach puff", 16767673,
+"PeachPuff", 16767673,
+"navajo white", 16768685,
+"NavajoWhite", 16768685,
+"moccasin", 16770229,
+"cornsilk", 16775388,
+"ivory", 16777200,
+"lemon chiffon", 16775885,
+"LemonChiffon", 16775885,
+"seashell", 16774638,
+"honeydew", 15794160,
+"mint cream", 16121850,
+"MintCream", 16121850,
+"azure", 15794175,
+"alice blue", 15792383,
+"AliceBlue", 15792383,
+"lavender", 15132410,
+"lavender blush", 16773365,
+"LavenderBlush", 16773365,
+"misty rose", 16770273,
+"MistyRose", 16770273,
+"white", 16777215,
+"black", 0,
+"dark slate gray", 3100495,
+"DarkSlateGray", 3100495,
+"dark slate grey", 3100495,
+"DarkSlateGrey", 3100495,
+"dim gray", 6908265,
+"DimGray", 6908265,
+"dim grey", 6908265,
+"DimGrey", 6908265,
+"slate gray", 7372944,
+"SlateGray", 7372944,
+"slate grey", 7372944,
+"SlateGrey", 7372944,
+"light slate gray", 7833753,
+"LightSlateGray", 7833753,
+"light slate grey", 7833753,
+"LightSlateGrey", 7833753,
+"gray", 12500670,
+"grey", 12500670,
+"light grey", 13882323,
+"LightGrey", 13882323,
+"light gray", 13882323,
+"LightGray", 13882323,
+"midnight blue", 1644912,
+"MidnightBlue", 1644912,
+"navy", 128,
+"navy blue", 128,
+"NavyBlue", 128,
+"cornflower blue", 6591981,
+"CornflowerBlue", 6591981,
+"dark slate blue", 4734347,
+"DarkSlateBlue", 4734347,
+"slate blue", 6970061,
+"SlateBlue", 6970061,
+"medium slate blue", 8087790,
+"MediumSlateBlue", 8087790,
+"light slate blue", 8679679,
+"LightSlateBlue", 8679679,
+"medium blue", 205,
+"MediumBlue", 205,
+"royal blue", 4286945,
+"RoyalBlue", 4286945,
+"blue", 255,
+"dodger blue", 2003199,
+"DodgerBlue", 2003199,
+"deep sky blue", 49151,
+"DeepSkyBlue", 49151,
+"sky blue", 8900331,
+"SkyBlue", 8900331,
+"light sky blue", 8900346,
+"LightSkyBlue", 8900346,
+"steel blue", 4620980,
+"SteelBlue", 4620980,
+"light steel blue", 11584734,
+"LightSteelBlue", 11584734,
+"light blue", 11393254,
+"LightBlue", 11393254,
+"powder blue", 11591910,
+"PowderBlue", 11591910,
+"pale turquoise", 11529966,
+"PaleTurquoise", 11529966,
+"dark turquoise", 52945,
+"DarkTurquoise", 52945,
+"medium turquoise", 4772300,
+"MediumTurquoise", 4772300,
+"turquoise", 4251856,
+"cyan", 65535,
+"light cyan", 14745599,
+"LightCyan", 14745599,
+"cadet blue", 6266528,
+"CadetBlue", 6266528,
+"medium aquamarine", 6737322,
+"MediumAquamarine", 6737322,
+"aquamarine", 8388564,
+"dark green", 25600,
+"DarkGreen", 25600,
+"dark olive green", 5597999,
+"DarkOliveGreen", 5597999,
+"dark sea green", 9419919,
+"DarkSeaGreen", 9419919,
+"sea green", 3050327,
+"SeaGreen", 3050327,
+"medium sea green", 3978097,
+"MediumSeaGreen", 3978097,
+"light sea green", 2142890,
+"LightSeaGreen", 2142890,
+"pale green", 10025880,
+"PaleGreen", 10025880,
+"spring green", 65407,
+"SpringGreen", 65407,
+"lawn green", 8190976,
+"LawnGreen", 8190976,
+"green", 65280,
+"chartreuse", 8388352,
+"medium spring green", 64154,
+"MediumSpringGreen", 64154,
+"green yellow", 11403055,
+"GreenYellow", 11403055,
+"lime green", 3329330,
+"LimeGreen", 3329330,
+"yellow green", 10145074,
+"YellowGreen", 10145074,
+"forest green", 2263842,
+"ForestGreen", 2263842,
+"olive drab", 7048739,
+"OliveDrab", 7048739,
+"dark khaki", 12433259,
+"DarkKhaki", 12433259,
+"khaki", 15787660,
+"pale goldenrod", 15657130,
+"PaleGoldenrod", 15657130,
+"light goldenrod yellow", 16448210,
+"LightGoldenrodYellow", 16448210,
+"light yellow", 16777184,
+"LightYellow", 16777184,
+"yellow", 16776960,
+"gold", 16766720,
+"light goldenrod", 15654274,
+"LightGoldenrod", 15654274,
+"goldenrod", 14329120,
+"dark goldenrod", 12092939,
+"DarkGoldenrod", 12092939,
+"rosy brown", 12357519,
+"RosyBrown", 12357519,
+"indian red", 13458524,
+"IndianRed", 13458524,
+"saddle brown", 9127187,
+"SaddleBrown", 9127187,
+"sienna", 10506797,
+"peru", 13468991,
+"burlywood", 14596231,
+"beige", 16119260,
+"wheat", 16113331,
+"sandy brown", 16032864,
+"SandyBrown", 16032864,
+"tan", 13808780,
+"chocolate", 13789470,
+"firebrick", 11674146,
+"brown", 10824234,
+"dark salmon", 15308410,
+"DarkSalmon", 15308410,
+"salmon", 16416882,
+"light salmon", 16752762,
+"LightSalmon", 16752762,
+"orange", 16753920,
+"dark orange", 16747520,
+"DarkOrange", 16747520,
+"coral", 16744272,
+"light coral", 15761536,
+"LightCoral", 15761536,
+"tomato", 16737095,
+"orange red", 16729344,
+"OrangeRed", 16729344,
+"red", 16711680,
+"hot pink", 16738740,
+"HotPink", 16738740,
+"deep pink", 16716947,
+"DeepPink", 16716947,
+"pink", 16761035,
+"light pink", 16758465,
+"LightPink", 16758465,
+"pale violet red", 14381203,
+"PaleVioletRed", 14381203,
+"maroon", 11546720,
+"medium violet red", 13047173,
+"MediumVioletRed", 13047173,
+"violet red", 13639824,
+"VioletRed", 13639824,
+"magenta", 16711935,
+"violet", 15631086,
+"plum", 14524637,
+"orchid", 14315734,
+"medium orchid", 12211667,
+"MediumOrchid", 12211667,
+"dark orchid", 10040012,
+"DarkOrchid", 10040012,
+"dark violet", 9699539,
+"DarkViolet", 9699539,
+"blue violet", 9055202,
+"BlueViolet", 9055202,
+"purple", 10494192,
+"medium purple", 9662683,
+"MediumPurple", 9662683,
+"thistle", 14204888,
+"snow1", 16775930,
+"snow2", 15657449,
+"snow3", 13486537,
+"snow4", 9144713,
+"seashell1", 16774638,
+"seashell2", 15656414,
+"seashell3", 13485503,
+"seashell4", 9143938,
+"AntiqueWhite1", 16773083,
+"AntiqueWhite2", 15654860,
+"AntiqueWhite3", 13484208,
+"AntiqueWhite4", 9143160,
+"bisque1", 16770244,
+"bisque2", 15652279,
+"bisque3", 13481886,
+"bisque4", 9141611,
+"PeachPuff1", 16767673,
+"PeachPuff2", 15649709,
+"PeachPuff3", 13479829,
+"PeachPuff4", 9140069,
+"NavajoWhite1", 16768685,
+"NavajoWhite2", 15650721,
+"NavajoWhite3", 13480843,
+"NavajoWhite4", 9140574,
+"LemonChiffon1", 16775885,
+"LemonChiffon2", 15657407,
+"LemonChiffon3", 13486501,
+"LemonChiffon4", 9144688,
+"cornsilk1", 16775388,
+"cornsilk2", 15657165,
+"cornsilk3", 13486257,
+"cornsilk4", 9144440,
+"ivory1", 16777200,
+"ivory2", 15658720,
+"ivory3", 13487553,
+"ivory4", 9145219,
+"honeydew1", 15794160,
+"honeydew2", 14741216,
+"honeydew3", 12701121,
+"honeydew4", 8620931,
+"LavenderBlush1", 16773365,
+"LavenderBlush2", 15655141,
+"LavenderBlush3", 13484485,
+"LavenderBlush4", 9143174,
+"MistyRose1", 16770273,
+"MistyRose2", 15652306,
+"MistyRose3", 13481909,
+"MistyRose4", 9141627,
+"azure1", 15794175,
+"azure2", 14741230,
+"azure3", 12701133,
+"azure4", 8620939,
+"SlateBlue1", 8613887,
+"SlateBlue2", 8021998,
+"SlateBlue3", 6904269,
+"SlateBlue4", 4668555,
+"RoyalBlue1", 4749055,
+"RoyalBlue2", 4419310,
+"RoyalBlue3", 3825613,
+"RoyalBlue4", 2572427,
+"blue1", 255,
+"blue2", 238,
+"blue3", 205,
+"blue4", 139,
+"DodgerBlue1", 2003199,
+"DodgerBlue2", 1869550,
+"DodgerBlue3", 1602765,
+"DodgerBlue4", 1068683,
+"SteelBlue1", 6535423,
+"SteelBlue2", 6073582,
+"SteelBlue3", 5215437,
+"SteelBlue4", 3564683,
+"DeepSkyBlue1", 49151,
+"DeepSkyBlue2", 45806,
+"DeepSkyBlue3", 39629,
+"DeepSkyBlue4", 26763,
+"SkyBlue1", 8900351,
+"SkyBlue2", 8306926,
+"SkyBlue3", 7120589,
+"SkyBlue4", 4878475,
+"LightSkyBlue1", 11592447,
+"LightSkyBlue2", 10802158,
+"LightSkyBlue3", 9287373,
+"LightSkyBlue4", 6323083,
+"SlateGray1", 13034239,
+"SlateGray2", 12178414,
+"SlateGray3", 10467021,
+"SlateGray4", 7109515,
+"LightSteelBlue1", 13296127,
+"LightSteelBlue2", 12374766,
+"LightSteelBlue3", 10663373,
+"LightSteelBlue4", 7240587,
+"LightBlue1", 12578815,
+"LightBlue2", 11722734,
+"LightBlue3", 10141901,
+"LightBlue4", 6849419,
+"LightCyan1", 14745599,
+"LightCyan2", 13758190,
+"LightCyan3", 11849165,
+"LightCyan4", 8031115,
+"PaleTurquoise1", 12320767,
+"PaleTurquoise2", 11464430,
+"PaleTurquoise3", 9883085,
+"PaleTurquoise4", 6720395,
+"CadetBlue1", 10024447,
+"CadetBlue2", 9364974,
+"CadetBlue3", 8046029,
+"CadetBlue4", 5473931,
+"turquoise1", 62975,
+"turquoise2", 58862,
+"turquoise3", 50637,
+"turquoise4", 34443,
+"cyan1", 65535,
+"cyan2", 61166,
+"cyan3", 52685,
+"cyan4", 35723,
+"DarkSlateGray1", 9961471,
+"DarkSlateGray2", 9301742,
+"DarkSlateGray3", 7982541,
+"DarkSlateGray4", 5409675,
+"aquamarine1", 8388564,
+"aquamarine2", 7794374,
+"aquamarine3", 6737322,
+"aquamarine4", 4557684,
+"DarkSeaGreen1", 12713921,
+"DarkSeaGreen2", 11857588,
+"DarkSeaGreen3", 10210715,
+"DarkSeaGreen4", 6916969,
+"SeaGreen1", 5570463,
+"SeaGreen2", 5172884,
+"SeaGreen3", 4443520,
+"SeaGreen4", 3050327,
+"PaleGreen1", 10157978,
+"PaleGreen2", 9498256,
+"PaleGreen3", 8179068,
+"PaleGreen4", 5540692,
+"SpringGreen1", 65407,
+"SpringGreen2", 61046,
+"SpringGreen3", 52582,
+"SpringGreen4", 35653,
+"green1", 65280,
+"green2", 60928,
+"green3", 52480,
+"green4", 35584,
+"chartreuse1", 8388352,
+"chartreuse2", 7794176,
+"chartreuse3", 6737152,
+"chartreuse4", 4557568,
+"OliveDrab1", 12648254,
+"OliveDrab2", 11791930,
+"OliveDrab3", 10145074,
+"OliveDrab4", 6916898,
+"DarkOliveGreen1", 13303664,
+"DarkOliveGreen2", 12381800,
+"DarkOliveGreen3", 10669402,
+"DarkOliveGreen4", 7244605,
+"khaki1", 16774799,
+"khaki2", 15656581,
+"khaki3", 13485683,
+"khaki4", 9143886,
+"LightGoldenrod1", 16772235,
+"LightGoldenrod2", 15654018,
+"LightGoldenrod3", 13483632,
+"LightGoldenrod4", 9142604,
+"LightYellow1", 16777184,
+"LightYellow2", 15658705,
+"LightYellow3", 13487540,
+"LightYellow4", 9145210,
+"yellow1", 16776960,
+"yellow2", 15658496,
+"yellow3", 13487360,
+"yellow4", 9145088,
+"gold1", 16766720,
+"gold2", 15649024,
+"gold3", 13479168,
+"gold4", 9139456,
+"goldenrod1", 16761125,
+"goldenrod2", 15643682,
+"goldenrod3", 13474589,
+"goldenrod4", 9136404,
+"DarkGoldenrod1", 16759055,
+"DarkGoldenrod2", 15641870,
+"DarkGoldenrod3", 13473036,
+"DarkGoldenrod4", 9135368,
+"RosyBrown1", 16761281,
+"RosyBrown2", 15643828,
+"RosyBrown3", 13474715,
+"RosyBrown4", 9136489,
+"IndianRed1", 16738922,
+"IndianRed2", 15623011,
+"IndianRed3", 13456725,
+"IndianRed4", 9124410,
+"sienna1", 16745031,
+"sienna2", 15628610,
+"sienna3", 13461561,
+"sienna4", 9127718,
+"burlywood1", 16765851,
+"burlywood2", 15648145,
+"burlywood3", 13478525,
+"burlywood4", 9139029,
+"wheat1", 16771002,
+"wheat2", 15653038,
+"wheat3", 13482646,
+"wheat4", 9141862,
+"tan1", 16753999,
+"tan2", 15637065,
+"tan3", 13468991,
+"tan4", 9132587,
+"chocolate1", 16744228,
+"chocolate2", 15627809,
+"chocolate3", 13461021,
+"chocolate4", 9127187,
+"firebrick1", 16724016,
+"firebrick2", 15608876,
+"firebrick3", 13444646,
+"firebrick4", 9116186,
+"brown1", 16728128,
+"brown2", 15612731,
+"brown3", 13447987,
+"brown4", 9118499,
+"salmon1", 16747625,
+"salmon2", 15630946,
+"salmon3", 13463636,
+"salmon4", 9129017,
+"LightSalmon1", 16752762,
+"LightSalmon2", 15635826,
+"LightSalmon3", 13468002,
+"LightSalmon4", 9131842,
+"orange1", 16753920,
+"orange2", 15636992,
+"orange3", 13468928,
+"orange4", 9132544,
+"DarkOrange1", 16744192,
+"DarkOrange2", 15627776,
+"DarkOrange3", 13460992,
+"DarkOrange4", 9127168,
+"coral1", 16740950,
+"coral2", 15624784,
+"coral3", 13458245,
+"coral4", 9125423,
+"tomato1", 16737095,
+"tomato2", 15621186,
+"tomato3", 13455161,
+"tomato4", 9123366,
+"OrangeRed1", 16729344,
+"OrangeRed2", 15613952,
+"OrangeRed3", 13448960,
+"OrangeRed4", 9118976,
+"red1", 16711680,
+"red2", 15597568,
+"red3", 13434880,
+"red4", 9109504,
+"DeepPink1", 16716947,
+"DeepPink2", 15602313,
+"DeepPink3", 13439094,
+"DeepPink4", 9112144,
+"HotPink1", 16740020,
+"HotPink2", 15624871,
+"HotPink3", 13459600,
+"HotPink4", 9124450,
+"pink1", 16758213,
+"pink2", 15641016,
+"pink3", 13472158,
+"pink4", 9134956,
+"LightPink1", 16756409,
+"LightPink2", 15639213,
+"LightPink3", 13470869,
+"LightPink4", 9133925,
+"PaleVioletRed1", 16745131,
+"PaleVioletRed2", 15628703,
+"PaleVioletRed3", 13461641,
+"PaleVioletRed4", 9127773,
+"maroon1", 16725171,
+"maroon2", 15610023,
+"maroon3", 13445520,
+"maroon4", 9116770,
+"VioletRed1", 16727702,
+"VioletRed2", 15612556,
+"VioletRed3", 13447800,
+"VioletRed4", 9118290,
+"magenta1", 16711935,
+"magenta2", 15597806,
+"magenta3", 13435085,
+"magenta4", 9109643,
+"orchid1", 16745466,
+"orchid2", 15629033,
+"orchid3", 13461961,
+"orchid4", 9127817,
+"plum1", 16759807,
+"plum2", 15642350,
+"plum3", 13473485,
+"plum4", 9135755,
+"MediumOrchid1", 14706431,
+"MediumOrchid2", 13721582,
+"MediumOrchid3", 11817677,
+"MediumOrchid4", 8009611,
+"DarkOrchid1", 12533503,
+"DarkOrchid2", 11680494,
+"DarkOrchid3", 10105549,
+"DarkOrchid4", 6824587,
+"purple1", 10170623,
+"purple2", 9514222,
+"purple3", 8201933,
+"purple4", 5577355,
+"MediumPurple1", 11240191,
+"MediumPurple2", 10451438,
+"MediumPurple3", 9005261,
+"MediumPurple4", 6113163,
+"thistle1", 16769535,
+"thistle2", 15651566,
+"thistle3", 13481421,
+"thistle4", 9141131,
+"gray0", 0,
+"grey0", 0,
+"gray1", 197379,
+"grey1", 197379,
+"gray2", 328965,
+"grey2", 328965,
+"gray3", 526344,
+"grey3", 526344,
+"gray4", 657930,
+"grey4", 657930,
+"gray5", 855309,
+"grey5", 855309,
+"gray6", 986895,
+"grey6", 986895,
+"gray7", 1184274,
+"grey7", 1184274,
+"gray8", 1315860,
+"grey8", 1315860,
+"gray9", 1513239,
+"grey9", 1513239,
+"gray10", 1710618,
+"grey10", 1710618,
+"gray11", 1842204,
+"grey11", 1842204,
+"gray12", 2039583,
+"grey12", 2039583,
+"gray13", 2171169,
+"grey13", 2171169,
+"gray14", 2368548,
+"grey14", 2368548,
+"gray15", 2500134,
+"grey15", 2500134,
+"gray16", 2697513,
+"grey16", 2697513,
+"gray17", 2829099,
+"grey17", 2829099,
+"gray18", 3026478,
+"grey18", 3026478,
+"gray19", 3158064,
+"grey19", 3158064,
+"gray20", 3355443,
+"grey20", 3355443,
+"gray21", 3552822,
+"grey21", 3552822,
+"gray22", 3684408,
+"grey22", 3684408,
+"gray23", 3881787,
+"grey23", 3881787,
+"gray24", 4013373,
+"grey24", 4013373,
+"gray25", 4210752,
+"grey25", 4210752,
+"gray26", 4342338,
+"grey26", 4342338,
+"gray27", 4539717,
+"grey27", 4539717,
+"gray28", 4671303,
+"grey28", 4671303,
+"gray29", 4868682,
+"grey29", 4868682,
+"gray30", 5066061,
+"grey30", 5066061,
+"gray31", 5197647,
+"grey31", 5197647,
+"gray32", 5395026,
+"grey32", 5395026,
+"gray33", 5526612,
+"grey33", 5526612,
+"gray34", 5723991,
+"grey34", 5723991,
+"gray35", 5855577,
+"grey35", 5855577,
+"gray36", 6052956,
+"grey36", 6052956,
+"gray37", 6184542,
+"grey37", 6184542,
+"gray38", 6381921,
+"grey38", 6381921,
+"gray39", 6513507,
+"grey39", 6513507,
+"gray40", 6710886,
+"grey40", 6710886,
+"gray41", 6908265,
+"grey41", 6908265,
+"gray42", 7039851,
+"grey42", 7039851,
+"gray43", 7237230,
+"grey43", 7237230,
+"gray44", 7368816,
+"grey44", 7368816,
+"gray45", 7566195,
+"grey45", 7566195,
+"gray46", 7697781,
+"grey46", 7697781,
+"gray47", 7895160,
+"grey47", 7895160,
+"gray48", 8026746,
+"grey48", 8026746,
+"gray49", 8224125,
+"grey49", 8224125,
+"gray50", 8355711,
+"grey50", 8355711,
+"gray51", 8553090,
+"grey51", 8553090,
+"gray52", 8750469,
+"grey52", 8750469,
+"gray53", 8882055,
+"grey53", 8882055,
+"gray54", 9079434,
+"grey54", 9079434,
+"gray55", 9211020,
+"grey55", 9211020,
+"gray56", 9408399,
+"grey56", 9408399,
+"gray57", 9539985,
+"grey57", 9539985,
+"gray58", 9737364,
+"grey58", 9737364,
+"gray59", 9868950,
+"grey59", 9868950,
+"gray60", 10066329,
+"grey60", 10066329,
+"gray61", 10263708,
+"grey61", 10263708,
+"gray62", 10395294,
+"grey62", 10395294,
+"gray63", 10592673,
+"grey63", 10592673,
+"gray64", 10724259,
+"grey64", 10724259,
+"gray65", 10921638,
+"grey65", 10921638,
+"gray66", 11053224,
+"grey66", 11053224,
+"gray67", 11250603,
+"grey67", 11250603,
+"gray68", 11382189,
+"grey68", 11382189,
+"gray69", 11579568,
+"grey69", 11579568,
+"gray70", 11776947,
+"grey70", 11776947,
+"gray71", 11908533,
+"grey71", 11908533,
+"gray72", 12105912,
+"grey72", 12105912,
+"gray73", 12237498,
+"grey73", 12237498,
+"gray74", 12434877,
+"grey74", 12434877,
+"gray75", 12566463,
+"grey75", 12566463,
+"gray76", 12763842,
+"grey76", 12763842,
+"gray77", 12895428,
+"grey77", 12895428,
+"gray78", 13092807,
+"grey78", 13092807,
+"gray79", 13224393,
+"grey79", 13224393,
+"gray80", 13421772,
+"grey80", 13421772,
+"gray81", 13619151,
+"grey81", 13619151,
+"gray82", 13750737,
+"grey82", 13750737,
+"gray83", 13948116,
+"grey83", 13948116,
+"gray84", 14079702,
+"grey84", 14079702,
+"gray85", 14277081,
+"grey85", 14277081,
+"gray86", 14408667,
+"grey86", 14408667,
+"gray87", 14606046,
+"grey87", 14606046,
+"gray88", 14737632,
+"grey88", 14737632,
+"gray89", 14935011,
+"grey89", 14935011,
+"gray90", 15066597,
+"grey90", 15066597,
+"gray91", 15263976,
+"grey91", 15263976,
+"gray92", 15461355,
+"grey92", 15461355,
+"gray93", 15592941,
+"grey93", 15592941,
+"gray94", 15790320,
+"grey94", 15790320,
+"gray95", 15921906,
+"grey95", 15921906,
+"gray96", 16119285,
+"grey96", 16119285,
+"gray97", 16250871,
+"grey97", 16250871,
+"gray98", 16448250,
+"grey98", 16448250,
+"gray99", 16579836,
+"grey99", 16579836,
+"gray100", 16777215,
+"grey100", 16777215,
+"dark grey", 11119017,
+"DarkGrey", 11119017,
+"dark gray", 11119017,
+"DarkGray", 11119017,
+"dark blue", 139,
+"DarkBlue", 139,
+"dark cyan", 35723,
+"DarkCyan", 35723,
+"dark magenta", 9109643,
+"DarkMagenta", 9109643,
+"dark red", 9109504,
+"DarkRed", 9109504,
+"light green", 9498256,
+"LightGreen", 9498256
+};
+
diff --git a/plotlib/colorstuff/rgbtest.c b/plotlib/colorstuff/rgbtest.c
new file mode 100644
index 0000000..f30a0a0
--- /dev/null
+++ b/plotlib/colorstuff/rgbtest.c
@@ -0,0 +1,56 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "rgbtbl.h"
+
+main(argc,argv)
+char **argv;
+int argc;
+{
+
+int IC,ic,ncols;
+int i,n,ired,igrn,iblu;
+char teststr[50], c;
+
+IC = sizeof(Colordef);
+ic = sizeof(colordef);
+ncols = ic/IC;
+
+printf("Colordef %d\n",IC);
+printf("colordef %d\n",ic);
+printf("#entries %d\n",ncols);
+
+printf("\nEnter color string: ");
+
+/*if ((c=fgetc(stdin)) != '\n')
+ungetc(c,stdin); */
+
+fgets(teststr,50,stdin);
+printf("strlen = %d\n",strlen(teststr));
+
+if ((n=strlen(teststr)) != 0) {
+ while(n > 0 && teststr[--n] == '\n')
+ teststr[n] = '\0'; }
+
+/*fscanf(stdin,"%s",teststr);*/
+printf("\nTest string = %s\n",teststr);
+
+for (i=0; i < ncols; i++) {
+ if(!strcasecmp(colordef[i].name,teststr)) {
+
+ printf("test string %s found at %d\n",teststr,i);
+ printf("found string %s code %d\n",colordef[i].name,colordef[i].rgb);
+
+ ired = 0x000000ff & (colordef[i].rgb >> 16);
+ igrn = 0x000000ff & (colordef[i].rgb >> 8);
+ iblu = 0x000000ff & (colordef[i].rgb);
+
+ printf("red = %d\ngrn = %d\nblu = %d\n",ired,igrn,iblu);
+ }
+}
+
+}
+
+
diff --git a/plotlib/config.make b/plotlib/config.make
new file mode 100644
index 0000000..0870844
--- /dev/null
+++ b/plotlib/config.make
@@ -0,0 +1,130 @@
+
+#=======================================#
+# Makefile options for Xplot11 library #
+# Set up or select a set of compile #
+# options for your system #
+#=======================================#
+
+
+### Use these to set library name
+### (you might add DP to name to keep double precision version separate)
+PLTLIB = libPlt.a
+#PLTLIB = libPltDP.a
+
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+# This should work for most of the "unix" fortran compilers
+DEFINE = -DUNDERSCORE
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script fort77 or yaf77 or old f77 script
+### Compiler options for Linux GNU compilers include:
+### fort77 perl script (calls f2c/gcc) from RH or from yaf77
+### or the yaf77 or the old f77 shell script from f2c
+### g77 the GNU Fortran compiler
+#
+#FC = g77-3
+#FC = fort77
+#CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+#FFLAGS = -O2 $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using PGI f77
+#FC = pgf77
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -fast -O $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using Intel Fortran compiler 8.x
+FC = ifort
+CC = gcc
+
+# Uncomment to make double-precision version
+#DP = -r8
+
+FFLAGS = -O3 $(DP)
+CFLAGS = -O3 $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for DEC OSF/Alpha
+#FC = f77
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O4 -float $(DEFINE)
+#FFLAGS = -O4 $(DP)
+# Debug flags
+#CFLAGS = -O0 -g -float $(DEFINE)
+#FFLAGS = -O0 -g $(DP)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for RS/6000
+# Note if the library is compiled double precision use the -qautodbl=dbl4
+# option, not the -qautodbl=dblpad4 option. The dblpad4 option puts padding
+# into the argument lists for integer args that cause the polylines and
+# linepatterns to fail as the alignment assumptions between the C and fortran
+# routines are then different. (The problem lies with xlf90, at least you
+# can cure it with a compile option:-). This is not a problem on xlf (f77)
+# because it doesn't have a dblpad4 option...
+#
+#FC = xlf90
+#
+# Uncomment DP to make double-precision version
+#DP = -qautodbl=dbl4
+#FFLAGS = -O -qextname -qfixed $(DP)
+#### Link libs required for xlf90 at ABB (HHY 9/96)
+#LINKLIB = -lX11 -L/venus/u1/fortran/libfor -lxlfabb
+
+###-------------------------------------------------------------------------
+### Uncomment for Sun Open-Windows
+### (give location of X11/xxx.h include files)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#FFLAGS = -O $(DP)
+#CFLAGS = -O -I/usr/openwin/share/include $(DEFINE)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for HP-9000
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O -Aa $(DEFINE)
+#FFLAGS = -O +ppu $(DP)
+#OBJMISC = util-ops.o
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for SGI IRIX
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O $(DEFINE)
+#FFLAGS = -O -static $(DP)
+#RANLIB = ar qs
+#LINKLIB = -lX11
+
diff --git a/plotlib/config.make.DP b/plotlib/config.make.DP
new file mode 100644
index 0000000..a49acbf
--- /dev/null
+++ b/plotlib/config.make.DP
@@ -0,0 +1,129 @@
+
+#=======================================#
+# Makefile options for Xplot11 library #
+# Set up or select a set of compile #
+# options for your system #
+#=======================================#
+
+
+### Use these to set library name
+### (you might add DP to name to keep double precision version separate)
+#PLTLIB = libPlt.a
+PLTLIB = libPltDP.a
+
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+# This should work for most of the "unix" fortran compilers
+DEFINE = -DUNDERSCORE
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script fort77 or yaf77 or old f77 script
+### Compiler options for Linux GNU compilers include:
+### fort77 perl script (calls f2c/gcc) from RH or from yaf77
+### or the yaf77 or the old f77 shell script from f2c
+### g77 the GNU Fortran compiler
+#
+#FC = g77-3
+#FC = fort77
+#CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+#FFLAGS = -O2 $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using PGI f77
+#FC = pgf77
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -fast -O $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using Intel Fortran compiler
+FC = ifort
+CC = gcc
+
+# Uncomment to make double-precision version
+DP = -r8
+FFLAGS = -O3 $(DP)
+CFLAGS = -O3 $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for DEC OSF/Alpha
+#FC = f77
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O4 -float $(DEFINE)
+#FFLAGS = -O4 $(DP)
+# Debug flags
+#CFLAGS = -O0 -g -float $(DEFINE)
+#FFLAGS = -O0 -g $(DP)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for RS/6000
+# Note if the library is compiled double precision use the -qautodbl=dbl4
+# option, not the -qautodbl=dblpad4 option. The dblpad4 option puts padding
+# into the argument lists for integer args that cause the polylines and
+# linepatterns to fail as the alignment assumptions between the C and fortran
+# routines are then different. (The problem lies with xlf90, at least you
+# can cure it with a compile option:-). This is not a problem on xlf (f77)
+# because it doesn't have a dblpad4 option...
+#
+#FC = xlf90
+#
+# Uncomment DP to make double-precision version
+#DP = -qautodbl=dbl4
+#FFLAGS = -O -qextname -qfixed $(DP)
+#### Link libs required for xlf90 at ABB (HHY 9/96)
+#LINKLIB = -lX11 -L/venus/u1/fortran/libfor -lxlfabb
+
+###-------------------------------------------------------------------------
+### Uncomment for Sun Open-Windows
+### (give location of X11/xxx.h include files)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#FFLAGS = -O $(DP)
+#CFLAGS = -O -I/usr/openwin/share/include $(DEFINE)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for HP-9000
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O -Aa $(DEFINE)
+#FFLAGS = -O +ppu $(DP)
+#OBJMISC = util-ops.o
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for SGI IRIX
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O $(DEFINE)
+#FFLAGS = -O -static $(DP)
+#RANLIB = ar qs
+#LINKLIB = -lX11
+
diff --git a/plotlib/config.make.QP b/plotlib/config.make.QP
new file mode 100644
index 0000000..63a5792
--- /dev/null
+++ b/plotlib/config.make.QP
@@ -0,0 +1,129 @@
+
+#=======================================#
+# Makefile options for Xplot11 library #
+# Set up or select a set of compile #
+# options for your system #
+#=======================================#
+
+
+### Use these to set library name
+### (you might add QP to name to keep quad precision version separate)
+#PLTLIB = libPlt.a
+PLTLIB = libPltQP.a
+
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+# This should work for most of the "unix" fortran compilers
+DEFINE = -DUNDERSCORE
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script fort77 or yaf77 or old f77 script
+### Compiler options for Linux GNU compilers include:
+### fort77 perl script (calls f2c/gcc) from RH or from yaf77
+### or the yaf77 or the old f77 shell script from f2c
+### g77 the GNU Fortran compiler
+#
+#FC = g77-3
+#FC = fort77
+#CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+#FFLAGS = -O2 $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using PGI f77
+#FC = pgf77
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -fast -O $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using Intel Fortran compiler
+FC = ifort
+CC = gcc
+
+# Uncomment to make quad-precision version
+DP = -r16
+FFLAGS = -O3 $(DP)
+CFLAGS = -O3 $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for DEC OSF/Alpha
+#FC = f77
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O4 -float $(DEFINE)
+#FFLAGS = -O4 $(DP)
+# Debug flags
+#CFLAGS = -O0 -g -float $(DEFINE)
+#FFLAGS = -O0 -g $(DP)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for RS/6000
+# Note if the library is compiled double precision use the -qautodbl=dbl4
+# option, not the -qautodbl=dblpad4 option. The dblpad4 option puts padding
+# into the argument lists for integer args that cause the polylines and
+# linepatterns to fail as the alignment assumptions between the C and fortran
+# routines are then different. (The problem lies with xlf90, at least you
+# can cure it with a compile option:-). This is not a problem on xlf (f77)
+# because it doesn't have a dblpad4 option...
+#
+#FC = xlf90
+#
+# Uncomment DP to make double-precision version
+#DP = -qautodbl=dbl4
+#FFLAGS = -O -qextname -qfixed $(DP)
+#### Link libs required for xlf90 at ABB (HHY 9/96)
+#LINKLIB = -lX11 -L/venus/u1/fortran/libfor -lxlfabb
+
+###-------------------------------------------------------------------------
+### Uncomment for Sun Open-Windows
+### (give location of X11/xxx.h include files)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#FFLAGS = -O $(DP)
+#CFLAGS = -O -I/usr/openwin/share/include $(DEFINE)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for HP-9000
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O -Aa $(DEFINE)
+#FFLAGS = -O +ppu $(DP)
+#OBJMISC = util-ops.o
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for SGI IRIX
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O $(DEFINE)
+#FFLAGS = -O -static $(DP)
+#RANLIB = ar qs
+#LINKLIB = -lX11
+
diff --git a/plotlib/config.make.SP b/plotlib/config.make.SP
new file mode 100644
index 0000000..0870844
--- /dev/null
+++ b/plotlib/config.make.SP
@@ -0,0 +1,130 @@
+
+#=======================================#
+# Makefile options for Xplot11 library #
+# Set up or select a set of compile #
+# options for your system #
+#=======================================#
+
+
+### Use these to set library name
+### (you might add DP to name to keep double precision version separate)
+PLTLIB = libPlt.a
+#PLTLIB = libPltDP.a
+
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+# This should work for most of the "unix" fortran compilers
+DEFINE = -DUNDERSCORE
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script fort77 or yaf77 or old f77 script
+### Compiler options for Linux GNU compilers include:
+### fort77 perl script (calls f2c/gcc) from RH or from yaf77
+### or the yaf77 or the old f77 shell script from f2c
+### g77 the GNU Fortran compiler
+#
+#FC = g77-3
+#FC = fort77
+#CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+#FFLAGS = -O2 $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using PGI f77
+#FC = pgf77
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -fast -O $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using Intel Fortran compiler 8.x
+FC = ifort
+CC = gcc
+
+# Uncomment to make double-precision version
+#DP = -r8
+
+FFLAGS = -O3 $(DP)
+CFLAGS = -O3 $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for DEC OSF/Alpha
+#FC = f77
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O4 -float $(DEFINE)
+#FFLAGS = -O4 $(DP)
+# Debug flags
+#CFLAGS = -O0 -g -float $(DEFINE)
+#FFLAGS = -O0 -g $(DP)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for RS/6000
+# Note if the library is compiled double precision use the -qautodbl=dbl4
+# option, not the -qautodbl=dblpad4 option. The dblpad4 option puts padding
+# into the argument lists for integer args that cause the polylines and
+# linepatterns to fail as the alignment assumptions between the C and fortran
+# routines are then different. (The problem lies with xlf90, at least you
+# can cure it with a compile option:-). This is not a problem on xlf (f77)
+# because it doesn't have a dblpad4 option...
+#
+#FC = xlf90
+#
+# Uncomment DP to make double-precision version
+#DP = -qautodbl=dbl4
+#FFLAGS = -O -qextname -qfixed $(DP)
+#### Link libs required for xlf90 at ABB (HHY 9/96)
+#LINKLIB = -lX11 -L/venus/u1/fortran/libfor -lxlfabb
+
+###-------------------------------------------------------------------------
+### Uncomment for Sun Open-Windows
+### (give location of X11/xxx.h include files)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#FFLAGS = -O $(DP)
+#CFLAGS = -O -I/usr/openwin/share/include $(DEFINE)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for HP-9000
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O -Aa $(DEFINE)
+#FFLAGS = -O +ppu $(DP)
+#OBJMISC = util-ops.o
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for SGI IRIX
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O $(DEFINE)
+#FFLAGS = -O -static $(DP)
+#RANLIB = ar qs
+#LINKLIB = -lX11
+
diff --git a/plotlib/config.make.g77 b/plotlib/config.make.g77
new file mode 100644
index 0000000..490330e
--- /dev/null
+++ b/plotlib/config.make.g77
@@ -0,0 +1,129 @@
+
+#=======================================#
+# Makefile options for Xplot11 library #
+# Set up or select a set of compile #
+# options for your system #
+#=======================================#
+
+
+### Use these to set library name
+### (you might add DP to name to keep double precision version separate)
+PLTLIB = libPlt_g77.a
+#PLTLIB = libPltDP.a
+
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+# This should work for most of the "unix" fortran compilers
+DEFINE = -DUNDERSCORE
+
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script fort77 or yaf77 or old f77 script
+### Compiler options for Linux GNU compilers include:
+### fort77 perl script (calls f2c/gcc) from RH or from yaf77
+### or the yaf77 or the old f77 shell script from f2c
+### g77 the GNU Fortran compiler
+#
+FC = g77
+#FC = fort77
+CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+FFLAGS = -O2 $(DP)
+CFLAGS = -O2 $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using PGI f77
+#FC = pgf77
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -fast -O $(DP)
+#CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using Intel Fortran compiler
+#FC = ifc
+#CC = gcc
+##
+# Uncomment to make double-precision version
+#DP = -r8
+#FFLAGS = -O3 $(DP)
+#CFLAGS = -O3 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+#LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for DEC OSF/Alpha
+#FC = f77
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O4 -float $(DEFINE)
+#FFLAGS = -O4 $(DP)
+# Debug flags
+#CFLAGS = -O0 -g -float $(DEFINE)
+#FFLAGS = -O0 -g $(DP)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for RS/6000
+# Note if the library is compiled double precision use the -qautodbl=dbl4
+# option, not the -qautodbl=dblpad4 option. The dblpad4 option puts padding
+# into the argument lists for integer args that cause the polylines and
+# linepatterns to fail as the alignment assumptions between the C and fortran
+# routines are then different. (The problem lies with xlf90, at least you
+# can cure it with a compile option:-). This is not a problem on xlf (f77)
+# because it doesn't have a dblpad4 option...
+#
+#FC = xlf90
+#
+# Uncomment DP to make double-precision version
+#DP = -qautodbl=dbl4
+#FFLAGS = -O -qextname -qfixed $(DP)
+#### Link libs required for xlf90 at ABB (HHY 9/96)
+#LINKLIB = -lX11 -L/venus/u1/fortran/libfor -lxlfabb
+
+###-------------------------------------------------------------------------
+### Uncomment for Sun Open-Windows
+### (give location of X11/xxx.h include files)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#FFLAGS = -O $(DP)
+#CFLAGS = -O -I/usr/openwin/share/include $(DEFINE)
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for HP-9000
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O -Aa $(DEFINE)
+#FFLAGS = -O +ppu $(DP)
+#OBJMISC = util-ops.o
+#LINKLIB = -lX11
+
+###-------------------------------------------------------------------------
+### Uncomment for SGI IRIX
+### (use ANSI-C standard, use underscored C-routine names)
+#
+# Uncomment DP to make double-precision version
+#DP = -r8
+#CFLAGS = -O $(DEFINE)
+#FFLAGS = -O -static $(DP)
+#RANLIB = ar qs
+#LINKLIB = -lX11
+
diff --git a/plotlib/examples/Makefile b/plotlib/examples/Makefile
new file mode 100644
index 0000000..8d37dda
--- /dev/null
+++ b/plotlib/examples/Makefile
@@ -0,0 +1,151 @@
+#***********************************************************************
+# Module: Makefile (examples directory)
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@mit.edu
+#***********************************************************************
+
+########################################
+# makefile for Xplot11 library examples
+########################################
+
+
+###================================================
+### This line includes your compiler/make options
+### with definitions for compiler and flags
+
+include ../config.make
+
+###================================================
+
+LIB = ../$(PLTLIB)
+
+#FC = ifort
+#FFLAGS = -r8
+
+PROGS = volts volts_old \
+ symbols symbolsall \
+ squares squaresdoublebuff \
+ spectrum cmap2 cmap3 defmap \
+ gridtest zoomtest contest
+
+
+examples: $(PROGS)
+
+
+test: $(PROGS)
+
+clean:
+ -/bin/rm *.o
+ -/bin/rm $(PROGS)
+ -/bin/rm plot*.ps
+
+
+
+#Test routines for package
+
+volts: volts.o
+ $(FC) -o volts volts.o $(LIB) $(LINKLIB)
+
+volts_old: volts_old.o
+ $(FC) -o volts_old volts_old.o $(LIB) $(LINKLIB)
+
+symbols: symbols.o
+ $(FC) -o symbols symbols.o $(LIB) $(LINKLIB)
+
+symbolsall: symbolsall.o
+ $(FC) -o symbolsall symbolsall.o $(LIB) $(LINKLIB)
+
+squares: squares.o
+ $(FC) -o squares squares.o $(LIB) $(LINKLIB)
+
+squaresdoublebuff: squaresdoublebuff.o
+ $(FC) -o squaresdoublebuff squaresdoublebuff.o $(LIB) $(LINKLIB)
+
+spectrum: spectrum.o
+ $(FC) -o spectrum spectrum.o $(LIB) $(LINKLIB)
+
+cmap2: cmap2.o
+ $(FC) -o cmap2 cmap2.o $(LIB) $(LINKLIB)
+
+cmap3: cmap3.o
+ $(FC) -o cmap3 cmap3.o $(LIB) $(LINKLIB)
+
+defmap: defmap.o
+ $(FC) -o defmap defmap.o $(LIB) $(LINKLIB)
+
+gridtest: gridtest.o
+ $(FC) -o gridtest gridtest.o $(LIB) $(LINKLIB)
+
+zoomtest: zoomtest.o
+ $(FC) -o zoomtest zoomtest.o $(LIB) $(LINKLIB)
+
+contest: contest.o
+ $(FC) -o contest contest.o $(LIB) $(LINKLIB)
+
+
+
+volts.o: volts.f
+ $(FC) -c $(FFLAGS) $<
+
+volts_old.o: volts_old.f
+ $(FC) -c $(FFLAGS) $<
+
+symbols.o: symbols.f
+ $(FC) -c $(FFLAGS) $<
+
+symbolsall.o: symbolsall.f
+ $(FC) -c $(FFLAGS) $<
+
+squares.o: squares.f
+ $(FC) -c $(FFLAGS) $<
+
+squaresdoublebuff.o: squaresdoublebuff.f
+ $(FC) -c $(FFLAGS) $<
+
+spectrum.o: spectrum.f
+ $(FC) -c $(FFLAGS) $<
+
+cmap2.o: cmap2.f
+ $(FC) -c $(FFLAGS) $<
+
+cmap3.o: cmap3.f
+ $(FC) -c $(FFLAGS) $<
+
+defmap.o: defmap.f
+ $(FC) -c $(FFLAGS) $<
+
+gridtest.o: gridtest.f
+ $(FC) -c $(FFLAGS) $<
+
+zoomtest.o: zoomtest.f
+ $(FC) -c $(FFLAGS) $<
+
+contest.o: contest.f
+ $(FC) -c $(FFLAGS) $<
+
+#May need to specify these on a brain-dead make system
+#.f.o: $(FC) -c $(FFLAGS) $<
+#.c.o: $(CC) -c $(CFLAGS) $<
+
+
+
+
+
+
diff --git a/plotlib/examples/Makefile.NT b/plotlib/examples/Makefile.NT
new file mode 100644
index 0000000..5647c43
--- /dev/null
+++ b/plotlib/examples/Makefile.NT
@@ -0,0 +1,187 @@
+#***********************************************************************
+# Module: Makefile (examples directory)
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@mit.edu
+#***********************************************************************
+
+
+
+########################################
+# makefile for Xplot11 library examples
+########################################
+
+PLTLIB = ..\libPlt.lib
+#PLTLIB = ..\libPltDP.lib
+
+AR = lib
+
+#### Link libs
+LINKLIB = gdi32.lib user32.lib
+
+###================================================
+### Compaq Visual Fortran compiler and flags, install commands
+#FC = f77
+#CC = cl
+### Defines for C interface
+#DEFINE = -DUNDERSCORE -D_CVF
+### Uncomment DP to make double-precision version
+#DP = /realsize:64
+#FFLAGS = /Oxp $(DP) /threads
+#CFLAGS = $(DEFINE) -MT
+#LFLAGS = /libs:qwin /threads /LINK /NODEFAULTLIB:LIBC.LIB
+
+###================================================
+### Intel Fortran compiler and flags, install commands
+FC = ifl.exe
+LINK32 = xilink.exe
+#
+FC = ifl
+CC = cl
+### Defines for C interface
+#DEFINE = -DUNDERSCORE
+# Uncomment DP to make double-precision version
+#DP = /4R8
+### use flags for processor optimization G5 G6 G7 for PII,PIII,P4
+FFLAGS = /O2 $(DP) /MT /4Yportlib -W0
+CFLAGS = $(DEFINE) -MT
+LFLAGS = /MT /link /NODEFAULTLIB:LIBC.LIB
+
+###================================================
+
+
+
+PROGS = symbols.exe symbolsall.exe \
+ squares.exe squaresdoublebuff.exe \
+ spectrum.exe cmap2.exe cmap3.exe defmap.exe \
+ gridtest.exe zoomtest.exe contest.exe \
+ volts.exe volts_old.exe
+
+
+examples: $(PROGS)
+
+
+test: $(PROGS)
+
+clean:
+ del *.obj
+ del $(PROGS)
+ del plot*.ps
+
+
+
+#Test routines for package
+
+volts.exe: volts.obj
+ $(FC) /Fevolts.exe volts.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+volts_old.exe: volts_old.obj
+ $(FC) /Fevolts_old.exe volts_old.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+symbols.exe: symbols.obj
+ $(FC) /Fesymbols.exe symbols.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+symbolsall.exe: symbolsall.obj
+ $(FC) /Fesymbolsall.exe symbolsall.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+squares.exe: squares.obj
+ $(FC) /Fesquares.exe squares.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+squares3.exe: squares3.obj
+ $(FC) squares3.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+squaresdoublebuff.exe: squaresdoublebuff.obj
+ $(FC) /Fesquaresdoublebuff.exe squaresdoublebuff.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+spectrum.exe: spectrum.obj
+ $(FC) /Fespectrum.exe spectrum.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+cmap2.exe: cmap2.obj
+ $(FC) /Fecmap2.exe cmap2.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+cmap3.exe: cmap3.obj
+ $(FC) /Fecmap3.exe cmap3.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+defmap.exe: defmap.obj
+ $(FC) /Fedefmap.exe defmap.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+gridtest.exe: gridtest.obj
+ $(FC) /Fegridtest.exe gridtest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+zoomtest.exe: zoomtest.obj
+ $(FC) /Fezoomtest.exe zoomtest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+contest.exe: contest.obj
+ $(FC) /Fecontest.exe contest.obj $(PLTLIB) $(LINKLIB) $(LFLAGS)
+
+
+
+volts.obj: volts.f
+ $(FC) /c $(FFLAGS) volts.f
+
+volts_old.obj: volts_old.f
+ $(FC) /c $(FFLAGS) volts_old.f
+
+symbols.obj: symbols.f
+ $(FC) /c $(FFLAGS) symbols.f
+
+symbolsall.obj: symbolsall.f
+ $(FC) /c $(FFLAGS) symbolsall.f
+
+squares.obj: squares.f
+ $(FC) /c $(FFLAGS) squares.f
+
+squares3.obj: squares3.f
+ $(FC) /c $(FFLAGS) squares3.f
+
+squaresdoublebuff.obj: squaresdoublebuff.f
+ $(FC) /c $(FFLAGS) squaresdoublebuff.f
+
+spectrum.obj: spectrum.f
+ $(FC) /c $(FFLAGS) spectrum.f
+
+cmap2.obj: cmap2.f
+ $(FC) /c $(FFLAGS) cmap2.f
+
+cmap3.obj: cmap3.f
+ $(FC) /c $(FFLAGS) cmap3.f
+
+defmap.obj: defmap.f
+ $(FC) /c $(FFLAGS) defmap.f
+
+gridtest.obj: gridtest.f
+ $(FC) /c $(FFLAGS) gridtest.f
+
+zoomtest.obj: zoomtest.f
+ $(FC) /c $(FFLAGS) zoomtest.f
+
+contest.obj: contest.f
+ $(FC) /c $(FFLAGS) contest.f
+
+#May need to specify these on a brain-dead make system
+#.f.obj: $(FC) /c $(FFLAGS) $<
+#.c.obj: $(CC) /c $(CFLAGS) $<
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/Readme-examples b/plotlib/examples/Readme-examples
new file mode 100644
index 0000000..6d8276e
--- /dev/null
+++ b/plotlib/examples/Readme-examples
@@ -0,0 +1,95 @@
+/***********************************************************************
+ Module: Readme-examples
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+Make the test programs under Unix by:
+
+change options in ../config.make to match your environment
+ % make
+
+Make the test programs under Windoze:
+
+You need Visual C and either the Compaq Visual Fortran compiler or the Intel
+Fortran compiler.
+compile and link with command in DOS window:
+
+C:\Xfoil\plotlib\examples: nmake /f Makefile.NT
+
+
+
+
+Sample and test programs
+-------------------------
+
+volts.f - demo program that draws a simple, labeled plot with axes.
+
+volts_old.f - demo program that draws a simple, labeled plot with axes.
+ (uses old "Versatec" plot calls)
+
+squares.f - draws a sine wave in colored boxes, has colored labels
+
+squaresdoublebuff.f - demo of double buffering, draws a sine wave in colored
+ boxes that cycle across the sine wave w/o flickering
+
+gridtest.f - tests the grid routines (obvious, aren't we...)
+
+symbols.f
+symbolsall.f - display and test the vector fonts
+
+cmap2.f
+cmap3.f - used for interactive viewing of RGB color components:
+
+zoomtest.f - test of zooming
+
+contest.f - test of contouring primitives for color, filled contours
+
+defmap.f - displays the default colormap produced by CALL COLORMAPDEFAULT
+
+spectrum.f - displays the "Spectrum" produced by
+ CALL COLORSPECTRUMHUES(ncols, RYGCBM_string)
+ in pie and bar form.
+
+ Typical values for RYGCBM_string might be
+ 'RYG'
+ 'GYR'
+ 'MCY'
+ 'BMRY'
+ 'BCGYR', etc.
+
+ Choosing strongly non-contiguous sequences like 'RCB' is OK,
+ but will make a horrid-looking Spectrum.
+
+sym/test.f - display current vector fonts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/cmap2.f b/plotlib/examples/cmap2.f
new file mode 100644
index 0000000..c2ae015
--- /dev/null
+++ b/plotlib/examples/cmap2.f
@@ -0,0 +1,222 @@
+C***********************************************************************
+C Module: cmap.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ program cmap2
+c---------------------------------------------------------------
+c Color selection program.
+c
+c Displays a 2-D slice through the R-G-B color space,
+c and gives the R,G,B components of a mouse-selected color.
+c
+c The cutting plane is parallel to the RG, RB, or GB plane.
+c The position along the remaining B, G, or R axis is specified
+c by the % saturation 0..100.
+c
+c---------------------------------------------------------------
+c
+ character*2 plane
+ character*1 axis, chkey
+c
+ character*40 colorname
+c
+ dimension x(5), y(5)
+ logical lok
+c
+ ch = 0.03
+c
+ 1000 format(a)
+c
+ 5 write(*,1050)
+ 1050 format(/' Enter cutting-plane orientation (RG, RB, or GB): ',$)
+ read (*,1000) plane
+c
+ axis = ' '
+ if(index('RGrg',plane(1:1)).NE.0 .AND.
+ & index('RGrg',plane(2:2)).NE.0 ) axis = 'B'
+ if(index('RBrb',plane(1:1)).NE.0 .AND.
+ & index('RBrb',plane(2:2)).NE.0 ) axis = 'G'
+ if(index('Gbgb',plane(1:1)).NE.0 .AND.
+ & index('Gbgb',plane(2:2)).NE.0 ) axis = 'R'
+c
+ccc if(index('RGB',axis).EQ.0) go to 5
+ if(index('RGB',axis).EQ.0) then
+ call replot(4)
+ call plot(0.,0.,+999)
+ stop
+ endif
+c
+c
+ write(*,1100) axis
+ 1100 format( ' Enter % saturation along ',a1,' axis (0..100) : ', $)
+ read (*,*) isat
+c
+ isat = max( 0,isat)
+ isat = min( 99,isat)
+c
+ nc = 10
+c
+ sat = float(isat) / 100.0
+c
+c
+c---- R,G,B unit vectors for projection onto x-y cutting plane
+ xr = 0.
+ yr = 0.
+ zr = 0.
+c
+ xg = 0.
+ yg = 0.
+ zg = 0.
+c
+ xb = 0.
+ yb = 0.
+ zb = 0.
+c
+ if(sat .lt. 0.50) then
+c
+ if(index('R',axis).EQ.1) then
+ zr = 1.0
+ xg = 1.0
+ yb = 1.0
+ endif
+c
+ if(index('G',axis).EQ.1) then
+ yr = 1.0
+ zg = 1.0
+ xb = 1.0
+ endif
+c
+ if(index('B',axis).EQ.1) then
+ xr = 1.0
+ yg = 1.0
+ zb = 1.0
+ endif
+c
+ else
+c
+ if(index('R',axis).EQ.1) then
+ zr = 1.0
+ yg = 1.0
+ xb = 1.0
+ endif
+c
+ if(index('G',axis).EQ.1) then
+ xr = 1.0
+ zg = 1.0
+ yb = 1.0
+ endif
+c
+ if(index('B',axis).EQ.1) then
+ yr = 1.0
+ xg = 1.0
+ zb = 1.0
+ endif
+c
+ endif
+c
+C
+C---Initialize the plot package before we get into color plotting...
+ CALL PLINITIALIZE
+c
+ call PLOPEN(0.8,0,1)
+ call PLOT(5.5, 4.25, -3)
+ call NEWFACTOR(6.0)
+ call PLOT(-0.5,-0.5,-3)
+c
+c call plopen(-0.8,0,5)
+c call plot(0.5,0.5,-3)
+c call newfactor(1.4)
+c
+ xdel = 1.0/float(nc)
+ ydel = 1.0/float(nc)
+c
+ do 10 j = 1, nc
+ y0 = ydel*float(j-1)
+c
+ do 105 i = 1, nc
+ x0 = xdel*float(i-1)
+c
+ xx = x0 + 0.5*xdel
+ yy = y0 + 0.5*ydel
+ zz = sat
+c
+ r = xx*xr + yy*yr + zz*zr
+ g = xx*xg + yy*yg + zz*zg
+ b = xx*xb + yy*yb + zz*zb
+c
+ ir = int(256.0*r)
+ ig = int(256.0*g)
+ ib = int(256.0*b)
+c
+ x(1) = x0
+ y(1) = y0
+ x(2) = x0 + xdel
+ y(2) = y0
+ x(3) = x0 + xdel
+ y(3) = y0 + ydel
+ x(4) = x0
+ y(4) = y0 + ydel
+ x(5) = x0
+ y(5) = y0
+ n = 5
+c
+ call NEWCOLORRGB(ir,ig,ib)
+ call POLYLINE(x,y,n,1)
+c
+ 105 continue
+ 10 continue
+c
+ call PLFLUSH
+c
+ write(*,*)
+ write(*,*) 'Click on colors...'
+C
+ 200 call GETCURSORXY(xx,yy,chkey)
+ zz = sat
+c
+ r = xx*xr + yy*yr + zz*zr
+ g = xx*xg + yy*yg + zz*zg
+ b = xx*xb + yy*yb + zz*zb
+c
+ ir = int(256.0*r)
+ ig = int(256.0*g)
+ ib = int(256.0*b)
+c
+ write(*,1500) ir, ig, ib
+ 1500 format(1x,'R G B = ', i4,',',i4,',',i4)
+c
+ if( lok(ir,ig,ib) ) then
+ go to 200
+ endif
+c
+ go to 5
+ end
+
+
+
+ logical function lok(ir,ig,ib)
+ lok = ir.LE.255 .AND. ig.LE.255 .AND. ib.LE.255 .AND.
+ & ir.GE.0 .AND. ig.GE.0 .AND. ib.GE.0
+ return
+ end
+
diff --git a/plotlib/examples/cmap3.f b/plotlib/examples/cmap3.f
new file mode 100644
index 0000000..ce9939f
--- /dev/null
+++ b/plotlib/examples/cmap3.f
@@ -0,0 +1,198 @@
+C***********************************************************************
+C Module: cmap3.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ program cmap3
+c---------------------------------------------------------------
+c Color selection program.
+c
+c Displays a 2-D slice through the R-G-B color space,
+c and gives the R,G,B components of a mouse-selected color.
+c
+c The cutting plane is perpendicular to the diagonal
+c axis running from R,G,B = 0,0,0 (black), to
+c R,G,B = 1,1,1 (white). The position of this cutting
+c plane is specified by the % saturation 0..300.
+c The plane passes through one or three pure-color
+c corners for the specific saturations shown.
+c
+c 0% (0 0 0) black
+c 100% (1 0 0), (0 1 0), (0 0 1) red , green , blue
+c 200% (1 1 0), (1 0 1), (0 1 1) yellow, magenta, cyan
+c 300% (1 1 1) white
+c
+c For 0-100% and 200-300%, the cutting plane is a triangle.
+c For 100-200%, the plane is a hexagon.
+c
+c---------------------------------------------------------------
+c
+ dimension x(4), y(4)
+ logical lok
+ character*1 chkey
+c
+ ch = 0.03
+ call PLINITIALIZE
+c
+ 1 continue
+c
+ write(*,1100)
+ 1100 format(/' Enter % saturation (0..300) : ', $)
+ read (*,*) isat
+c
+ if(isat.eq.0) go to 500
+c
+ isat = max( 1,isat)
+ isat = min(299,isat)
+c
+ nc1 = 10
+c
+ nc = nc1
+ if(isat.gt.100) nc = (nc1*isat)/ 100
+ if(isat.gt.200) nc = (nc1*200 )/(300-isat) + 1
+c
+ sat = float(isat) / 100.0
+c
+c
+c---- R,G,B unit vectors for projection onto x-y cutting plane
+ xr = -sat
+ yr = -sat/sqrt(3.0)
+c
+ xg = 0.0
+ yg = sat*2.0/sqrt(3.0)
+c
+ xb = sat
+ yb = -sat/sqrt(3.0)
+c
+ call COLORMAPDEFAULT
+c
+ call PLOPEN(0.8,0,1)
+c
+ call PLOT(5.5, 4.25, -3)
+ call NEWFACTOR(3.0)
+c
+c
+ area = sat * 2.0*sqrt(3.0)
+c
+ xdel = sat* 2.0 /float(nc)
+ ydel = sat*sqrt(3.0)/float(nc)
+c
+ do 10 j = 1, nc
+ y0 = yr + ydel*float(j-1)
+c
+ do 105 i = 1, nc-j+1
+ x0 = xr + xdel*(float(i-1) + 0.5*float(j-1))
+c
+ xx = x0 + 0.5*xdel
+ yy = y0 + ydel/3.0
+c
+ r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area
+ g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area
+ b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area
+c
+ ir = int(256.0*r)
+ ig = int(256.0*g)
+ ib = int(256.0*b)
+c
+ if( lok(ir,ig,ib) ) then
+ x(1) = x0
+ y(1) = y0
+ x(2) = x0 + xdel
+ y(2) = y0
+ x(3) = x0 + xdel*0.5
+ y(3) = y0 + ydel
+ x(4) = x0
+ y(4) = y0
+ n = 4
+c
+ call NEWCOLORRGB(ir,ig,ib)
+ call POLYLINE(x,y,n,1)
+ endif
+c
+c
+ if(i.eq.nc-j+1) go to 105
+
+ xx = x0 + xdel
+ yy = y0 + 2.0*ydel/3.0
+c
+ r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area
+ g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area
+ b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area
+c
+ ir = int(256.0*r)
+ ig = int(256.0*g)
+ ib = int(256.0*b)
+c
+ if( lok(ir,ig,ib) ) then
+ x(1) = x0 + xdel
+ y(1) = y0
+ x(2) = x0 + xdel*1.5
+ y(2) = y0 + ydel
+ x(3) = x0 + xdel*0.5
+ y(3) = y0 + ydel
+ x(4) = x0 + xdel
+ y(4) = y0
+ n = 4
+c
+ call NEWCOLORRGB(ir,ig,ib)
+ call POLYLINE(x,y,n,1)
+ endif
+c
+ 105 continue
+ 10 continue
+c
+ call PLFLUSH
+c
+ write(*,*) 'Click on colors...'
+C
+ 200 call GETCURSORXY(xx,yy,chkey)
+c
+ r = ((xg-xb)*(yy-yb) - (yg-yb)*(xx-xb))/area
+ g = ((xb-xr)*(yy-yr) - (yb-yr)*(xx-xr))/area
+ b = ((xr-xg)*(yy-yg) - (yr-yg)*(xx-xg))/area
+c
+ ir = int(256.0*r)
+ ig = int(256.0*g)
+ ib = int(256.0*b)
+c
+ write(*,1500) ir, ig, ib
+ 1500 format(1x,'R G B = ', i4,',',i4,',',i4)
+c
+ if( lok(ir,ig,ib) ) then
+ go to 200
+ endif
+c
+ go to 1
+c
+ 500 call PLOT(0.0,0.0,+999)
+ stop
+C
+ end
+
+
+
+ logical function lok(ir,ig,ib)
+ lok = ir.LE.255 .AND. ig.LE.255 .AND. ib.LE.255 .AND.
+ & ir.GE.0 .AND. ig.GE.0 .AND. ib.GE.0
+ return
+ end
+
diff --git a/plotlib/examples/colors.inc b/plotlib/examples/colors.inc
new file mode 100644
index 0000000..08d8657
--- /dev/null
+++ b/plotlib/examples/colors.inc
@@ -0,0 +1,58 @@
+C***********************************************************************
+C Module: colors.inc
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C
+C******************************************
+C Default color definitions for Xplot11
+C For use as arguments to NEWCOLOR, e.g.
+C
+C CALL NEWCOLOR(GREEN)
+C
+C
+C Alternatively, can also use...
+C
+C CALL NEWCOLORNAME('GREEN')
+C
+C******************************************
+C
+ Integer BLACK,
+ & WHITE,
+ & RED,
+ & ORANGE,
+ & YELLOW,
+ & GREEN,
+ & CYAN,
+ & BLUE,
+ & VIOLET,
+ & MAGENTA
+C
+ parameter (BLACK = 1)
+ parameter (WHITE = 2)
+ parameter (RED = 3)
+ parameter (ORANGE = 4)
+ parameter (YELLOW = 5)
+ parameter (GREEN = 6)
+ parameter (CYAN = 7)
+ parameter (BLUE = 8)
+ parameter (VIOLET = 9)
+ parameter (MAGENTA = 10)
diff --git a/plotlib/examples/contest.f b/plotlib/examples/contest.f
new file mode 100644
index 0000000..c4f2e33
--- /dev/null
+++ b/plotlib/examples/contest.f
@@ -0,0 +1,212 @@
+C***********************************************************************
+C Module: contest.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+ program contest
+C
+C--- Test of Xplot11 quadrilateral and triangle contour primitives
+C
+ CHARACTER CHR*2, HUES*10
+ DIMENSION X(4), Y(4), Z(4)
+ DIMENSION XTRI(3), YTRI(3), ZTRI(3)
+C
+ DIMENSION XCU(50), YCU(50)
+ DIMENSION XCL(50), YCL(50)
+ DIMENSION XP(50), YP(50), NE(50)
+C
+ DATA X / 0., 1., 1., 0. /
+ DATA Y / 0., 0., 1., 1. /
+ DATA Z / 0., 1., 0., 2. /
+C
+ IDEV = 3
+ nlevel = 50
+ ncolors = 64
+ WRITE(*,*) ' '
+ WRITE(*,*) 'Contour primitives test:'
+ WRITE(*,*) ' (contour fills on single square polygon)'
+ WRITE(*,*) ' '
+ WRITE(*,*) 'Data points...'
+ do i = 1, 4
+ write(*,*) i,' x = ',X(i),' y = ',Y(i),' z = ',Z(i)
+ end do
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) CHR
+ ips = -1
+ if(CHR.ne.' ') then
+ READ(CHR,*,end=2000,err=2000) ips
+ endif
+ IDEV = 1
+ IF(ips.eq.0) IDEV = 3
+ IF(ips.ge.1) IDEV = 5
+ ipslu = 0
+C
+C--- Get contour data
+ ZL = 0.
+ ZU = 2.
+ write(*,*) ' '
+ write(*,*) 'Contour limits ',ZL,' to ',ZU
+ write(*,*) 'Enter # of contour levels'
+ read (*,*) nlevel
+C
+ ipslu = 0
+ CALL PLINITIALIZE
+ HUES = 'ROYGCBM'
+C
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 0
+ CALL COLORSPECTRUMHUES(ncolors,HUES)
+C
+ do ITYP = 1, 2
+C
+ CALL PLOPEN(0.5,ipslu,IDEV)
+
+ call newcolorname('green')
+ CALL PLOTABS(.75,.75,-3)
+ CALL PLCHAR (999.,999.,.1,'Contour test ',0.,-1)
+ if(ITYP.NE.2) then
+ WRITE(*,*) 'Polygon contoured and filled as quadrilateral'
+ CALL PLCHAR (999.,999.,.1,'Quadrilateral',0.,-1)
+ else
+ WRITE(*,*) 'Polygon contoured and filled as two triangles'
+ CALL PLCHAR (999.,999.,.1,'Two Triangles',0.,-1)
+ endif
+ CALL PLOT(0.,-0.5,-3)
+ CALL PLCHAR (999.,999.,.1,'Nlevels = ',0.,-1)
+ CALL PLNUMB (999.,999.,.1,FLOAT(nlevel),0.,-1)
+ CALL PLCHAR (999.,999.,.1,' Ncolors = ',0.,-1)
+ CALL PLNUMB (999.,999.,.1,FLOAT(ncolors),0.,-1)
+ CALL PLOT(2.,2.,-3)
+ call factor(4.)
+C
+C--- Set contour levels and increments
+ NCONT = NLEVEL + 1
+ DZ = (ZU-ZL)/FLOAT(NCONT)
+C
+ DO N = 1, NCONT
+ ZUPR = FLOAT(N)*DZ
+ ZLWR = FLOAT(N-1)*DZ
+C
+C--- Set color based on contour #
+ ICOL = (NCOLORS-1)*FLOAT(N-1)/FLOAT(NCONT-1) + 1
+ CALL NEWCOLOR(-ICOL)
+C
+C--- Reset the line and area counters for each level
+ NA = 0
+ NV = 0
+ NCU = 0
+ NCL = 0
+C
+ if(ITYP.NE.2) then
+C
+C--- Contour a quadrilateral
+ CALL CONTQUAD(X,Y,Z,ZUPR,ZLWR,
+ & NCU,XCU,YCU,
+ & NCL,XCL,YCL,
+ & NA,NE,NV,XP,YP)
+C
+ else
+C
+C--- Triangle contouring, use two triangles, split quad on 1-3 diagonal
+ xtri(1) = x(1)
+ ytri(1) = y(1)
+ ztri(1) = z(1)
+ xtri(2) = x(2)
+ ytri(2) = y(2)
+ ztri(2) = z(2)
+ xtri(3) = x(3)
+ ytri(3) = y(3)
+ ztri(3) = z(3)
+ CALL CONTTRI(xtri,ytri,ztri,ZUPR,ZLWR,
+ & NCU,XCU,YCU,
+ & NCL,XCL,YCL,
+ & NA,NE,NV,XP,YP)
+ xtri(1) = x(3)
+ ytri(1) = y(3)
+ ztri(1) = z(3)
+ xtri(2) = x(4)
+ ytri(2) = y(4)
+ ztri(2) = z(4)
+ xtri(3) = x(1)
+ ytri(3) = y(1)
+ ztri(3) = z(1)
+ CALL CONTTRI(xtri,ytri,ztri,ZUPR,ZLWR,
+ & NCU,XCU,YCU,
+ & NCL,XCL,YCL,
+ & NA,NE,NV,XP,YP)
+ endif
+C
+C
+C--- Plot the filled contour polygons
+ nv = 1
+ DO IA = 1, NA
+ call polyline(xp(nv),yp(nv),ne(ia),1)
+ nv = nv+ne(ia)
+ END DO
+C
+C--- Plot the contour lines (w/o color in this case).
+C Otherwise you could leave out the polygon fills and comment out the
+C color change to BLACK to get colored line contours.
+C
+ call newcolorname('BLACK')
+C--- All lower contour lines
+ do nn = 1, ncl,2
+ call plot(xcl(nn),ycl(nn),3)
+ call plot(xcl(nn+1),ycl(nn+1),2)
+ end do
+C--- And the last upper line
+ if(N.EQ.NCONT) then
+ do nn = 1, ncu,2
+ call plot(xcu(nn),ycu(nn),3)
+ call plot(xcu(nn+1),ycu(nn+1),2)
+ end do
+ endif
+C
+ END DO
+ CALL PLFLUSH
+C
+ read(*,1000) chr
+ CALL PLOT(0.,0.,-999)
+C
+ end do
+ CALL PLOT(0.,0.,+999)
+C
+ 1000 FORMAT(A)
+C
+ 2000 STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/defmap.f b/plotlib/examples/defmap.f
new file mode 100644
index 0000000..1223f10
--- /dev/null
+++ b/plotlib/examples/defmap.f
@@ -0,0 +1,133 @@
+C***********************************************************************
+C Module: defmap.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ program defmap
+C
+C Displays Default colormap in a bar
+C
+C
+ dimension xp(100), yp(100), x(100), y(100)
+C
+ character*24 colorname, inp*2
+C
+ CH = 0.125
+C
+ PI = 4.0*ATAN(1.0)
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ ips = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ips
+ endif
+ IDEV = 1
+ IF(ips.eq.0) IDEV = 3
+ IF(ips.ge.1) IDEV = 5
+ ipslu = 0
+C
+C---- for REPLOT: X11 only
+ IDEVRP = 1
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ ncolors = 10
+C
+ CALL PLOPEN(0.7,ipslu,IDEV)
+ CALL PLOTABS(1.5,1.0,-3)
+c
+ call GETCOLOR(ICOL0)
+C
+c---- plot bar
+ dx = 1.0
+ dy = 5.0/float(ncolors)
+ do ii = 1,ncolors
+ call NEWCOLOR(ii)
+c
+ x0 = 0.0
+ y0 = dy*float(ii-1)
+c
+ xp(1) = x0
+ yp(1) = y0
+ xp(2) = x0+dx
+ yp(2) = y0
+ xp(3) = x0+dx
+ yp(3) = y0+dy
+ xp(4) = x0
+ yp(4) = y0+dy
+ xp(5) = xp(1)
+ yp(5) = yp(1)
+ call POLYLINE(xp,yp,5,1)
+C
+ call GETCOLORRGB(ii,ired,igrn,iblu,colorname)
+C
+ xplt = xp(2) + 3.0*ch
+ yplt = 0.5*(yp(2)+yp(3)) - 0.5*ch
+ call plnumb(xplt,yplt,ch,float(ii),0.0,-1)
+C
+ xplt = xplt + 6.0*ch
+ call plchar(xplt,yplt,ch,colorname,0.0,24)
+C
+ xplt = xplt + 26.0*ch
+ call NEWCOLORRGB(255,0,0)
+ call plnumb(xplt,yplt,ch,float(ired),0.0,-1)
+C
+ xplt = xplt + 4.0*ch
+ call NEWCOLORRGB(0,255,0)
+ call plnumb(xplt,yplt,ch,float(igrn),0.0,-1)
+C
+ xplt = xplt + 4.0*ch
+ call NEWCOLORRGB(0,0,255)
+ call plnumb(xplt,yplt,ch,float(iblu),0.0,-1)
+c
+ end do
+C
+ call NEWCOLOR(ICOL0)
+ xplt = 0.0
+ yplt = yplt + dy + 2.0*ch
+ call plchar(xplt,yplt,1.5*ch,'Default Colormap',0.0,16)
+C
+ CALL PLFLUSH
+C
+ WRITE(*,*) 'Hit return to end test'
+ READ(5,1000) DUMMY
+ 1000 FORMAT(A)
+C
+C GO TO 1
+C
+ 2000 CALL PLOT(0.0,0.0,+999)
+ STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/gridtest.f b/plotlib/examples/gridtest.f
new file mode 100644
index 0000000..a045896
--- /dev/null
+++ b/plotlib/examples/gridtest.f
@@ -0,0 +1,108 @@
+C***********************************************************************
+C Module: gridtest.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C Example/Test of grid routine
+C Sets up two plots, each containing a grid with a label and symbol line
+C First plot comes up as B&W in portrait window
+C Second plot comes up as color in larger landscape window
+C
+ INCLUDE 'colors.inc'
+ CHARACTER INP*10
+ DATA LMASK1, LMASK2 / -32640, -30584 /
+ DATA LMASK3, LMASK4/ -21846, Z'AAAAAAAA'/
+C
+C---- number of grid intervals per axis annotation interval
+ NGR = 2
+C
+ XMIN=.1
+ YMIN=.1
+ XMAX=.9
+ YMAX=.6
+ XDEL = 0.1
+ YDEL = 0.1
+ XSF = 1.0
+ YSF = 1.0
+ NXG = NGR * INT((XMAX-XMIN)/XDEL + 0.001)
+ NYG = NGR * INT((YMAX-YMIN)/YDEL + 0.001)
+ DXG = XSF*XDEL / FLOAT(NGR)
+ DYG = YSF*YDEL / FLOAT(NGR)
+C
+ CH = 0.03
+ SH = 0.2*CH
+C
+C---What devices to plot to?
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ IOUT = -1
+ if(INP.NE.' ') READ(INP,*,end=2000,err=2000) IOUT
+ 2 IF(IOUT.LT.0) IDEV = 1
+ IF(IOUT.EQ.0) IDEV = 3
+ IF(IOUT.GE.1) IDEV = 5
+C
+C---plot #1 in B&W portrait mode 0.5 of screen height
+ CALL PLINITIALIZE
+ CALL PLOPEN(-0.5,0,IDEV)
+ CALL PLOT(0.1,0.1,-3)
+ CALL NEWPEN(1)
+ CALL NEWFACTOR(10.)
+ CALL PLCHAR(0.2,0.2,1.2*CH,'TEST FOR GRID',0.0,13)
+ CALL PLSYMB(999.,0.2,CH,1,0.0,0)
+ CALL PLSYMB(0.2,0.2,CH,1,0.0,-1)
+ CALL PLGRID(0.0,0.0, NXG,DXG, NYG,DYG, LMASK4)
+ CALL PLFLUSH
+ PAUSE
+ CALL PLOT(0.,0.,-999)
+C
+C---plot #2 in landscape mode 0.7 of screen width
+C (green grid with red lettering with blue symbol line)
+ CALL PLOPEN(0.7,0,IDEV)
+ CALL PLOT(0.1,0.1,-3)
+ CALL NEWFACTOR(10.)
+ CALL NEWPEN(1)
+ NXG = NGR * INT((XMAX-XMIN)/XDEL + 0.001)
+ NYG = NGR * INT((YMAX-YMIN)/YDEL + 0.001)
+ DXG = XSF*XDEL / FLOAT(NGR)
+ DYG = YSF*YDEL / FLOAT(NGR)
+
+ call NEWCOLORNAME('green')
+ CALL PLGRID(0.0,0.0, NXG,DXG, NYG,DYG, LMASK2)
+
+ CALL NEWPEN(1)
+ CALL NEWCOLORRGB(255,0,0)
+ CALL PLCHAR(0.2,0.2,1.2*CH,'TEST FOR GRID',0.0,13)
+ call NEWCOLOR(BLUE)
+ call NEWPEN(1)
+ CALL PLSYMB(999.,0.2,CH,1,0.0,0)
+ CALL PLSYMB(0.2,0.2,CH,1,0.0,-1)
+ CALL PLFLUSH
+ PAUSE
+ CALL PLCLOSE
+C
+ 1000 FORMAT(A)
+ 2000 STOP
+ END
+
+
+
+
diff --git a/plotlib/examples/masks.inc b/plotlib/examples/masks.inc
new file mode 100644
index 0000000..a8248f3
--- /dev/null
+++ b/plotlib/examples/masks.inc
@@ -0,0 +1,35 @@
+C***********************************************************************
+C Module: masks.inc
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C
+C---- dot-pattern masks for use with PLGRID, NEWPAT, etc.
+C
+C mask0: _________________________ (solid)
+C 1: .........................
+C 2: . . . . . . . . . . . . .
+C 3: . . . . . . .
+C 4: . . . .
+C
+ data mask0, mask1, mask2, mask3, mask4
+ & / -1 , -21846, -30584, -32640, -32768 /
+
diff --git a/plotlib/examples/spectrum.f b/plotlib/examples/spectrum.f
new file mode 100644
index 0000000..fadf1f5
--- /dev/null
+++ b/plotlib/examples/spectrum.f
@@ -0,0 +1,143 @@
+C***********************************************************************
+C Module: spectrum.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ program spectrum
+C
+C Displays chosen COLORSPECTRUMDEFAULT colors in a circle and bar
+C
+C
+ dimension xp(100), yp(100)
+C
+ CHARACTER*12 HUES
+ CHARACTER*4 INP
+ CH = 0.02
+C
+ PI = 4.0*ATAN(1.0)
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ ips = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ips
+ endif
+ IDEV = 1
+ IF(ips.eq.0) IDEV = 3
+ IF(ips.ge.1) IDEV = 5
+ ipslu = 0
+C
+C---- for REPLOT: X11 only
+ IDEVRP = 1
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter number of colors'
+ READ(*,1000,end=2000) INP
+ ncolors = 128
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C
+ WRITE(*,*) ' Specify hue string (out of ROYGCBM)'
+ READ (*,1000) HUES
+ IF(HUES.EQ.' ') HUES = 'ROYGCBM'
+C
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 0
+ CALL COLORSPECTRUMHUES(ncolors,HUES)
+C
+C---- radius of circle
+ rad = 3.0
+c
+ CALL PLOPEN(0.7,ipslu,IDEV)
+ CALL PLOT(1.3*rad,1.3*rad,-3)
+c
+c---- plot circle
+ do ii = 1,ncolors
+ call NEWCOLOR(-ii)
+ t0 = float(ii-1)/float(ncolors) ! + 0.167
+ t1 = float(ii )/float(ncolors) ! + 0.167
+C
+ xp(1) = 0.0
+ yp(1) = 0.0
+ xp(2) = rad*cos(2.0*pi*t0)
+ yp(2) = rad*sin(2.0*pi*t0)
+ xp(3) = rad*cos(2.0*pi*(t0+0.25*(t1-t0)))
+ yp(3) = rad*sin(2.0*pi*(t0+0.25*(t1-t0)))
+ xp(4) = rad*cos(2.0*pi*(t0+0.50*(t1-t0)))
+ yp(4) = rad*sin(2.0*pi*(t0+0.50*(t1-t0)))
+ xp(5) = rad*cos(2.0*pi*(t0+0.75*(t1-t0)))
+ yp(5) = rad*sin(2.0*pi*(t0+0.75*(t1-t0)))
+ xp(6) = rad*cos(2.0*pi*t1)
+ yp(6) = rad*sin(2.0*pi*t1)
+ call POLYLINE(xp,yp,6,1)
+ end do
+C
+ CALL PLOT(1.5*rad,-rad,-3)
+C
+c---- plot bar
+ dx = 1.0
+ dy = 2.0*rad/float(ncolors)
+ do ii = 1,ncolors
+ call NEWCOLOR(-ii)
+c
+ x0 = 0.0
+ y0 = dy*float(ii-1)
+c
+ xp(1) = x0
+ yp(1) = y0
+ xp(2) = x0+dx
+ yp(2) = y0
+ xp(3) = x0+dx
+ yp(3) = y0+dy
+ xp(4) = x0
+ yp(4) = y0+dy
+ call POLYLINE(xp,yp,4,1)
+ end do
+C
+ CALL NEWCOLORNAME('black')
+ CALL PLOTABS(1.,.75,-3)
+ CALL PLCHAR (999.,999.,.1,'SPECTRUM ',0.,+10)
+ CALL PLCHAR (999.,999.,.1,HUES,0.,LEN(HUES))
+ CALL PLOTABS(1.,0.5,-3)
+ CALL PLCHAR (999.,999.,.1,'Ncolors = ',0.,+10)
+ CALL PLNUMB (999.,999.,.1,FLOAT(ncolors),0.,-1)
+C
+ CALL PLFLUSH
+ WRITE(*,*) 'Hit return to test replot'
+ READ(5,1000) DUMMY
+C
+ CALL REPLOT(IDEVRP)
+ CALL PLFLUSH
+C
+ WRITE(*,*) 'Hit return to end test'
+ READ(5,1000) DUMMY
+ 1000 FORMAT(A)
+C
+C GO TO 1
+C
+ 2000 CALL PLOT(0.0,0.0,+999)
+ STOP
+ END
diff --git a/plotlib/examples/squares.f b/plotlib/examples/squares.f
new file mode 100644
index 0000000..5cce511
--- /dev/null
+++ b/plotlib/examples/squares.f
@@ -0,0 +1,120 @@
+C***********************************************************************
+C Module: squares.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C---Test of filled polyline plotting
+C Displays a sine wave of filled color rectangles
+ dimension xp(100), yp(100), x(100), y(100)
+C
+ CHARACTER*4 INP
+ CH = 0.02
+C
+ x(1) = 0.
+ y(1) = 0.
+ x(2) = 0.5
+ y(2) = 0.
+ x(3) = 0.5
+ y(3) = 0.3
+ x(4) = 0.
+ y(4) = 0.3
+ x(5) = x(1)
+ y(5) = y(1)
+ n = 5
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ WRITE(*,*) 'SQUARES Plot test'
+ WRITE(*,*) ' You may just <cr> for each question to take defaults'
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ ips = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ips
+ endif
+ IDEV = 1
+ IF(ips.eq.0) IDEV = 3
+ IF(ips.ge.1) IDEV = 5
+ ipslu = 0
+C
+C---- for REPLOT: X11 only
+ IDEVRP = 1
+C
+C
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)'
+ READ(*,1000,end=2000) INP
+ ncolors = 64
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 0
+ CALL COLORSPECTRUMHUES(ncolors,'MBCGYR')
+C
+C
+ CALL PLOPEN(0.7,ipslu,IDEV)
+C
+ CALL PLOT(0.5,0.5,-3)
+ do ii = 1,ncolors
+ call NEWCOLOR(-ii)
+ f = float(ii-1)/float(ncolors-1)
+ xx = 9.0*f
+ yy = 3.0*sin(2.0*3.1416*f)
+ do i = 1, n
+ xp(i) = x(i) + xx
+ yp(i) = 4.0 + y(i) + yy
+ end do
+ call POLYLINE(xp,yp,n,1)
+ end do
+C
+ CALL NEWCOLORNAME('green')
+ CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5)
+ CALL NEWCOLORRGB(0,0,255)
+ CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3)
+ CALL NEWCOLORNAME('yellow')
+ CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6)
+ CALL NEWCOLORNAME('red')
+ CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4)
+C
+ CALL PLFLUSH
+C
+ WRITE(*,*) 'Hit return to test replot'
+ READ(5,1000) DUMMY
+ CALL REPLOT(IDEVRP)
+ CALL PLFLUSH
+C
+ WRITE(*,*) 'Hit return to end test'
+ READ(5,1000) DUMMY
+ 1000 FORMAT(A)
+C
+ 2000 CALL PLCLOSE
+ STOP
+ END
+
+
+
+
+
+
diff --git a/plotlib/examples/squares2.f b/plotlib/examples/squares2.f
new file mode 100644
index 0000000..8345c4f
--- /dev/null
+++ b/plotlib/examples/squares2.f
@@ -0,0 +1,126 @@
+C***********************************************************************
+C Module: squares.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C---Test of filled polyline plotting
+C Displays a sine wave of filled color rectangles
+ dimension xp(100), yp(100), x(100), y(100)
+C
+ CHARACTER*4 INP
+ CH = 0.02
+C
+ x(1) = 0.
+ y(1) = 0.
+ x(2) = 0.5
+ y(2) = 0.
+ x(3) = 0.5
+ y(3) = 0.3
+ x(4) = 0.
+ y(4) = 0.3
+ x(5) = x(1)
+ y(5) = y(1)
+ n = 5
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ WRITE(*,*) 'SQUARES Plot test'
+ WRITE(*,*) ' You may just <cr> for each question to take defaults'
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ ips = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ips
+ endif
+ IDEV = 1
+ IF(ips.eq.0) IDEV = 3
+ IF(ips.ge.1) IDEV = 5
+ ipslu = 0
+C
+C---- for REPLOT: X11 only
+ IDEVRP = 1
+C
+C
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)'
+ READ(*,1000,end=2000) INP
+ ncolors = 64
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 0
+ CALL COLORSPECTRUMHUES(ncolors,'MBCGYR')
+C
+ DO III = -1,1,2
+C
+ CALL PLOPEN(float(III)*0.7,ipslu,IDEV)
+C
+ CALL PLOT(0.5,0.5,-3)
+ do ii = 1,ncolors
+ call NEWCOLOR(-ii)
+ f = float(ii-1)/float(ncolors-1)
+ xx = 9.0*f
+ yy = 3.0*sin(2.0*3.1416*f)
+ do i = 1, n
+ xp(i) = x(i) + xx
+ yp(i) = 4.0 + y(i) + yy
+ end do
+ call POLYLINE(xp,yp,n,1)
+ end do
+C
+ CALL NEWCOLORNAME('green')
+ CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5)
+ CALL NEWCOLORRGB(0,0,255)
+ CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3)
+ CALL NEWCOLORNAME('yellow')
+ CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6)
+ CALL NEWCOLORNAME('red')
+ CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4)
+C
+ CALL PLFLUSH
+C
+ WRITE(*,*) 'Hit return to test replot'
+ READ(5,1000) DUMMY
+ END DO
+C
+ WRITE(*,*) 'Hit return to end test'
+ READ(5,1000) DUMMY
+ 1000 FORMAT(A)
+C
+ 2000 CALL PLCLOSE
+ STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/squaresdoublebuff.f b/plotlib/examples/squaresdoublebuff.f
new file mode 100644
index 0000000..62d6d6a
--- /dev/null
+++ b/plotlib/examples/squaresdoublebuff.f
@@ -0,0 +1,140 @@
+C***********************************************************************
+C Module: squares.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C---Test of filled polyline plotting
+C Displays a sine wave of filled color rectangles
+ dimension xp(100), yp(100), x(100), y(100)
+C
+ CHARACTER*4 INP, DUMMY
+ LOGICAL LDBUFF
+ CH = 0.02
+C
+ x(1) = 0.
+ y(1) = 0.
+ x(2) = 0.5
+ y(2) = 0.
+ x(3) = 0.5
+ y(3) = 0.3
+ x(4) = 0.
+ y(4) = 0.3
+ x(5) = x(1)
+ y(5) = y(1)
+ n = 5
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ WRITE(*,*) 'SQUARES Plot test'
+ WRITE(*,*) ' You may just <cr> for each question to take defaults'
+ WRITE(*,*) ' '
+ WRITE(*,*) ' Double buffer? (Y/n)'
+ READ(*,1000,end=2000) INP
+ LDBUFF = .NOT.(INP.EQ.'n' .OR. INP.EQ.'N')
+C
+ IDEV = 1
+ ipslu = 0
+ relsize = 0.7
+ccc relsize = -0.7
+C
+C---- for REPLOT: X11 only
+ IDEVRP = 1
+C
+C
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)'
+ READ(*,1000,end=2000) INP
+ ncolors = 64
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 0
+ CALL COLORSPECTRUMHUES(ncolors,'MBCGYR')
+C
+C---Cycle the colors twice through the sinewave
+ 10 DO IX = 1, 2*ncolors+1
+C
+ CALL PLOPEN(relsize,ipslu,IDEV)
+C---Set up double buffering for plotting
+ IF(LDBUFF) THEN
+ CALL DRAWTOBUFFER
+ ENDIF
+C
+ CALL PLOT(0.5,0.5,-3)
+ do ii = 1,ncolors
+ iix = mod(ii-1+ix-1,ncolors) + 1
+cc write(*,*) 'ii,ix,iix ',ii,ix,iix
+ call NEWCOLOR(-iix)
+ f = float(ii-1)/float(ncolors-1)
+ xx = 9.0*f
+ yy = 3.0*sin(2.0*3.1416*f)
+ do i = 1, n
+ xp(i) = x(i) + xx
+ yp(i) = 4.0 + y(i) + yy
+ end do
+ call POLYLINE(xp,yp,n,1)
+ end do
+C
+ CALL NEWCOLORNAME('green')
+ CALL PLCHAR(0.,0.,10.*CH,'Test ',0.0,5)
+ CALL NEWCOLORRGB(0,0,255)
+ CALL PLCHAR(999.,999.,10.*CH,'of ',0.0,3)
+ CALL NEWCOLORNAME('yellow')
+ CALL PLCHAR(999.,999.,10.*CH,'Color ',0.0,6)
+ CALL NEWCOLORNAME('red')
+ CALL PLCHAR(999.,999.,10.*CH,'Fill',0.0,4)
+C
+C---Display the buffered plot
+c IF(LDBUFF) THEN
+c CALL SHOWBUFFER
+c ELSE
+ CALL PLFLUSH
+c ENDIF
+C
+C---Timing loop hack to slow things down
+c DO I = 1, 1000000
+c XXX = sin(float(i))
+c END DO
+C
+C---Stop every frame as a check
+ccc READ(5,1000) DUMMY
+c
+ END DO
+C
+ccc relsize = -relsize
+C
+ WRITE(*,*) 'Hit return to end test, R to recycle'
+ READ(5,1000) DUMMY
+ IF(DUMMY.EQ.'r' .OR. DUMMY.EQ.'R') GO TO 10
+ 1000 FORMAT(A)
+C
+ 2000 CALL PLCLOSE
+ STOP
+ END
+
+
+
+
+
+
diff --git a/plotlib/examples/symbols.f b/plotlib/examples/symbols.f
new file mode 100644
index 0000000..91f75c0
--- /dev/null
+++ b/plotlib/examples/symbols.f
@@ -0,0 +1,124 @@
+C***********************************************************************
+C Module: symbols.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C---Test routine for Pltlib
+C Displays a symbol set in color
+C
+ CHARACTER*4 INP
+ CH = 0.02
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ WRITE(*,*) 'SYMBOLS Plot test'
+ WRITE(*,*) ' You may just <cr> for each question to take defaults'
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ ihard = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ihard
+ endif
+ IDEV = 1
+ IF(ihard.eq.0) IDEV = 3
+ IF(ihard.ge.1) IDEV = 5
+ ipslu = 0
+C
+C---Initialize the plot package before we get into color plotting...
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)'
+ READ(*,1000,end=2000) INP
+ ncolors = 32
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 1
+ CALL COLORSPECTRUMHUES(ncolors,'MBCGYR')
+C
+C---Take the default window (portrait, 2/3 screen dimension)
+ CALL PLOPEN(0.,ipslu,IDEV)
+C
+ CALL NEWFACTOR(5.0)
+ CALL PLOT(0.10,0.1,-3)
+ccc CALL NEWCOLORNAME('black')
+C
+C---Plot the symbols in 8 columns of 32 characters each (256 total)
+ DO ISET=1, 8
+C
+ I0 = (ISET-1)*32 + 1
+ IN = I0 + 31
+C
+ DO I=I0, IN
+ RNUM = FLOAT(I-1)
+ XX = 0.2*FLOAT(ISET-1)
+ YY = (36.-FLOAT(I-I0))*2.0*CH
+C
+ ICOLOR = MOD(I-1,NCOLORS) + 1
+C WRITE(*,*) 'ICOLOR,ISYM ',ICOLOR,I-1
+C---Select one of the colormap spectrum colors (repeat, modulo ncolors)
+ IF(ncolors.GT.1) CALL NEWCOLOR(-icolor)
+ CALL PLNUMB(XX,YY-0.5*CH,CH,RNUM,0.0,-1)
+ CALL PLCHAR(XX+4.0*CH,YY,CH,char(I-1),0.0,1)
+ END DO
+ END DO
+C
+C---Put colored title at bottom of plot
+ CALL NEWCOLORNAME('blue')
+ CALL PLCHAR(0.,0.,2.*CH,'Xplot11 ',0.0,8)
+ CALL NEWCOLORNAME('green')
+ CALL PLCHAR(999.,999.,2.*CH,'PLCHAR ',0.0,7)
+ CALL NEWCOLORNAME('red')
+ CALL PLCHAR(999.,999.,2.*CH,'test',0.0,4)
+C
+ CALL PLFLUSH
+ WRITE(*,*) 'Hit return to end test'
+ READ(5,1000) INP
+ 1000 FORMAT(A)
+C
+ CALL PLEND
+C GO TO 1
+C
+ 2000 CALL PLCLOSE
+ STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/symbolsall.f b/plotlib/examples/symbolsall.f
new file mode 100644
index 0000000..c220ba5
--- /dev/null
+++ b/plotlib/examples/symbolsall.f
@@ -0,0 +1,148 @@
+C***********************************************************************
+C Module: symbolsall.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C---Test routine for Pltlib
+C Displays a symbol set in color
+C
+ CHARACTER*4 INP, FNAME*80
+ CH = 0.02
+C
+C---Decide about what devices to plot to
+ WRITE(*,*) ' '
+ WRITE(*,*) 'Font plot test'
+ WRITE(*,*) ' You may just <cr> for each question to take defaults'
+ WRITE(*,*) ' '
+ 1 WRITE(*,*) ' Enter -1 for no PS, 0 for B&W PS, 1 for color PS'
+ READ(*,1000,end=2000) INP
+ itype = -1
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) itype
+ endif
+ IDEV = 1
+ IF(itype.eq.0) IDEV = 3
+ IF(itype.ge.1) IDEV = 5
+C
+ WRITE(*,*) ' '
+ WRITE(*,*) ' Enter 0 for default PSfile'
+ WRITE(*,*) ' #>0 for external PSfile on unit #'
+ WRITE(*,*) ' Enter -1 for separate PSfiles'
+ READ(*,1000,end=2000) INP
+ iunit = 0
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) iunit
+ endif
+ if(iunit.gt.0) then
+ WRITE(*,*) 'Enter file name for PSFILE'
+ READ(*,1000,end=2000) FNAME
+ OPEN(unit=iunit,file=FNAME,status='UNKNOWN')
+ endif
+C
+C---Initialize the plot package before we get into color plotting...
+ CALL PLINITIALIZE
+C
+C---Now, how many colors...
+ WRITE(*,*) ' Enter # colors (0 or 1 gives no colors)'
+ READ(*,1000,end=2000) INP
+ ncolors = 32
+ if(INP.ne.' ') then
+ READ(INP,*,end=2000,err=2000) ncolors
+ endif
+C---Set up colormap spectrum colors
+ if(ncolors.LE.1) ncolors = 1
+ CALL COLORSPECTRUMHUES(ncolors,'MBCGYR')
+C
+C---Loop through the four defined fonts and symbols
+ DO 1500 IFNT = 1, 4
+C
+C---Take the default window (portrait, 2/3 screen dimension)
+ CALL PLOPEN(0.,iunit,IDEV)
+C
+ CALL NEWFACTOR(5.0)
+ CALL PLOT(0.10,0.1,-3)
+c CALL NEWCOLORNAME('black')
+C
+C---Plot the symbols in 8 columns of 32 characters each (256 total)
+ DO ISET=1, 8
+C
+ I0 = (ISET-1)*32 + 1
+ IN = I0 + 31
+C
+ DO I=I0, IN
+ RNUM = FLOAT(I-1)
+ XX = 0.2*FLOAT(ISET-1)
+ YY = (36.-FLOAT(I-I0))*2.0*CH
+ ICOLOR = MOD(I-1,NCOLORS) + 1
+C WRITE(*,*) 'ICOLOR,ISYM ',ICOLOR,I-1
+C---Select one of the colormap spectrum colors (repeat, modulo ncolors)
+c write(*,*) ncolors, icolor
+ IF(ncolors.GT.1) CALL NEWCOLOR(-icolor)
+ CALL PLNUMB(XX,YY-0.5*CH,CH,RNUM,0.0,-1)
+ IF(IFNT.EQ.1) CALL PLCHAR(XX+4.0*CH,YY,CH,char(I-1),0.0,1)
+ IF(IFNT.EQ.2) CALL PLSLAN(XX+4.0*CH,YY,CH,char(I-1),0.0,1)
+ IF(IFNT.EQ.3) CALL PLMATH(XX+4.0*CH,YY,CH,char(I-1),0.0,1)
+ IF(IFNT.EQ.4) CALL PLSYMB(XX+4.0*CH,YY,CH,(I-1),0.0,0)
+ END DO
+ END DO
+C
+C---Put colored title at bottom of plot
+ CALL NEWCOLORNAME('blue')
+ CALL PLCHAR(0.,0.,2.*CH,'Xplot11 ',0.0,8)
+ CALL NEWCOLORNAME('green')
+ IF(IFNT.EQ.1) CALL PLCHAR(999.,999.,2.*CH,'PLCHAR ',0.0,7)
+ IF(IFNT.EQ.2) CALL PLCHAR(999.,999.,2.*CH,'PLSLAN ',0.0,7)
+ IF(IFNT.EQ.3) CALL PLCHAR(999.,999.,2.*CH,'PLMATH ',0.0,7)
+ IF(IFNT.EQ.4) CALL PLCHAR(999.,999.,2.*CH,'PLSYMB ',0.0,7)
+ CALL NEWCOLORNAME('red')
+ CALL PLCHAR(999.,999.,2.*CH,'test',0.0,4)
+C
+ CALL PLFLUSH
+ WRITE(*,*) 'Hit return to proceed...'
+ READ(5,1000) INP
+ 1000 FORMAT(A)
+C
+ CALL PLEND
+C
+ 1500 CONTINUE
+C
+ 2000 CALL PLCLOSE
+ STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/volts.f b/plotlib/examples/volts.f
new file mode 100644
index 0000000..7e8cb69
--- /dev/null
+++ b/plotlib/examples/volts.f
@@ -0,0 +1,117 @@
+C***********************************************************************
+C Module: volts.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C
+C...VOLTS
+C Test of Xplot11 interface
+C
+C
+ CHARACTER RDLINE*60
+ DIMENSION X(26),Y(26)
+ DATA X/0.,5.,15.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80.,
+ 1 85.,90.,95.,100.,105.,110.,115.,120.,125.,2*0./
+C
+ DATA Y/0.,10.,15.,10.,-10.,-50.,-80.,-110.,-130.,-145.,-155.,
+ 1 -160.,-158.,-150.,-130.,-90.,-70.,-20.,20.,50.,70.,80.,85.,
+ 2 90.,2*0./
+C
+C
+ 5 FORMAT(A)
+C
+C...Alter actual data scales
+ DO 10 I=1,24
+ X(I) = X(I) * 1000
+ 10 Y(I) = Y(I) / 10000
+C
+ IPD = 1
+ RELSIZ = -0.6
+C
+C...Select type(s) of plot output
+ WRITE(*,40)
+ 40 FORMAT('Input plot device (1 screen, 2 PShardcopy, 3 both): ',$)
+ READ(*,5,end=1000) RDLINE
+ IF(RDLINE.NE.' ') READ(RDLINE,*,err=42) IPD
+C
+C...Get plot window size as fraction of root window
+ 42 WRITE(*,45)
+ 45 FORMAT('Enter window relative size (<ret> gives -0.6): ',$)
+ READ(*,5,end=1000) RDLINE
+ IF(RDLINE.NE.' ') READ(RDLINE,*,err=50) RELSIZ
+C
+ 50 CALL PLINITIALIZE
+ ipslu = 0
+ CALL PLOPEN(RELSIZ,ipslu,IPD)
+C
+ CALL NEWFACTOR(0.9)
+ CALL PLOT(1.05,1.05,-3)
+C
+C...Scale factors from array coordinates
+ CALL SCALE(X,7.,24,+1)
+ CALL SCALE(Y,7.,24,+1)
+C
+ IMASK = -1
+ IMASK = -30584
+C...Test for line mask
+c WRITE(*,*) 'Enter line pattern bit mask (integer)'
+c READ(*,*,end=1000) IMASK
+ call NEWPAT(IMASK)
+C
+C...Plot the array of points
+ CALL NEWPEN (3)
+ CALL NEWCOLORNAME('red')
+ CALL LINE (X,Y,24,1,+1,0)
+ MSKALL = -1
+ call NEWPAT(MSKALL)
+C
+C...Label the axes
+ CALL NEWPEN (2)
+ CALL NEWCOLORNAME('orchid')
+ CALL AXIS (0.,0.,'NANOSECONDS',-11,7.,0.,X(25),X(26))
+ CALL NEWCOLORRGB(0,255,255)
+ CALL AXIS (0.,0.,'MILLIVOLTS',+10,7.,90.,Y(25),Y(26))
+C
+C...Plot legend
+ CALL NEWPEN (1)
+ CALL NEWCOLORNAME('cadetblue')
+ CALL PLCHAR (.5,.5,.1,'DX = ',0.,+5)
+ CALL PLNUMB (999.,999.,.1,X(26),0.,+3)
+ CALL PLNUMB (1.,.75,.1,X(26),0.,0)
+ CALL PLNUMB (1.,1.,.1,X(26),0.,-1)
+ CALL PLNUMB (1.,1.25,.1,X(26),0.,-4)
+C
+C...Titles
+ CALL NEWCOLORNAME('lime green')
+ CALL PLCHAR (2.3,6.5,.1,'VERSAPLOT SAMPLE',0.,+16)
+ CALL PLCHAR (1.5,6.75,.2,'TIME VS VOLTAGE',0.,+15)
+ CALL NEWCOLORNAME('black')
+C
+ CALL PLEND
+ write(*,*) 'Hit return to exit'
+ READ(*,999)
+C
+ 999 FORMAT(A)
+1000 CALL PLCLOSE
+ STOP
+ END
+
+
diff --git a/plotlib/examples/volts_old.f b/plotlib/examples/volts_old.f
new file mode 100644
index 0000000..c6207d9
--- /dev/null
+++ b/plotlib/examples/volts_old.f
@@ -0,0 +1,112 @@
+C***********************************************************************
+C Module: volts_old.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+C VOLTS
+C
+C Old-style Versatec calls test routine
+C
+ LOGICAL LODD
+ DIMENSION X(26),Y(26),RED(9),BLUE(9),GREEN(9),NCOL(2)
+ DATA X/0.,5.,15.,25.,30.,35.,40.,45.,50.,55.,60.,65.,70.,75.,80.,
+ 1 85.,90.,95.,100.,105.,110.,115.,120.,125.,2*0./
+C
+ DATA Y/0.,10.,15.,10.,-10.,-50.,-80.,-110.,-130.,-145.,-155.,
+ 1 -160.,-158.,-150.,-130.,-90.,-70.,-20.,20.,50.,70.,80.,85.,
+ 2 90.,2*0./
+ DATA NCOL/0,8/
+ DATA RED /0.0,0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0/
+ DATA BLUE /0.0,1.0,0.0,0.0,1.0,1.0,0.0,0.0,1.0/
+ DATA GREEN/0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0/
+C
+C
+C...ALTER ACTUAL DATA SCALES
+ DO 10 I=1,24
+ X(I) = X(I) * 1000
+ 10 Y(I) = Y(I) / 10000
+C
+ IDUM = 0
+ ICNT = 0
+ IPD = 6
+ 100 CALL PLOTS (IDUM,0,IPD)
+C
+ LODD = (MOD(ICNT,2).EQ.1)
+ CALL FACTOR (.9)
+ IF(IPD .EQ. 6) THEN
+ DO 20 I=1,NCOL(2)
+ IF(.NOT.LODD) CALL SETCOL(I-1,RED(I),GREEN(I),BLUE(I))
+ IF(LODD) CALL SETCOL(I-1,RED(9-I),GREEN(9-I),BLUE(9-I))
+ 20 CONTINUE
+ ENDIF
+C
+ CALL PLOT (1.05,1.05,-3)
+C
+ CALL SCALE (X,7.,24,+1)
+ CALL SCALE (Y,7.,24,+1)
+C
+ CALL COLOR(2)
+ CALL NEWPEN (2)
+cc CALL LINE (X,Y,24,1,1,0)
+ CALL LINE (X,Y,24,1,1,0)
+ CALL NEWPEN (1)
+ CALL COLOR(0)
+C
+ CALL AXIS (0.,0.,'NANOSECONDS',-11,7.,0.,X(25),X(26))
+ CALL AXIS (0.,0.,'MILLIVOLTS',+10,7.,90.,Y(25),Y(26))
+C
+ CALL SYMBOL (.5,.5,.1,'DX = ',0.,+5)
+ CALL NUMBER (999.,999.,.1,X(26),0.,+3)
+ CALL NUMBER (1.,.75,.1,X(26),0.,0)
+ CALL NUMBER (1.,1.,.1,X(26),0.,-1)
+ CALL NUMBER (1.,1.25,.1,X(26),0.,-4)
+C
+ CALL COLOR(4)
+ CALL SYMBOL (2.3,6.5,.1,'VERSAPLOT SAMPLE',0.,+16)
+ CALL SYMBOL (1.5,6.75,.2,'TIME VS VOLTAGE',0.,+15)
+ CALL COLOR(0)
+ CALL PLOTOF
+C
+ ICNT = ICNT+1
+ CALL PLOT (0.,0.,-999)
+ WRITE(*,*) '<cr> to cycle colors'
+ READ(*,*)
+ if(ICNT.LE.2) go to 100
+
+ CALL PLOT (0.,0.,999)
+ STOP
+ END
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/examples/zoomtest.f b/plotlib/examples/zoomtest.f
new file mode 100644
index 0000000..1def4c5
--- /dev/null
+++ b/plotlib/examples/zoomtest.f
@@ -0,0 +1,123 @@
+C***********************************************************************
+C Module: zoomtest.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ PROGRAM ZOOMTEST
+C
+C---- dot-pattern masks for use with PLGRID, NEWPAT, etc.
+C
+C mask0: _________________________ (solid)
+C 1: .........................
+C 2: . . . . . . . . . . . . .
+C 3: . . . . . . .
+C 4: . . . .
+C
+ CHARACTER LINE*80
+ LOGICAL LXYSAME, LCURSOR
+ data mask0, mask1, mask2, mask3, mask4
+ & / -1 , -21846, -30584, -32640, -32768 /
+
+
+C
+ IDEV = 1
+ IPSLU = 0
+ SIZE = 0.8
+C
+ CH = 0.020
+C
+ CALL PLINITIALIZE
+ CALL PLOPEN(0.78,IPSLU,IDEV)
+ CALL DRAWTOBUFFER
+ CALL NEWFACTOR(SIZE)
+C
+ CALL PLOTABS(1.00,1.00,-3)
+C
+ call PLGRID(0.0,0.0,22,0.5,17,0.5,MASK2)
+ call PLGRID(0.0,0.0,11,1.0, 9,1.0,MASK1)
+ call PLGRID(0.0,0.0, 3,5.0, 2,5.0,MASK0)
+ call PLSLAN(0.1,0.1,0.2,'abcDEF123',0.0,9)
+ CALL NEWCOLORNAME('green')
+ call PLCHAR(1.1,1.1,0.2,'321GHIjkl',0.0,9)
+ CALL NEWCOLORNAME('red')
+ call PLSLAN(2.1,2.1,0.2,'mnoPQR123',0.0,9)
+ CALL NEWCOLORNAME('blue')
+ call PLCHAR(3.1,3.1,0.2,'321STUvwx',0.0,9)
+ CALL NEWCOLORNAME('black')
+c
+ CALL PLFLUSH
+c
+ write(*,*) ' '
+ write(*,*) 'The zoom can be done with same X,Y scales'
+ write(*,*) 'Either mouse or keyboard can set the zoom rectangle'
+ write(*,*) 'Enter XYsame, MouseInput flags (T/F):'
+ LXYSAME = .TRUE.
+ LCURSOR = .TRUE.
+ read(*,1000) LINE
+ if(LINE.NE.' ') THEN
+ read(LINE,*,err=10) LXYSAME,LCURSOR
+ endif
+ 10 write(*,*) ' '
+C
+ do k=1, 3
+ call USETZOOM( LXYSAME , LCURSOR )
+ call REPLOT(1)
+ enddo
+ pause
+ call CLRZOOM
+ call REPLOT(1)
+ pause
+c
+ CALL PLOT(0.0,0.0,+999)
+ 1000 FORMAT(A)
+C
+ END
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/gw_subs.f b/plotlib/gw_subs.f
new file mode 100644
index 0000000..222a123
--- /dev/null
+++ b/plotlib/gw_subs.f
@@ -0,0 +1,625 @@
+C***********************************************************************
+C Module: gw_subs.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 driver for X windows plotting to screen
+C
+C Version 4.46 11/28/01
+C
+C Notes: These routines handle the interface to the graphics screen
+C window. Not normally called by the user.
+C The interface file Xwin.c is needed to link to X11
+C***********************************************************************
+
+ subroutine gw_setup(scrn_fraction)
+C---Sets default size of screen window
+C scrn_fraction relative size (0->1) of graphics window to root window
+C size defaults to 520x670 if scrn_fraction<0.0 and aspect ratio is set
+C by 8.5"x11.0" page size.
+C
+ include 'pltlib.inc'
+ DATA w1size, w2size / DEFAULT_PAGEHEIGHT, DEFAULT_PAGEWIDTH /
+C
+ G_SCRNFRAC = abs(scrn_fraction)
+ G_SCRNFRAC = MIN(1.0,G_SCRNFRAC)
+ IF(scrn_fraction .EQ. 0.0) G_SCRNFRAC = DEFAULT_SCREENFRACTION
+C
+C---set default window size
+ if(scrn_fraction .GE. 0.0) then
+ X_PAGE = w1size
+ Y_PAGE = w2size
+ I_PAGETYPE = Page_Landscape
+ else
+ X_PAGE = w2size
+ Y_PAGE = w1size
+ I_PAGETYPE = Page_Portrait
+ endif
+C
+C---window size in absolute units (pseudo-inches)
+ X_WIND = X_PAGE
+ Y_WIND = Y_PAGE
+C
+C---location of upper left window corner
+ GX_LOC = 0
+ GY_LOC = 0
+C
+C---location of plot origin on window
+ GX_ORG = 0
+ GY_ORG = 0
+C
+ return
+ end
+
+
+
+ subroutine gw_init
+C---Initializes graphics screen plotting and global plot variables
+ include 'pltlib.inc'
+C
+ ixsiz = GX_SIZ
+ iysiz = GY_SIZ
+ ixstart = GX_LOC
+ iystart = GY_LOC
+ scrnfrac = MIN(1.0,G_SCRNFRAC)
+ A_RATIO = Y_WIND/X_WIND
+C
+ if(.NOT.LGW_OPEN) then
+C---Open display and window if not already open
+ call gwxopen(iwidth,iheight,idepth)
+ G_WIDTH = iwidth
+ G_HEIGHT = iheight
+ G_DEPTH = idepth
+C---Adjust window size if fraction of root window is specified
+ if(scrnfrac.GT.0.0) then
+ ix = ifix(scrnfrac*float(G_WIDTH))
+ iy = ifix(scrnfrac*float(G_HEIGHT))
+ if(ix*A_RATIO.LT.iy) then
+ ixsiz = ix
+ iysiz = ifix(A_RATIO*float(ix))
+ else
+ iysiz = iy
+ ixsiz = ifix(float(iy)/A_RATIO)
+ endif
+ endif
+ ixsiz = MIN(ixsiz,G_WIDTH)
+ iysiz = MIN(iysiz,G_HEIGHT)
+ call gwxwinopen(ixstart,iystart,ixsiz,iysiz)
+C---Update flags for reference
+ LGW_OPEN = .TRUE.
+C---Graphics window color is not used if less than 4 bits (16 colors)
+C are available
+ LGW_COLOR = (G_DEPTH.gt.4)
+ if(.NOT.LGW_COLOR) then
+ write(*,*) 'Warning: color depth < 4 bits, color not used...'
+ endif
+C
+C---initial cursor warp will be to middle of window
+ GX_SIZ = ixsiz
+ GY_SIZ = iysiz
+ GX_CRS = GX_ORG + GX_SIZ/2
+ GY_CRS = GY_ORG + GY_SIZ/2
+C
+ else
+C
+C---Window already open, resize if specified
+ if(LGW_RESIZE) then
+C
+ ixorig = ixsiz
+ iyorig = iysiz
+C---Resize window if new fractional size of root window is specified
+ if(scrnfrac.GT.0.0) then
+ ix = ifix(scrnfrac*float(G_WIDTH))
+ iy = ifix(scrnfrac*float(G_HEIGHT))
+ if(ix*A_RATIO.LT.iy) then
+ ixsiz = ix
+ iysiz = ifix(A_RATIO*float(ix))
+ else
+ iysiz = iy
+ ixsiz = ifix(float(iy)/A_RATIO)
+ endif
+ else
+ write(*,*) 'Warning: scrnfrac=0 specified, ignoring...'
+ stop
+ endif
+ ixsiz = MIN(ixsiz,G_WIDTH)
+ iysiz = MIN(iysiz,G_HEIGHT)
+ call gwxresize(ixsiz,iysiz)
+ call gwxstatus(ixstart,iystart,ixsz,iysz)
+ if(ixsz.NE.ixsiz .OR. iysz.NE.iysiz) then
+ write(*,*) 'Window resize fails, using old window size'
+ ixsiz = ixorig
+ iysiz = iyorig
+ endif
+C---Update flags for reference
+ LGW_RESIZE = .FALSE.
+ LGW_CHANGED = .TRUE.
+C
+ else
+C
+C...Graphics window can be moved & resized, so reset position & size parameters
+ call gwxstatus(ixstart,iystart,ixsiz,iysiz)
+ LGW_CHANGED = (ixsiz.ne.GX_SIZ .or. iysiz.ne.GY_SIZ)
+C
+ endif
+C
+ call gwxclear
+ endif
+C
+C---Update size and origin
+ GX_LOC = ixstart
+ GY_LOC = iystart
+ GX_SIZ = ixsiz
+ GY_SIZ = iysiz
+C
+C---initial cursor warp will be to middle of window
+cc GX_CRS = GX_ORG + GX_SIZ/2
+cc GY_CRS = GY_ORG + GY_SIZ/2
+C
+C...Set new scale so that each window dimension is as big as possible
+C but no bigger than X_PAGE or Y_PAGE.
+ G_SCALE = max( float(GX_SIZ-1)/X_PAGE,
+ & float(GY_SIZ-1)/Y_PAGE )
+C
+C...New window dimensions
+ X_WIND = float(GX_SIZ-1)/G_SCALE
+ Y_WIND = float(GY_SIZ-1)/G_SCALE
+C
+ return
+ end
+
+
+ subroutine gw_line(X1,Y1,X2,Y2)
+C---Plots line segment to screen,
+C specified in absolute coordinates from X1,Y1 to X2,Y2
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) then
+C...reverse Y axis for X11 plotting
+ ix1 = GX_ORG + ifix(G_SCALE*X1)
+ ix2 = GX_ORG + ifix(G_SCALE*X2)
+ iy1 = GY_SIZ - (GY_ORG + ifix(G_SCALE*Y1)) - 1
+ iy2 = GY_SIZ - (GY_ORG + ifix(G_SCALE*Y2)) - 1
+ call gwxline(ix1,iy1,ix2,iy2)
+ endif
+C
+ return
+ end
+
+
+
+ subroutine gw_curs(X,Y,kchar)
+C---Gets location of mouse click in graphics window in
+C---absolute coordinates
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) then
+C
+C------ set previous cursor position (if any) for warping destination
+ ix = GX_ORG + GX_CRS
+ iy = GY_SIZ - (GY_ORG + GY_CRS)
+C
+ call gwxcurs(ix,iy,kchar)
+ GX_CRS = ix - GX_ORG
+ GY_CRS = GY_SIZ - iy - GY_ORG
+C
+ X = float(GX_CRS)/G_SCALE
+ Y = float(GY_CRS)/G_SCALE
+C
+ endif
+ return
+ end
+
+
+
+ subroutine gw_revflag
+C---Gets reverse video flag from users environment settings
+ include 'pltlib.inc'
+C
+ call gwxrevflag(irev)
+ LGW_REVVIDEO = (irev.ne.0)
+C
+ return
+ end
+
+
+ subroutine gw_endplot
+C---Flushes current graphics to window and returns control to
+C graphics window temporarily
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) then
+ call gwxflush
+ endif
+C
+ return
+ end
+
+
+ subroutine gw_pen(ipen)
+C...Sets pen width for screen display
+ include 'pltlib.inc'
+ dimension ipmap(5)
+c data ipmap / 0, 0, 2, 3, 4 / <- too wide!
+ data ipmap / 0, 0, 1, 1, 2 /
+C
+ ip = max(1,ipen)
+ ip = min(5,ip)
+ if(LGW_OPEN) then
+ call gwxpen(ipmap(ip))
+ endif
+C
+ return
+ end
+
+
+ subroutine gw_linepattern(ipat)
+C...Sets pen width for screen display
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxdash(ipat)
+ return
+ end
+
+
+ subroutine gw_flush
+C...Flushes out buffered plotting calls to display
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxflush
+ return
+ end
+
+
+ subroutine gw_drawtoscreen
+C...Sets graphics destination to screen
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxdrawtowindow
+ return
+ end
+
+
+ subroutine gw_drawtobuffer
+C...Sets graphics destination to background buffer
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxdrawtobuffer
+ return
+ end
+
+
+ subroutine gw_showbuffer
+C...Displays graphics drawn into background buffer on screen
+C This does not change the current destination for drawing commands
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxdisplaybuffer
+ return
+ end
+
+
+ subroutine gw_clear
+C...Erases graphics display
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) call gwxclear
+ return
+ end
+
+
+ subroutine gw_setsize(nx,ny)
+C...Resizes X-Window X,Y size to nx,ny in pixels
+ include 'pltlib.inc'
+C
+ if(nx.LE.10) then
+ write(*,*) 'No Resize: Window size too small: ',nx,ny
+ return
+ endif
+C
+C...Get current window parameters if display is open
+ if(LGW_OPEN) then
+ call gwxstatus(ixstart,iystart,ixsiz,iysiz)
+ LGW_CHANGED = (ixsiz.ne.GX_SIZ .or. iysiz.ne.GY_SIZ)
+ GX_LOC = ixstart
+ GY_LOC = iystart
+ GX_SIZ = ixsiz
+ GY_SIZ = iysiz
+ endif
+C
+C...Resize and replot the window contents
+ if(LGW_OPEN) then
+ call gwxresize(nx,ny)
+ call gwxstatus(ixstart,iystart,ixsz,iysz)
+ if(ixsz.NE.ixsiz .OR. iysz.NE.iysiz) then
+ write(*,*) 'Window resize fails, using old window size'
+ ixsz = ixsiz
+ iysz = iysiz
+ endif
+C---Update flags and size for reference
+ LGW_RESIZE = .FALSE.
+ LGW_CHANGED = .TRUE.
+ GX_SIZ = ixsz
+ GY_SIZ = iysz
+C
+C---initial cursor warp will be to middle of window
+ GX_CRS = GX_ORG + GX_SIZ/2
+ GY_CRS = GY_ORG + GY_SIZ/2
+C---Set new scale so that each window dimension is as big as possible
+C but no bigger than X_PAGE or Y_PAGE.
+ G_SCALE = max( float(GX_SIZ-1)/X_PAGE,
+ & float(GY_SIZ-1)/Y_PAGE )
+C---New window dimensions
+ X_WIND = float(GX_SIZ-1)/G_SCALE
+ Y_WIND = float(GY_SIZ-1)/G_SCALE
+C---refresh the newly sized window
+ call REPLOT(1)
+ endif
+ return
+ end
+
+
+ subroutine gw_getsize(nx,ny,ppi)
+C...Returns X Window X,Y size in pixels,
+C and plotting scale in pixels/(absolute coordinate)
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) then
+ nx = GX_SIZ
+ ny = GY_SIZ
+ ppi = G_SCALE
+ endif
+ return
+ end
+
+
+ subroutine gw_close
+C---Closes graphics window
+ include 'pltlib.inc'
+C
+ if(LGW_OPEN) then
+ call gwxclose
+ LGW_OPEN = .FALSE.
+ endif
+ return
+ end
+
+
+
+ subroutine gw_cname2rgb(colorname,ired,igrn,iblu)
+C...Determines RGB color components of color defined the color name
+C using the X window color database.
+C
+C colorname = name of color (must be in X windows rgb.txt file)
+C
+C The returned color components are
+C ired = 0-255 red component (-1 for no color)
+C igrn = 0-255 green component
+C iblu = 0-255 blue component
+C
+ include 'pltlib.inc'
+ character colorname*(*), cname*80
+ ired = -1
+ igrn = 0
+ iblu = 0
+ccc nc = len(colorname)
+ cname = colorname
+ call g_strip(cname,nc)
+ if(LGW_OPEN) then
+ call gwxcolorname2rgb(ired,igrn,iblu,nc,cname)
+ endif
+ return
+ end
+
+
+ subroutine gw_allocrgbcolor(ired,igrn,iblu,icolorindex)
+C...Allocates plotting color as defined by RGB components
+C The component colors are
+C ired = 0-255 red component
+C igrn = 0-255 green component
+C iblu = 0-255 blue component
+C
+C icolorindex = returned color index of allocated color in window colormap
+C
+ include 'pltlib.inc'
+ ic = -1
+ if(LGW_OPEN .AND. LGW_COLOR) then
+ ir = ired
+ ig = igrn
+ ib = iblu
+ call gwxallocrgbcolor(ir,ig,ib,ic)
+ icolorindex = ic
+ endif
+ return
+ end
+
+
+ subroutine gw_color(icolor)
+C...Sets foreground plotting color
+C The colors are defined by the colormap
+C
+C The color in the colormap table and colorindex go from 0 -> N_COLOR
+C
+ include 'pltlib.inc'
+c
+ if(LGW_OPEN .AND. LGW_COLOR) then
+c
+ icol = mod(icolor,N_COLOR+1)
+ if(icolor.le.0 .OR. icolor.gt.N_COLOR) then
+ write(*,*) '*** gw_color - color index out of bounds ',icolor
+ return
+ endif
+C
+C...Reverse white and black only in video window if LGW_REVVIDEO is set
+ if(LGW_REVVIDEO) then
+ if(icolor.eq.2) icol = 1
+ if(icolor.eq.1) icol = 2
+ endif
+C
+C...Check colorindex<0 for this color, if so this is an unallocated color
+ ic = G_COLOR_CINDEX(icol)
+C
+C...If color is unallocated, allocate it using the RGB components
+ if (ic.lt.0) then
+ irgb = COLOR_RGB(icol)
+ irg = irgb/256
+ ired = irg/256
+ igrn = irg - 256*ired
+ iblu = irgb - 256*irg
+ call gw_allocrgbcolor(ired,igrn,iblu,ic)
+C
+C...This gives the colorindex in the screen colormap (or -1 for no allocation)
+ if(ic.ge.0) G_COLOR_CINDEX(icol) = ic
+ endif
+C
+C...Now, if colorindex is valid, set the color
+ if(ic.ge.0) call gwxsetcolor(ic)
+c
+ endif
+ return
+ end
+
+
+ subroutine gw_bgcolor(icolor)
+C...Sets background plotting color
+C The colors are defined by the colormap
+C
+C The color in the colormap table and colorindex go from 0 -> N_COLOR
+C
+ include 'pltlib.inc'
+c
+ if(LGW_OPEN .AND. LGW_COLOR) then
+c
+ icol = mod(icolor,N_COLOR+1)
+ if(icolor.le.0 .OR. icolor.gt.N_COLOR) then
+ write(*,*) '*** gw_bgcolor - color index out of bounds ',
+ & icolor
+ return
+ endif
+C
+C...Reverse white and black only in video window if LGW_REVVIDEO is set
+ if(LGW_REVVIDEO) then
+ if(icolor.eq.2) icol = 1
+ if(icolor.eq.1) icol = 2
+ endif
+C
+C...Check colorindex<0 for this color, if so this is an unallocated color
+ ic = G_COLOR_CINDEX(icol)
+C
+C...If color is unallocated, allocate it using the RGB components
+ if (ic.lt.0) then
+ irgb = COLOR_RGB(icol)
+ irg = irgb/256
+ ired = irg/256
+ igrn = irg - 256*ired
+ iblu = irgb - 256*irg
+ call gw_allocrgbcolor(ired,igrn,iblu,ic)
+C
+C...This gives the colorindex in the screen colormap (or -1 for no allocation)
+ if(ic.ge.0) G_COLOR_CINDEX(icol) = ic
+ endif
+C
+C...Now, if colorindex is valid, set the color
+ if(ic.ge.0) call gwxsetbgcolor(ic)
+c
+ endif
+ return
+ end
+
+
+ subroutine gw_newcmap
+C...Sets up new colormap, old colormap is flushed
+ include 'pltlib.inc'
+ if(LGW_OPEN .AND. LGW_COLOR) then
+ do i = 1, N_COLOR
+ ic = G_COLOR_CINDEX(i)
+ if(ic.gt.0) call gwxfreecolor(ic)
+ end do
+ endif
+ return
+ end
+
+
+
+ subroutine gw_polyline(X,Y,n,ifill)
+C...Plots polyline (optionally filled) to screen in foreground color
+C X,Y polyline X,Y absolute coordinates
+C n number of X,Y points
+C ifill fill flag, 0 for no fill, 1 for filled polyline
+C
+ include 'pltlib.inc'
+ dimension X(n), Y(n), ix(MaxPolyLine), iy(MaxPolyLine)
+C
+ if(n.GT.MaxPolyLine) then
+ write(*,*) 'gw_polyline: array overflow. Increase MaxPolyline.'
+ return
+ endif
+c
+ if(n.LE.1) return
+ if(LGW_OPEN) then
+C...reverse Y axis for X11 plotting
+ do i = 1, n
+ ix(i) = GX_ORG + ifix(G_SCALE*X(i))
+ iy(i) = GY_SIZ - (GY_ORG + ifix(G_SCALE*Y(i))) - 1
+ end do
+ if(ifill.EQ.0) then
+ call gwxlinez(ix,iy,n)
+ else
+ call gwxpoly(ix,iy,n)
+ endif
+ endif
+ return
+ end
+
+
+
+ subroutine g_strip(strng,n)
+ character strng*(*)
+c
+ nc = len(strng)
+ n = nc
+ if (n.le.1) return
+c
+c---- Strips leading blanks off string
+ if(strng(1:1).EQ.' ') then
+c
+c---- find first non-blank character
+ do i=2, nc
+ if(strng(i:i).NE.' ') go to 10
+ end do
+ go to 20
+ 10 ioff = i
+C
+C---- shift STRNG so first character is non-blank
+ strng(1:nc-ioff) = strng(ioff:nc)
+C---- pad tail of STRNG with blanks
+ strng(nc-ioff+1:nc) = ' '
+c
+ endif
+c
+c---- find the index of the last non-blank charater in NAME
+ 20 do n=nc, 1, -1
+ if(strng(n:n).NE.' ') go to 40
+ end do
+ 40 return
+ end
+
diff --git a/plotlib/lines b/plotlib/lines
new file mode 100644
index 0000000..329ac4f
--- /dev/null
+++ b/plotlib/lines
@@ -0,0 +1,11 @@
+ 600 gw_subs.f
+ 300 plt_3D.f
+1000 plt_base.f
+ 600 plt_color.f
+ 730 plt_font.f
+1420 plt_old.f
+ 900 plt_util.f
+ 600 ps_subs.f
+ 720 set_subs.f
+ 20 util-ops.f
+6890 TOTAL
diff --git a/plotlib/masks.inc b/plotlib/masks.inc
new file mode 100644
index 0000000..6642f47
--- /dev/null
+++ b/plotlib/masks.inc
@@ -0,0 +1,41 @@
+C***********************************************************************
+C Module: masks.inc
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C Version 4.46 11/28/01
+C
+C---- dot-pattern masks for use with PLGRID, NEWPAT, etc.
+C
+C mask0: _________________________ (solid)
+C 1: .........................
+C 2: . . . . . . . . . . . . .
+C 3: . . . . . . .
+C 4: . . . .
+C
+ data mask0, mask1, mask2, mask3, mask4
+ & / -1 , -21846, -30584, -32640, -32768 /
+C
+C data mask0, mask1, mask2, mask3, mask4
+C & /Z'FFFFFFFF',Z'AAAAAAAA',Z'CCCCCCCC',Z'88888888',Z'21084210'/
+
+
+
diff --git a/plotlib/misc/Makefile.linux.shared b/plotlib/misc/Makefile.linux.shared
new file mode 100644
index 0000000..70827fc
--- /dev/null
+++ b/plotlib/misc/Makefile.linux.shared
@@ -0,0 +1,222 @@
+#***********************************************************************
+# Module: Makefile.linux
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@mit.edu
+#***********************************************************************
+
+#=======================================================================
+# This Makefile was used to make a shared library version of the plotlib
+# on Linux. This has not been updated or supported.
+#=======================================================================
+
+
+
+#================================#
+# Makefile for Xplot11 library #
+#================================#
+
+#point to your install directory
+INSTALLDIR= $(HOME)/lib
+#INSTALLDIR= /usr/local/lib
+#INSTALLDIR= .
+
+### Use these to set library name
+### (add DP to keep double precision version separate)
+PLTLIB = libPlt
+#PLTLIB = libPltDP
+
+###========================================================
+### Basic plot library object files
+OBJ = plt_base.o plt_font.o plt_util.o plt_color.o \
+ set_subs.o gw_subs.o ps_subs.o Xwin.o
+OBJMISC =
+OBJ3D =
+OBJOLD =
+###
+###--------------------------------------------------------
+### Uncomment to add the old plot compatibility routines
+OBJOLD = plt_old.o
+###
+###--------------------------------------------------------
+### Uncomment to add the 3D-view routines
+OBJ3D = plt_3D.o
+###
+###--------------------------------------------------------
+### Uncomment for f77 compiler w/o AND() and RSHIFT/LSHIFT functions.
+### This adds some functions to duplicate these using IAND and ISHFT
+### which often appear in these offending fortran's libraries.
+### The compilers that this has affected include:
+### HPUX f77
+### Absoft f77 on Linux
+###
+#OBJMISC = util-ops.o
+
+
+
+###================================================
+### Default compilers and flags, install commands
+F77 = f77
+CC = cc
+
+# Uncomment DP to make double-precision version
+#DP = -r8
+
+# Some fortrans need trailing underscores in C interface symbols (see Xwin.c)
+DEFINE = -DUNDERSCORE
+
+FFLAGS = -O $(DP)
+CFLAGS = -O $(DEFINE)
+AR = ar r
+RANLIB = ranlib
+LINKLIB = -lX11
+
+
+###-------------------------------------------------------------------------
+### Uncomment for Linux, using the script f77 (unusable in Slackware 3.0)
+### Note compiler options for Linux:
+### f77 script (calls f2c/gcc) note bug in Slackware 3.0 f77 script
+### fort77 script (calls f2c/gcc) perl script from RH or from yaf77
+### g77 the GNU F77 compiler
+F77 = g77
+#F77 = fort77
+#F77 = f77-f2c
+CC = gcc
+# Uncomment DP to make double-precision version
+# (note -r8 does not work in g77, use f2c instead)
+#DP = -r8
+FFLAGS = -O2 $(DP)
+CFLAGS = -O2 $(DEFINE)
+#AR = ar r
+#RANLIB = ranlib
+LINKLIB = -L/usr/X11R6/lib -lX11
+
+
+
+
+###-------------------------------------------------------------------------
+### Basic make targets - build library, test programs
+
+$(PLTLIB): $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ $(AR) $(PLTLIB).a $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ $(RANLIB) $(PLTLIB).a
+
+test: $(PLTLIB)
+ (cd examples; make test)
+
+
+###-------------------------------------------------------------------------
+### Utility functions - install the library, clean the directory
+
+install: $(PLTLIB).a
+ mv $(PLTLIB).a $(INSTALLDIR)
+ $(RANLIB) $(INSTALLDIR)/$(PLTLIB).a
+
+clean:
+ -/bin/rm *.o
+# -/bin/rm -r PIC
+ -/bin/rm *.a *.so.*
+ -/bin/rm plot*.ps
+ (cd examples; make clean)
+
+
+###-------------------------------------------------------------------------
+### This set of targets makes the libPlt Linux ELF shared library
+### As far as I know this only works with g77 as it is the only Linux
+### compiler that makes shared libraries.
+###
+### You will need to install the library in some place that ldconfig knows
+### about to get this to work as a shared library.
+### 1) Before making the shared library you may need to change the -lf2c
+### library reference in the $(PLTLIB).so target below to the shared
+### fortran library that you are using (most Linuxes use libf2c, hence
+### the -lf2c).
+### 2) Install the shared library in some place (like /usr/local/lib).
+### 3) Make the following links in that directory
+### ln -s libPlt.so.0.21 libPlt.so.0
+### ln -s libPlt.so.0 libPlt.so
+### 4) Look in /etc/ld.so.conf and check that the library directory is
+### in the list of directories and add it if it isn't.
+### 5) Then run ldconfig -v (as root) to get the loader to recognize the
+### shared library.
+
+$(PLTLIB).so:
+ mkdir -p PIC
+ make -f Makefile.linux.shared shared
+ gcc -shared -Wl,-soname,$(PLTLIB).so.0 -o $(PLTLIB).so.0.21 \
+ PIC/*.o -lf2c -lm -lc
+
+SHAREDOBJ = $(patsubst %.o,PIC/%.o,$(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC))
+
+shared: $(SHAREDOBJ)
+###-------------------------------------------------------------------------
+
+
+
+###-------------------------------------------------------------------------
+### compile plot package routines
+
+plt_base.o: plt_base.f pltlib.inc
+ $(F77) -c $(FFLAGS) plt_base.f
+
+plt_color.o: plt_color.f pltlib.inc
+ $(F77) -c $(FFLAGS) plt_color.f
+
+plt_font.o: plt_font.f CHAR.INC SLAN.INC MATH.INC SYMB.INC
+ $(F77) -c $(FFLAGS) plt_font.f
+
+plt_util.o: plt_util.f
+ $(F77) -c $(FFLAGS) plt_util.f
+
+plt_3D.o: plt_3D.f
+ $(F77) -c $(FFLAGS) plt_3D.f
+
+plt_old.o: plt_old.f pltlib.inc
+ $(F77) -c $(FFLAGS) plt_old.f
+
+set_subs.o: set_subs.f pltlib.inc
+ $(F77) -c $(FFLAGS) set_subs.f
+
+gw_subs.o: gw_subs.f pltlib.inc
+ $(F77) -c $(FFLAGS) gw_subs.f
+
+ps_subs.o: ps_subs.f pltlib.inc
+ $(F77) -c $(FFLAGS) ps_subs.f
+
+util-ops.o: util-ops.f
+ $(F77) -c $(FFLAGS) util-ops.f
+
+Xwin.o: Xwin.c
+ $(CC) -c $(CFLAGS) Xwin.c
+
+
+### May need to specify these on a brain-dead make system
+#.f.o: $(F77) -c $(FFLAGS) $<
+#.c.o: $(CC) -c $(CFLAGS) $<
+
+
+### Handles the shared library objects
+
+PIC/%.o : %.f
+ $(F77) -c $(FFLAGS) -fPIC -o $@ $<
+PIC/%.o : %.c
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC -o $@ $<
+
+
+
diff --git a/plotlib/misc/README b/plotlib/misc/README
new file mode 100644
index 0000000..abf03e3
--- /dev/null
+++ b/plotlib/misc/README
@@ -0,0 +1,17 @@
+This directory contains random, outdated but potentially useful info or
+Makefiles.
+
+You may need to read through these and change things substantially to get them working on your machine. They may be of some help.
+
+makesplitlib Script for making a libPlt.a with each routine in a separate
+ object file. This may be necessary if you want to change
+ particular subroutines within the plotlib with your own
+ versions and get them to link. The current library archives
+ all the routines within a source file into one linkable entity.
+
+Makefile.linux.shared This makefile was used to make a shared object (ELF)
+ library for Linux. If you know what this means I don't
+ really need to tell you more.
+
+Readme.absoft Discusses the quirks of the Absoft Fortran compiler(s). The
+ Linux versions were the ones specifically addressed here.
diff --git a/plotlib/misc/Readme.absoft b/plotlib/misc/Readme.absoft
new file mode 100644
index 0000000..9c35095
--- /dev/null
+++ b/plotlib/misc/Readme.absoft
@@ -0,0 +1,65 @@
+/***********************************************************************
+ Module: Readme.absoft
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+Xplot11
+C Version 4.46 11/28/01
+
+
+This Readme file pertains to the Absoft Linux f77 compiler, version 5.x, this
+stuff has not been checked for later versions...
+
+Various compilers support intrinsics for RSHIFT, LSHIFT and AND(). Absoft
+is among those that do not have these supported (also HPUX f77 at last check).
+
+I added a file (util-ops.f) that needs to be included for the Absoft f77 environment. This file contains functions for bit shifts RSHIFT,LSHIFT and
+arithmetic AND(I1,I2) for fortrans that lack these intrinsics.
+
+See the Makefile where this is one of the commented out options.
+
+Note that a number of compile switches need to be set when using the Absoft
+f77 compiler. See the Makefile for these.
+
+
+Absoft Linux f77 flags that I use...
+
+DP = -N113 (only for making a double precision version of the library)
+FFLAGS = -s -f -O -B100 -B108 -N3 -N90 $(DP)
+
+-s static
+-f force to lower case
+-O optimize
+-B100 Pentium Pro flag (use -B101 for general Pentium compatibility)
+-B108 append single underscore to names
+-N3 explicitly opened unformatted files contain record information
+-N90 pass character args same as g77 and f2c
+-N113 lame version of -r8 flag to promote singles into doubles
+
+Note that you will need to link with the libU77 library if you use some
+of the UNIX fortran-isms like GETARG. This is supplied by Absoft but is not
+in their default link libs. You need to add this library to a link statement
+something like this:
+
+f77 -o foobar foobar.o -lU77
+
+HY
+
diff --git a/plotlib/misc/makesplitlib b/plotlib/misc/makesplitlib
new file mode 100644
index 0000000..6383dad
--- /dev/null
+++ b/plotlib/misc/makesplitlib
@@ -0,0 +1,50 @@
+#!/bin/csh
+# Shell script for making split version of the Xplot11 library
+# The split version allows one to link to routines of the same name without
+# fatal link errors as each module can be extracted as needed.
+#
+# This makes a subdirectory ../merge in the Xplot11 source directory
+# that contains an fsplit version of the source files. It then compiles
+# these to make objects, then a library in a crude hack (no makefile).
+# The resulting library is placed in this directory as libPlt-split.a for
+# the user to do what he wishes.
+# HHY 8/30/96
+
+# Optionally get f77 flags from #1 argument to makesplitlib
+# i.e. makesplitlib "-I../foobar -O4 -r8"
+#
+set f77flags = "-O2"
+set f77 = "g77"
+set fsplit = "fsplit-gup"
+
+
+if ($1 != "") set f77flags = $1
+echo "Using fortran compile flags ($f77flags) (option set by arg 1)"
+
+echo "Creating ../merge subdirectory"
+if !(-e ./merge) mkdir merge
+
+cd merge
+
+echo "Starting fsplit of all files in Xplot11 directory"
+foreach file (../*.f)
+ echo "Splitting $file"
+ $fsplit $file
+end
+
+echo "Compiling all split fortran files..."
+foreach file (*.f)
+ $f77 -c $f77flags -I../ $file
+end
+
+echo "Compiling the C interface file"
+cc -c -O -I../ ../Xwin.c
+
+echo "Making library from objects"
+ar -r libPlt-split.a *.o
+
+echo "Moving library to main Xplot11 directory"
+mv libPlt-split.a ..
+
+exit
+
diff --git a/plotlib/plt.ftnchek b/plotlib/plt.ftnchek
new file mode 100644
index 0000000..e1dcfda
--- /dev/null
+++ b/plotlib/plt.ftnchek
@@ -0,0 +1,12 @@
+# Command file for running ftnchek to "lint" the XPLOT11 fortran source
+#
+ftnchek -common=2 -novice=5 \
+plt_base.f plt_font.f plt_util.f plt_color.f \
+plt_old.f plt_3D.f\
+set_subs.f gw_subs.f ps_subs.f
+
+
+
+
+
+
diff --git a/plotlib/plt_3D.f b/plotlib/plt_3D.f
new file mode 100644
index 0000000..0be4f82
--- /dev/null
+++ b/plotlib/plt_3D.f
@@ -0,0 +1,405 @@
+C***********************************************************************
+C Module: plt_3D.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 3D routines
+C
+C Version 4.46 11/28/01
+C
+C Note: These are routine(s) that provide some means of displaying
+C 3D objects in conjunction with the usual XPlot11 routines.
+C They are by no means complete but can serve as a starting
+C point for doing simple 3D graphics.
+C
+C***********************************************************************
+
+
+ subroutine VIEW(X,Y,Z,N,XP,YP,XOB,YOB,ZOB,ROBINV,XUP,YUP,ZUP)
+ DIMENSION X(N), Y(N), Z(N)
+ DIMENSION XP(N), YP(N)
+C........................................................................
+C
+C Projects one or more points in 3-D Cartesian space
+C onto a 2-D plane from the viewpoint of an observer
+C at a specified location. This can be used to view
+C a 3-D object (described by a set of x,y,z points)
+C by projecting the points into a set of x,y points for
+C plotting on a planar 2-D graphics screen.
+C The viewing plane, which has its own x,y coordinate
+C system, always faces the observer but can be turned
+C around the viewing axis, thus simulating the observer
+C tilting his head while looking at the object. This tilt
+C is specified by giving a vector in x,y,z space which
+C "points up" relative to the observer.
+C The distance of the observer from the object is specified
+C explicitly. This does not affect much the size of the viewed
+C object, since the viewing plane contains the 3-D space origin
+C and hence is at or near the object. It does however affect the
+C apparent distortion of the object due to perspective. This
+C is very useful to convey the 3-dimensionality of the object.
+C If the observer is very very far away, there is no distortion
+C (as in a mechanical drawing).
+C
+C X,Y,Z Cartesian point coordinates (input)
+C N number of points (input)
+C XP,YP projected point coordinates on viewing plane (output)
+C XOB,YOB,ZOB Cartesian vector pointing towards observer (input)
+C (magnitude irrelevant)
+C ROBINV 1/(distance to observer) (input)
+C XUP,YUP,ZUP Cartesian vector which points "up" from the
+C observer's viewpoint (magnitude irrelevant) (input)
+C
+C Mark Drela July 1988
+C........................................................................
+C
+C---- unit view vector perpendicular to viewing plane (towards observer)
+ XOBN = XOB/SQRT(XOB**2 + YOB**2 + ZOB**2)
+ YOBN = YOB/SQRT(XOB**2 + YOB**2 + ZOB**2)
+ ZOBN = ZOB/SQRT(XOB**2 + YOB**2 + ZOB**2)
+C
+C---- vector along plane's local x coordinate: (up vector)X(view vector)
+ XIP = YUP*ZOBN - ZUP*YOBN
+ YIP = ZUP*XOBN - XUP*ZOBN
+ ZIP = XUP*YOBN - YUP*XOBN
+C
+C---- normalize plane's x coordinate vector
+ XIHAT = XIP/SQRT(XIP**2 + YIP**2 + ZIP**2)
+ YIHAT = YIP/SQRT(XIP**2 + YIP**2 + ZIP**2)
+ ZIHAT = ZIP/SQRT(XIP**2 + YIP**2 + ZIP**2)
+C
+C---- unit vector along plane's y coordinate: (view vector)X(x unit vector)
+ XJHAT = YOBN*ZIHAT - ZOBN*YIHAT
+ YJHAT = ZOBN*XIHAT - XOBN*ZIHAT
+ ZJHAT = XOBN*YIHAT - YOBN*XIHAT
+C
+C---- go over all points
+ DO 10 I=1, N
+C
+ RDOTR = X(I)*XOBN + Y(I)*YOBN + Z(I)*ZOBN
+C
+C------ viewing-axis component of vector
+ DRX = RDOTR*XOBN
+ DRY = RDOTR*YOBN
+ DRZ = RDOTR*ZOBN
+C
+C------ projected vector scaling factor due to perspective
+ VSCAL = 1.0 / SQRT( (XOBN-ROBINV*DRX)**2
+ & + (YOBN-ROBINV*DRY)**2
+ & + (ZOBN-ROBINV*DRZ)**2 )
+C
+C------ dot vector into plane coordinate system unit vectors, and scale
+ XP(I) = (XIHAT*X(I) + YIHAT*Y(I) + ZIHAT*Z(I))*VSCAL
+ YP(I) = (XJHAT*X(I) + YJHAT*Y(I) + ZJHAT*Z(I))*VSCAL
+C
+ 10 CONTINUE
+C
+ RETURN
+ END
+
+
+ subroutine VIEWR(R,N,RP,ROB,ROBINV,RUP)
+ DIMENSION R(3,N)
+ DIMENSION RP(3,N)
+ DIMENSION ROB(3), RUP(3)
+C........................................................................
+C
+C Same as VIEW, but vectors are passed in R(1:3,...) array form.
+C The out-of-plane RP(3...) value is also returned.
+C
+C R(..) Cartesian point coordinates (input)
+C N number of points (input)
+C RP(..) projected point coordinates on viewing plane (output)
+C ROB(.) Cartesian vector pointing towards observer (input)
+C (magnitude irrelevant)
+C ROBINV 1/(distance to observer) (input)
+C RUP(.) Cartesian vector which points "up" from the
+C observer's viewpoint (magnitude irrelevant) (input)
+C
+C Mark Drela July 2007
+C........................................................................
+ REAL RIP(3), RIN(3), RJN(3), RKN(3), DR(3)
+C
+C---- unit view vector perpendicular to viewing plane (towards observer)
+ SOB = SQRT(ROB(1)**2 + ROB(2)**2 + ROB(3)**2)
+ RKN(1) = ROB(1)/SOB
+ RKN(2) = ROB(2)/SOB
+ RKN(3) = ROB(3)/SOB
+C
+C---- vector along plane's local x coordinate: (up vector)X(view vector)
+ RIP(1) = RUP(2)*RKN(3) - RUP(3)*RKN(2)
+ RIP(2) = RUP(3)*RKN(1) - RUP(1)*RKN(3)
+ RIP(3) = RUP(1)*RKN(2) - RUP(2)*RKN(1)
+C
+C---- normalize plane's x coordinate vector
+ SIP = SQRT(RIP(1)**2 + RIP(2)**2 + RIP(3)**2)
+ RIN(1) = RIP(1)/SIP
+ RIN(2) = RIP(2)/SIP
+ RIN(3) = RIP(3)/SIP
+C
+C---- unit vector along plane's y coordinate: (view vector)X(x unit vector)
+ RJN(1) = RKN(2)*RIN(3) - RKN(3)*RIN(2)
+ RJN(2) = RKN(3)*RIN(1) - RKN(1)*RIN(3)
+ RJN(3) = RKN(1)*RIN(2) - RKN(2)*RIN(1)
+C
+C---- go over all points
+ DO 10 I=1, N
+ RDOTR = R(1,I)*RKN(1) + R(2,I)*RKN(2) + R(3,I)*RKN(3)
+C
+C------ viewing-axis component of vector
+ DR(1) = RDOTR*RKN(1)
+ DR(2) = RDOTR*RKN(2)
+ DR(3) = RDOTR*RKN(3)
+C
+C------ projected vector scaling factor due to perspective
+ VSCAL = 1.0 / SQRT( (RKN(1)-ROBINV*DR(1))**2
+ & + (RKN(2)-ROBINV*DR(2))**2
+ & + (RKN(3)-ROBINV*DR(3))**2 )
+C
+C------ dot vector into plane coordinate system unit vectors, and scale
+ RP(1,I) = (RIN(1)*R(1,I) + RIN(2)*R(2,I) + RIN(3)*R(3,I))*VSCAL
+ RP(2,I) = (RJN(1)*R(1,I) + RJN(2)*R(2,I) + RJN(3)*R(3,I))*VSCAL
+ RP(3,I) = (RKN(1)*R(1,I) + RKN(2)*R(2,I) + RKN(3)*R(3,I))*VSCAL
+ 10 CONTINUE
+C
+ RETURN
+ END ! VIEWR
+
+
+
+ SUBROUTINE PROJMATRIX3 (ROTZ,ROTY,RMAT)
+C...Purpose: To define rotation and transformation matrix. The input
+C pair of angles ROTZ,ROTY specify the viewpoint by
+C an angle about the Z axis (CCW) and an angle about
+C the newly rotated Y axis (CCW). Both angles are
+C right-handed in a conventional sense about each axis.
+C
+C...Input: ROTZ rotation of viewpoint about Z axis (deg)
+C ROTY rotation of viewpoint about new Y axis (deg)
+C
+C...Output: RMAT 3x3 rotation and perspective matrix
+C
+ DIMENSION RMAT(3,3)
+C
+ DTR = 4.0*ATAN(1.0)/180.0
+ COSZ = COS(ROTZ*DTR)
+ SINZ = SIN(ROTZ*DTR)
+ COSY = COS(ROTY*DTR)
+ SINY = SIN(ROTY*DTR)
+C
+C---Rotation matrix (rotation about Z, then rotation about Y)
+c xx = -( SINZ*X + COSZ*Y)
+ RMAT(1,1) = -SINZ
+ RMAT(2,1) = -COSZ
+ RMAT(3,1) = 0.0
+C yy = SINY*COSZ*X - SINY*SINZ*Y + COSY*Z
+ RMAT(1,2) = SINY*COSZ
+ RMAT(2,2) = -SINY*SINZ
+ RMAT(3,2) = COSY
+c zz = -(COSY*COSZ*X - COSY*SINZ*Y - SINY*Z)
+ RMAT(1,3) = -COSY*COSZ
+ RMAT(2,3) = COSY*SINZ
+ RMAT(3,3) = SINY
+C
+c xx = -( SINZ*X + COSZ*Y)
+c yy = SINY*COSZ*X - SINY*SINZ*Y + COSY*Z
+c zz = -(COSY*COSZ*X - COSY*SINZ*Y - SINY*Z)
+C
+c write(*,*) 'Rmatrix row1 ', (RMAT(1,L),L=1,3)
+c write(*,*) 'Rmatrix row2 ', (RMAT(2,L),L=1,3)
+c write(*,*) 'Rmatrix row3 ', (RMAT(3,L),L=1,3)
+c read(*,*)
+C
+ RETURN
+ END
+
+
+ SUBROUTINE PROJMATRIX4 (ROTZ,ROTY,RDIST,RMAT)
+C...Purpose: To define rotation and perspective matrix. The input
+C pair of angles ROTZ,ROTY specify the viewpoint by
+C an angle about the Z axis (CCW) and an angle about
+C the newly rotated Y axis (CCW). Both angles are
+C right-handed in a conventional sense about each axis.
+C The observer distance RDIST specifies the distance from
+C the origin to the observer along the viewpoint direction.
+C
+C...Input: ROTZ rotation of viewpoint about Z axis (deg)
+C ROTY rotation of viewpoint about new Y axis (deg)
+C RDIST distance from origin to observer along viewpoint
+C
+C...Output: RMAT 4x4 rotation and perspective matrix
+C
+ DIMENSION AMAT(4,4),PMAT(4,4), RMAT(4,4)
+C
+ DTR = 4.0*ATAN(1.0)/180.0
+ COSZ = COS(ROTZ*DTR)
+ SINZ = SIN(ROTZ*DTR)
+ COSY = COS(ROTY*DTR)
+ SINY = SIN(ROTY*DTR)
+C
+C---Rotation matrix (rotation about Z, then rotation about Y)
+c xx = -( SINZ*X + COSZ*Y)
+ AMAT(1,1) = -SINZ
+ AMAT(2,1) = -COSZ
+ AMAT(3,1) = 0.0
+ AMAT(4,1) = 0.0
+C yy = SINY*COSZ*X - SINY*SINZ*Y + COSY*Z
+ AMAT(1,2) = SINY*COSZ
+ AMAT(2,2) = -SINY*SINZ
+ AMAT(3,2) = COSY
+ AMAT(4,2) = 0.0
+c zz = -(COSY*COSZ*X - COSY*SINZ*Y - SINY*Z)
+ AMAT(1,3) = -COSY*COSZ
+ AMAT(2,3) = COSY*SINZ
+ AMAT(3,3) = SINY
+ AMAT(4,3) = 0.0
+C
+ AMAT(1,4) = 0.0
+ AMAT(2,4) = 0.0
+ AMAT(3,4) = 0.0
+ AMAT(4,4) = 1.0
+C
+c xx = -( SINZ*X + COSZ*Y)
+c yy = SINY*COSZ*X - SINY*SINZ*Y + COSY*Z
+c zz = -(COSY*COSZ*X - COSY*SINZ*Y - SINY*Z)
+c
+C---Perspective matrix with projection on Z plane
+ PMAT(1,1) = 1.0
+ PMAT(2,1) = 0.0
+ PMAT(3,1) = 0.0
+ PMAT(4,1) = 0.0
+C
+ PMAT(1,2) = 0.0
+ PMAT(2,2) = 1.0
+ PMAT(3,2) = 0.0
+ PMAT(4,2) = 0.0
+C
+ PMAT(1,3) = 0.0
+ PMAT(2,3) = 0.0
+ PMAT(3,3) = 1.0
+ PMAT(4,3) = 0.0
+C
+ PMAT(1,4) = 0.0
+ PMAT(2,4) = 0.0
+ PMAT(3,4) = -RDIST
+ PMAT(4,4) = 1.0
+C
+C---Product of matrices is perspective matrix
+ DO J=1, 4
+ DO K=1, 4
+ TMP = 0.0
+ DO L=1, 4
+ TMP = TMP + AMAT(J,L)*PMAT(L,K)
+ END DO
+ RMAT(J,K) = TMP
+ END DO
+ END DO
+C
+c write(*,*) 'Rmatrix row1 ', (RMAT(1,L),L=1,4)
+c write(*,*) 'Rmatrix row2 ', (RMAT(2,L),L=1,4)
+c write(*,*) 'Rmatrix row3 ', (RMAT(3,L),L=1,4)
+c write(*,*) 'Rmatrix row4 ', (RMAT(4,L),L=1,4)
+c read(*,*)
+C
+ RETURN
+ END
+
+
+ SUBROUTINE ROTPTS3 (RMAT,PTS_IN,NPTS,PTS_OUT)
+C...Purpose: To rotate array of points to a new viewpoint by
+C parallel projection. The input rotation matrix
+C contains the transformation data in a 3x3 matrix.
+C
+C...Input: RMAT 3x3 transformation matrix
+C PTS_IN array (3xNPTS) of input points
+C NPTS number of points in arrays
+C
+C...Output: PTS_OUT array (3xNPTS) of transformed points
+C
+ DIMENSION PTS_IN(3,NPTS), PTS_OUT(3,NPTS)
+ DIMENSION RMAT(4,4)
+C
+ DO I = 1, NPTS
+C
+ DO J=1, 3
+ TMP = 0.0
+ DO K=1, 3
+ TMP = TMP + PTS_IN(K,I)*RMAT(K,J)
+ END DO
+ PTS_OUT(J,I) = TMP
+ END DO
+C
+ END DO
+C
+ RETURN
+ END
+
+
+ SUBROUTINE ROTPTS4 (RMAT,PTS_IN,NPTS,PTS_OUT)
+C...Purpose: To rotate array of points to a new viewpoint by
+C perspective projection. The input rotation matrix
+C contains the transformation and perspective data in
+C a 4x4 matrix in homogeneous coordinates. Note that input
+C coordinates may need to be z-clipped if the user trans.
+C moves the points behind the observer. A check is made
+C for a singular perspective point (at observer).
+C
+C...Input: RMAT 4x4 rotation and perspective matrix
+C PTS_IN array (3xNPTS) of input points
+C NPTS number of points in arrays
+C
+C...Output: PTS_OUT array (3xNPTS) of transformed points
+C
+C...Note: You may need to translate your points to recenter them
+C about the origin to get good perspective views. Points
+C off to the side get pretty distorted...
+C
+ DIMENSION PTS_IN(3,NPTS), PTS_OUT(3,NPTS)
+ DIMENSION RMAT(4,4), PTMP(4), PPTMP(4)
+C
+ DO I = 1, NPTS
+C
+ PTMP(1) = PTS_IN(1,I)
+ PTMP(2) = PTS_IN(2,I)
+ PTMP(3) = PTS_IN(3,I)
+ PTMP(4) = 1.0
+C
+ DO J=1, 4
+ TMP = 0.0
+ DO K=1, 4
+ TMP = TMP + PTMP(K)*RMAT(K,J)
+ END DO
+ PPTMP(J) = TMP
+ END DO
+C
+ IF(PPTMP(4).NE.0.0) THEN
+ PTS_OUT(1,I) = PPTMP(1)/PPTMP(4)
+ PTS_OUT(2,I) = PPTMP(2)/PPTMP(4)
+ PTS_OUT(3,I) = PPTMP(3)/PPTMP(4)
+ ELSE
+ WRITE(*,*) 'Homogeneous coordinate singular for pt ',I
+ ENDIF
+C
+ END DO
+C
+ RETURN
+ END
diff --git a/plotlib/plt_base.f b/plotlib/plt_base.f
new file mode 100644
index 0000000..2f4aa5e
--- /dev/null
+++ b/plotlib/plt_base.f
@@ -0,0 +1,1026 @@
+C***********************************************************************
+C Module: plt_base.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+***********************************************************************
+C Xplot11 *
+C**********
+C
+C Dedicated to perpetuating ugly PLOT-10 and Versatec software
+C into the 21st century...
+C
+C This library supports interactive graphics and hardcopy output using
+C the interfaces defined in gw_subs.f and ps_subs.f.
+C Currently: gw_subs supports X window graphics in B&W or color
+C ps_subs supports B&W or color hardcopy to Postscript file
+C
+C Version 4.46 11/28/01
+C
+C Notes:
+C
+C***********************************************************************
+
+
+ subroutine PLINITIALIZE
+C
+C---Plot package initialization routine
+C Must be called before any color plot calls
+C
+ include 'pltlib.inc'
+C
+ GX_SIZ = 1
+ GY_SIZ = 1
+C---Check for user default for background and set up a colormap
+ call gw_revflag
+ call colormapdefault
+C
+ return
+ end
+
+
+ subroutine PLOPEN(relsize,nunit,idev)
+C
+C---Plot initialization routine
+C
+C Must be called before EACH page plot
+C
+C relsize Fractional size of X-graphics window relative to screen
+C if relsize < 0 the graphics page is in Portrait mode 8.5x11
+C if relsize >=0 the graphics page is in Landscape mode 11x8.5
+C
+C nunit Postscript output file specifier
+C < 0 Postscript output enabled to individual files plotNNN.ps
+C on unit 80 where NNN is cumulative plot number
+C = 0 Postscript output enabled to file plot.ps on unit 80
+C = NNN Postscript output enabled to file plotUUU.ps on unit UUU
+C
+C idev Plotting output selector
+C
+C idev X-window PostScript
+C ---- -------- ----------
+C 1 x
+C 2 B & W
+C 3 x B & W
+C 4 Color
+C 5 x Color
+C
+C Note: idev<1 or idev>5 gives only X-window output
+C (for pseudo-compatibility with old PLTLIB versions)
+C ((if you squint real hard))
+C
+ include 'pltlib.inc'
+C
+ SAVE ifirst, relsize_save, nunit_save
+ DATA ifirst / 0 /
+C
+ I_DEV = idev
+ if(idev.GT.5) I_DEV = 1
+C
+C---- control flags (gw_init will set LGW_COLOR = T if screen has color)
+ LGW_GEN = (I_DEV.EQ.1 .OR. I_DEV.EQ.3 .OR. I_DEV.EQ.5)
+ LPS_GEN = (I_DEV.GE.2)
+ LPS_COLOR = (I_DEV.GE.4)
+C
+C
+C---- clear primitives counter
+ N_PRIM = 0
+C
+ if(ifirst.EQ.0) then
+C------ First-ever PLOPEN call
+C
+ ifirst = 1
+C...graphics window
+ LGW_OPEN = .FALSE.
+ call gw_setup(relsize)
+ LGW_RESIZE = .FALSE.
+C
+C...PostScript (file not yet opened, and no unstroked page exists)
+ NPS_UNIT = -1
+ N_PAGES = 0
+ call ps_setup(nunit)
+C...No zooming to start off
+ call CLRZOOM
+C...Primitives file initializers
+ NPRIM_UNIT = NPRIM_UNIT_DEFAULT
+ LPRIM_OPEN = .FALSE.
+C
+ else
+C------ Subsequent PLOPEN call
+C...if a postscript file has been opened we need to end the page with
+C bounding box information
+ if(LPS_OPEN) call ps_endpage
+C
+ if(abs(relsize-relsize_save) .GT. 0.01) then
+C...relsize specfied has changed from previous PLOPEN call..
+C...re-setup aspect ratio and prepare to resize current graphics window
+ call gw_setup(relsize)
+ LGW_RESIZE = .TRUE.
+ endif
+C
+ if(nunit.NE.nunit_save .OR. nunit.LT.0) then
+C...nunit changed from previous PLOPEN call or individual plots are desired
+C close current PostScript file
+ call ps_close
+C...set up for new PostScript file
+ call ps_setup(nunit)
+ endif
+C
+C...If the prims file is open, rewind to be ready to write from the beginning
+ if(LPRIM_OPEN) then
+ rewind(NPRIM_UNIT)
+ endif
+C
+ endif
+C
+C...Initialize selected plot devices
+ if(LGW_GEN) call gw_init
+ if(LPS_GEN) call ps_init
+C
+ if(LGW_GEN) then
+ if(LGW_CHANGED) write(*,1000) X_WIND, Y_WIND
+ 1000 format(/1x,'X-window size changed to ',f6.2,'" x',f6.2,'"')
+ endif
+C
+C...Initialize line plot width, pattern, color
+ I_PEN = 1
+ I_PAT = -1
+ I_CLR = 1
+ call set_pen(I_PEN)
+ call set_pat(I_PAT)
+ call set_color(I_CLR)
+C
+ X_SCALE = 1.0
+ Y_SCALE = 1.0
+ X_ORG = 0.
+ Y_ORG = 0.
+ X_LST = 0.
+ Y_LST = 0.
+C
+C...No initial user clipping (clipping only to page size)
+ CLP_XMIN = 0.
+ CLP_XMAX = X_PAGE
+ CLP_YMIN = 0.
+ CLP_YMAX = Y_PAGE
+C
+C
+C...Save current call parameters
+ relsize_save = relsize
+ nunit_save = nunit
+C
+ return
+ end
+
+
+ subroutine REPLOT(idev)
+C
+C...Replots plot primitives saved in logging array since last PLOPEN call
+c
+C idev - as defined in PLOPEN header
+C
+ include 'pltlib.inc'
+ dimension xpoly(MaxPolyLine), ypoly(MaxPolyLine)
+C
+ idev_old = I_DEV
+C
+C
+ I_DEV = idev
+ if(idev.LE.0 .OR. idev.GT.5) I_DEV = idev_old
+C
+C...Control flags (LGW_COLOR should be already set for current screen)
+ LGW_GEN = (I_DEV.EQ.1 .OR. I_DEV.EQ.3 .OR. I_DEV.EQ.5)
+ LPS_GEN = (I_DEV.GE.2)
+ LPS_COLOR = (I_DEV.GE.4)
+C
+C...Re-Initialize selected plotting devices
+ if(LGW_GEN) call gw_init
+ if(LPS_GEN) call ps_init
+C
+C...Reset plot globals for this plot
+ I_PEN = 1
+ I_PAT = -1
+ I_CLR = 1
+ call set_pen(I_PEN)
+ call set_pat(I_PAT)
+ call set_color(I_CLR)
+C
+ X_SCALE = 1.0
+ Y_SCALE = 1.0
+ X_ORG = 0.
+ Y_ORG = 0.
+ X_LST = 0.
+ Y_LST = 0.
+C
+C...No initial user clipping (clipping only to window limits)
+ CLP_XMIN = 0.
+ CLP_XMAX = X_PAGE
+ CLP_YMIN = 0.
+ CLP_YMAX = Y_PAGE
+C
+ IPOLY = 0
+ ICLPMIN = 0
+C...Now, go through all the stored plot primitives
+ ICNT = -1
+ 1 call getprim(ICNT,ITYP,IVAL,XVAL,YVAL)
+C
+ if(ICNT.LT.0) go to 10
+C
+ if(ITYP.EQ.PageCommand) then
+ if(IVAL.EQ.-999) then
+ if(LPS_GEN) call ps_endpage
+ endif
+C
+ else if(ITYP.EQ.PlotCommand) then
+ call plot_1(XVAL,YVAL,IVAL)
+C
+C...Not currently using scale info in replots, all X,Y are absolute (HHY)
+ else if(ITYP.EQ.ScaleCommand) then
+ call set_scl(XVAL,YVAL)
+C
+ else if(ITYP.EQ.PenCommand) then
+ I_PEN = IVAL
+C
+ else if(ITYP.EQ.PatternCommand) then
+ I_PAT = IVAL
+C
+ else if(ITYP.EQ.ColorCommand) then
+ I_CLR = IVAL
+C
+ else if(ITYP.EQ.PolylinePointCommand) then
+ IPOLY = IPOLY+1
+ if(IPOLY.GT.MaxPolyline) then
+ write(*,*) '*** Error - too many polyline points'
+ stop
+ endif
+ xpoly(IPOLY) = XVAL
+ ypoly(IPOLY) = YVAL
+C
+ else if(ITYP.EQ.PolylineDrawCommand) then
+ IPOLY = IPOLY+1
+ if(IPOLY.GT.MaxPolyline) then
+ write(*,*) '*** Error - too many polyline points'
+ stop
+ endif
+ xpoly(IPOLY) = XVAL
+ ypoly(IPOLY) = YVAL
+ ifill = IVAL
+ call polyline_1(xpoly,ypoly,IPOLY,ifill)
+ IPOLY = 0
+C
+ else if(ITYP.EQ.MinClipCommand) then
+ CLPMINX = XVAL
+ CLPMINY = YVAL
+ ICLPMIN = 1
+C
+ else if(ITYP.EQ.MaxClipCommand) then
+ if(ICLPMIN.NE.1) then
+ write(*,*) '*** Error - no previous MinClip stored'
+ stop
+ endif
+ call set_clip(CLPMINX,CLPMINY,XVAL,YVAL)
+ ICLPMIN = 0
+C
+ else
+ write(*,*) '? REPLOT -- Illegal Command:', ITYP
+C
+ endif
+ go to 1
+C
+ 10 if(IPOLY.NE.0) then
+ write(*,*) '? REPLOT -- No end to polyline command.'
+ stop
+ endif
+ call PLFLUSH
+C
+ I_DEV = idev_old
+ LGW_GEN = (mod(I_DEV,2) .EQ. 1)
+ LPS_GEN = (I_DEV .GE. 2)
+ LPS_COLOR = (I_DEV .GE. 4)
+C
+ return
+ end
+
+
+ subroutine PLCLOSE
+C---Closes all plotting, no more plots...
+C closes any open postscript files
+C closes X window
+C closes and deletes log file (if used)
+ include 'pltlib.inc'
+C
+ call ps_endpage
+ call gw_close
+ call ps_close
+ if(LPRIM_OPEN) then
+ close(unit=NPRIM_UNIT,status='DELETE')
+ endif
+ return
+ end
+
+
+ subroutine PLEND
+C---Ends current plot,
+C finishes off current postscript plot page
+C ends current X window plot, flushes to display
+ include 'pltlib.inc'
+C
+ call putprim(PageCommand,-999,0.,0.)
+ if(LGW_GEN) call gw_endplot
+ if(LPS_GEN) call ps_endpage
+ return
+ end
+
+
+
+
+ subroutine PLOT(x,y,icode)
+C---Basic plotting routine, does moves and draws in user coordinates
+C with optional reorigin, also can end this plot or all plotting
+C x,y coordinates in user units
+C icode function code (integer)
+C 3 relative move to x,y
+C 2 relative line to x,y
+C -2 relative line to x,y and re-origin plotting to x,y
+C -3 relative move to x,y and re-origin plotting to x,y
+C -999 end this plot page
+C +999 end all plotting, close graphics window
+C
+ include 'pltlib.inc'
+C
+C...Convert plot coordinates to absolute units and plot
+ XABS = xusr2ABS(x)
+ YABS = yusr2ABS(y)
+ CALL PLOTABS(XABS,YABS,icode)
+ return
+ end
+
+
+
+ subroutine PLOTABS(x,y,icode)
+C---Absolute plotting routine, does moves and draws in absolute coordinates
+C with optional reorigin, also can end this plot or all plotting
+C
+C X,Y coordinates in absolute units
+C icode function code (integer)
+C 3 relative move to X,Y
+C 2 relative line to X,Y
+C -2 relative line to X,Y and re-origin plotting to X,Y
+C -3 relative move to X,Y and re-origin plotting to X,Y
+C -999 end this plot page
+C +999 end all plotting, close graphics window
+C
+ include 'pltlib.inc'
+ logical LCODE_OK
+C
+ icabs = abs(icode)
+C
+ LCODE_OK = ( icabs.EQ.2 .OR. icabs.EQ.3 .OR.
+ & icabs.EQ.999 )
+C
+ if(.NOT. LCODE_OK) then
+ write(*,*) 'PLOTABS: Unknown function code: ',icode
+ write(*,*) ' at point X,Y =',X,Y
+ return
+ endif
+C
+C---Check for end of plot page
+ if (icode.EQ.-999) then
+ call PLEND
+C---Check for end of ALL plotting
+ elseif(icode.EQ.+999) then
+ call PLCLOSE
+C
+ else
+C...Store plot primitive
+ call putprim(PlotCommand,icode,X,Y)
+C.....Do draw/move call with absolute coordinates
+ call plot_1(X,Y,icode)
+C
+ endif
+C
+ return
+ end
+
+
+
+
+ subroutine POLYLINE(x,y,n,ifill)
+C---Basic polyline plotting routine, input in user coordinates
+C x,y coordinate arrays in user units
+C n number of x,y points
+C ifill fill flag, 0 for no fill, 1 for filled polygon
+C
+ include 'pltlib.inc'
+ dimension x(n), y(n)
+ dimension XABS(MaxPolyLine), YABS(MaxPolyLine)
+C
+ if(n.LE.1) return
+C...Convert coordinates to absolute coordinates
+ do i=1, n
+ XABS(i) = xusr2ABS(x(i))
+ YABS(i) = yusr2ABS(y(i))
+ end do
+C...Plot polyline in absolute coordinates
+ call POLYLINEABS(XABS,YABS,n,ifill)
+ return
+ end
+
+
+ subroutine POLYLINEABS(X,Y,n,ifill)
+C---Basic polyline plotting routine, input in absolute coordinates
+C X,Y coordinate arrays in absolute units
+C n number of X,Y points
+C ifill fill flag, 0 for no fill, 1 for filled polygon
+C
+ include 'pltlib.inc'
+ dimension X(n), Y(n)
+C
+ if(n.LE.1) return
+C
+C...Store polyline primitives in stored plot array and do polyline plot call
+ icode = ifill
+ do i=1, n-1
+ call putprim(PolylinePointCommand,icode,X(i),Y(i))
+ end do
+ call putprim(PolylineDrawCommand,icode,X(n),Y(n))
+C
+C...plot polyline
+ call polyline_1(X,Y,n,ifill)
+ return
+ end
+
+
+
+ subroutine GETPEN(ipen)
+C...Gets current pen width in pixels
+ include 'pltlib.inc'
+ ipen = I_PEN
+ return
+ end
+
+ subroutine NEWPEN(ipen)
+C...Sets line width from 1 to 5 (pixels)
+ include 'pltlib.inc'
+ if(ipen.EQ.I_PEN) return
+c
+ ip = ipen
+ if (ip.GT.5) ip = 5
+ if (ip.LT.0) ip = 1
+ I_PEN = ip
+C...Install pen command into display primitives list
+ call putprim(PenCommand,ip,0.,0.)
+ return
+ end
+
+
+
+ subroutine GETPAT(ipat)
+C...Gets current line pattern as integer bit pattern
+ include 'pltlib.inc'
+ ipat = I_PAT
+ return
+ end
+
+
+ subroutine NEWPAT(ipat)
+C...Sets line pattern using bit pattern in lower 16 bits of ipat
+ include 'pltlib.inc'
+ if(ipat.EQ.I_PAT) return
+c
+ I_PAT = ipat
+C...Install pattern command into display primitives list
+ call putprim(PatternCommand,ipat,0.,0.)
+ return
+ end
+
+
+
+
+ subroutine GETORIGIN(XORG,YORG)
+C...Gets origin of user system in absolute (page) units
+ include 'pltlib.inc'
+C
+ XORG = X_ORG
+ YORG = Y_ORG
+ return
+ end
+
+
+ subroutine NEWORIGIN(XORG,YORG)
+C...Sets origin of user system in absolute (page) units
+ include 'pltlib.inc'
+C
+ X_ORG = XORG
+ Y_ORG = YORG
+ return
+ end
+
+
+ subroutine GETFACTORS(xscale,yscale)
+C...Gets current scale factors in user units
+ include 'pltlib.inc'
+ xscale = X_SCALE
+ yscale = Y_SCALE
+ return
+ end
+
+
+ subroutine NEWFACTOR(scale)
+C...Sets both plot scale factors to scale
+ include 'pltlib.inc'
+ call set_scl(scale,scale)
+C...Install scale command into display primitives list
+ call putprim(ScaleCommand,0,scale,scale)
+ return
+ end
+
+
+ subroutine NEWFACTORS(xscale,yscale)
+C...Sets plot scale factors
+ include 'pltlib.inc'
+ call set_scl(xscale,yscale)
+C...Install scale command into display primitives list
+ call putprim(ScaleCommand,0,xscale,yscale)
+ return
+ end
+
+
+ subroutine GETUSERTRANS(XORG,YORG,xscale,yscale)
+C...Gets origin and scale factors for user->absolute coordinate transform
+ include 'pltlib.inc'
+C
+ XORG = X_ORG
+ YORG = Y_ORG
+ xscale = X_SCALE
+ yscale = Y_SCALE
+ return
+ end
+
+
+ subroutine NEWUSERTRANS(XORG,YORG,xscale,yscale)
+C...Sets origin and scale factors for user->absolute coordinate transform
+ include 'pltlib.inc'
+C
+ X_ORG = XORG
+ Y_ORG = YORG
+ X_SCALE = xscale
+ Y_SCALE = yscale
+ return
+ end
+
+
+ subroutine GETLASTXY(x,y)
+C...Return last x,y plotting location in user coordinates
+ include 'pltlib.inc'
+C
+ call GETLASTXYABS(XABS,YABS)
+ x = XABS2usr(XABS)
+ y = YABS2usr(YABS)
+ return
+ end
+
+
+ subroutine GETLASTXYABS(X,Y)
+C...Return last x,y plotting location in user coordinates
+ include 'pltlib.inc'
+C
+ X = X_LST
+ Y = Y_LST
+ return
+ end
+
+
+ subroutine GETCURSORXY(x,y,chkey)
+C...Return current cursor (mouse) x,y location in user coordinates
+C...chkey returns the key pressed (instead of mouse click, say)
+ include 'pltlib.inc'
+ character*1 chkey
+C
+ call getcursorxyabs(XA,YA,chkey)
+C...get user coordinates
+ x = XABS2usr(XA)
+ y = YABS2usr(YA)
+ return
+ end
+
+
+ subroutine GETCURSORXYABS(X,Y,chkey)
+C...Return current cursor (mouse) X,Y location in absolute coordinates
+C...chkey returns the key pressed (instead of mouse click, say)
+ include 'pltlib.inc'
+ character*1 chkey
+C
+ call gw_curs(XZ,YZ,khar)
+ chkey = char(khar)
+ if(LGW_GEN) call gw_flush
+C
+C...get absolute coordinates
+ X = X_ZM2ABS(XZ)
+ Y = Y_ZM2ABS(YZ)
+ return
+ end
+
+
+
+ subroutine GETWINSIZE(XSIZE,YSIZE)
+C...Returns current size of graphics window in absolute (page) units
+ include 'pltlib.inc'
+C
+ XSIZE = float(GX_SIZ) / G_SCALE
+ YSIZE = float(GY_SIZ) / G_SCALE
+ return
+ end
+
+ subroutine GETPAGESIZE(XPAGE,YPAGE)
+C...Returns current size of page in absolute (page) units
+ include 'pltlib.inc'
+C
+ XPAGE = X_PAGE
+ YPAGE = Y_PAGE
+ return
+ end
+
+ subroutine GETREVVIDEO(lflag)
+C...Gets reverse video flag
+C Returns lflag = TRUE if reverse video is set
+C
+ include 'pltlib.inc'
+ logical lflag
+ lflag = LGW_REVVIDEO
+ return
+ end
+
+
+
+
+ subroutine WINERASE
+C...Erases the graphics area
+ include 'pltlib.inc'
+ if(LGW_GEN) call gw_clear
+ return
+ end
+
+
+ subroutine PLFLUSH
+C...Flush out plot components in buffers
+ include 'pltlib.inc'
+ if(LGW_GEN) call gw_flush
+ if(LPS_GEN) call ps_flush
+ return
+ end
+
+
+ subroutine DRAWTOSCREEN
+C...Sets plotting destination to screen
+ include 'pltlib.inc'
+C
+ call gw_drawtoscreen
+ return
+ end
+
+
+ subroutine DRAWTOBUFFER
+C...Sets plotting destination to background buffer
+ include 'pltlib.inc'
+C
+ call gw_drawtobuffer
+ return
+ end
+
+
+ subroutine SHOWBUFFER
+C...Displays contents of background buffer to screen
+ include 'pltlib.inc'
+C
+ call gw_showbuffer
+ return
+ end
+
+
+ subroutine NEWCLIP(xmin,xmax,ymin,ymax)
+C...Sets clip limits in user coordinates
+ include 'pltlib.inc'
+C
+ X_MIN = xusr2ABS(xmin)
+ X_MAX = xusr2ABS(xmax)
+ Y_MIN = yusr2ABS(ymin)
+ Y_MAX = yusr2ABS(ymax)
+ call set_clip(X_MIN,Y_MIN,X_MAX,Y_MAX)
+ call putprim(MinClipCommand,0,X_MIN,Y_MIN)
+ call putprim(MaxClipCommand,0,X_MAX,Y_MAX)
+C
+ return
+ end
+
+ subroutine NEWCLIPABS(XMIN,XMAX,YMIN,YMAX)
+C...Sets clip limits in absolute coordinates
+ include 'pltlib.inc'
+C
+ call set_clip(XMIN,YMIN,XMAX,YMAX)
+ call putprim(MinClipCommand,0,XMIN,YMIN)
+ call putprim(MaxClipCommand,0,XMAX,YMAX)
+C
+ return
+ end
+
+ subroutine GETCLIP(xmin,xmax,ymin,ymax)
+C...Returns clip limits in user coordinates
+C
+ include 'pltlib.inc'
+C
+ xmin = XABS2usr(CLP_XMIN)
+ xmax = XABS2usr(CLP_XMAX)
+ ymin = YABS2usr(CLP_YMIN)
+ ymax = YABS2usr(CLP_YMAX)
+ return
+ end
+
+ subroutine GETCLIPABS(XMIN,XMAX,YMIN,YMAX)
+C...Returns clip limits specified in absolute (page) coordinates
+C i.e. in inches
+C
+ include 'pltlib.inc'
+C
+ XMIN = CLP_XMIN
+ YMIN = CLP_YMIN
+ XMAX = CLP_XMAX
+ YMAX = CLP_YMAX
+ return
+ end
+
+ subroutine CLRCLIP
+C...Resets user clip limits to graphics window limits (no visible clipping)
+c
+ include 'pltlib.inc'
+c
+ call set_clip(0.0,0.0,X_PAGE,Y_PAGE)
+ call putprim(MinClipCommand,0,0.0 , 0.0)
+ call putprim(MaxClipCommand,0,X_PAGE,Y_PAGE)
+C
+ return
+ end
+
+
+
+ subroutine GETZOOMABS(XOFF,YOFF,XFAC,YFAC)
+C...Returns zoom offsets and scale factors
+C XOFF, YOFF are the offsets in absolute coordinates
+C XFAC, YFAC are the zoom factors applied to XY'=XYFAC*(XY+XYOFF)
+ include 'pltlib.inc'
+C
+ XOFF = XOFF_ZOOM
+ YOFF = YOFF_ZOOM
+ XFAC = XFAC_ZOOM
+ YFAC = YFAC_ZOOM
+C
+ return
+ end
+
+ subroutine NEWZOOMABS(XOFF,YOFF,XFAC,YFAC)
+C...Explicitly sets zoom offsets and scale factors
+C The parameters to NEWZOOMABS are the same as output from GETZOOMABS.
+C XOFF, YOFF are the offsets in absolute coordinates
+C XFAC, YFAC are the zoom factors applied to XY'=XYFAC*(XY+XYOFF)
+ include 'pltlib.inc'
+C
+ XOFF_ZOOM = XOFF
+ YOFF_ZOOM = YOFF
+ XFAC_ZOOM = XFAC
+ YFAC_ZOOM = YFAC
+c...Re-draw zoomed plot to X-window only
+c call REPLOT(1)
+C
+ return
+ end
+
+ subroutine USETZOOM(LXYSAME,LCURSOR)
+C...User interactively sets zoom box, either by mouse selection, or
+C by asking for coordinates of the zoom rectangle
+ logical LXYSAME,LCURSOR
+ include 'pltlib.inc'
+c
+C...Get zoom parameters from user
+ call set_zoom(XOFF_ZOOM,YOFF_ZOOM,XFAC_ZOOM,YFAC_ZOOM,
+ & LXYSAME,LCURSOR)
+c...Re-draw zoomed plot to X-window only
+c call REPLOT(1)
+ return
+ end
+
+ subroutine CLRZOOM
+C...Resets zoom parameters to no-zoom condition
+ include 'pltlib.inc'
+ call NEWZOOMABS(0.,0.,1.,1.)
+ return
+ end
+
+
+
+
+ function XABS2usr(X)
+C...Converts absolute X to user x
+ include 'pltlib.inc'
+ XABS2usr = (X - X_ORG)/X_SCALE
+ return
+ end
+
+ function YABS2usr(Y)
+C...Converts absolute Y to user y
+ include 'pltlib.inc'
+ YABS2usr = (Y - Y_ORG)/Y_SCALE
+ return
+ end
+
+ function xusr2ABS(x)
+C...Converts user x to absolute X
+ include 'pltlib.inc'
+ xusr2ABS = x*X_SCALE + X_ORG
+ return
+ end
+
+ function yusr2ABS(y)
+C...Converts user y to absolute Y
+ include 'pltlib.inc'
+ yusr2ABS = y*Y_SCALE + Y_ORG
+ return
+ end
+
+
+
+ subroutine PLGRID (x,y,nx,xd,ny,yd,lmask)
+C...Generates linear and non-linear grid patterns (with line masks)
+C
+C Where: x,y user coordinate of lower lefthand corner of
+c the grid to be generated.
+c
+c nx number of intervals in the x direction
+c if 'nx' is greater than 1000, then argument
+c 'xd' will be treated as an array of interval values
+c with 'nx-1000' elements. '-nx' indicates that the
+c actual vertical line generations are to be suppressed.
+c xd (nx<1000) user coordinate distance between uniformly
+c spaced vertical lines
+c (nx>1000) an array of values for spacing vertical
+c lines at varying intervals
+c
+c ny number of intervals in the y direction.
+c if 'ny' is greater than 1000, then argument
+c 'yd' will be treated as an array of interval values
+c with 'ny-1000' elements. '-ny' indicates that the
+c actual horizontal line generations are to be suppressed.
+c yd (ny<1000) user coordinate distance between uniformly
+c spaced horizontal lines
+c (ny>1000) an array of values for spacing horizontal
+c lines at varying intervals
+c
+c lmask line mask bit pattern to be used in generating
+c the gridded form.
+c
+c calls: PLGRIDABS
+C
+ DIMENSION xd(*),yd(*)
+ DIMENSION XDABS(500), YDABS(500)
+
+C
+ XABS = xusr2ABS(x)
+ YABS = yusr2ABS(y)
+ call GETFACTORS(xscale,yscale)
+ XDABS(1) = xscale*xd(1)
+ YDABS(1) = yscale*yd(1)
+C
+C...Decode grid interval information and scale arrays if necessary
+ MX = IABS(nx)
+ if(MX.GT.1000) then
+ JX = MX/1000
+ MX = MX - JX*1000
+ do i=2, MX
+ XDABS(i) = xscale*xd(i)
+ end do
+ ENDIF
+ MY = IABS(ny)
+ if(MY.GT.1000) then
+ JY = MY/1000
+ MY = MY - JY*1000
+ do i=2, MY
+ YDABS(i) = yscale*yd(i)
+ end do
+ ENDIF
+C
+C...Call absolute coordinate routine
+ call PLGRIDABS(XABS,YABS,nx,XDABS,ny,YDABS,lmask)
+ RETURN
+ END
+
+
+ subroutine PLGRIDABS(X,Y,nx,XD,ny,YD,lmask)
+C...Generates linear and non-linear grid patterns (with line masks)
+C
+C Where: X,Y absolute coordinate of lower lefthand corner of
+c the grid to be generated.
+c
+c nx number of intervals in the x direction
+c if 'nx' is greater than 1000, then argument
+c 'xd' will be treated as an array of interval values
+c with 'nx-1000' elements. '-nx' indicates that the
+c actual vertical line generations are to be suppressed.
+c XD (nx<1000) absolute coordinate distance between uniformly
+c spaced vertical lines
+c (nx>1000) an array of values for spacing vertical
+c lines at varying intervals
+c
+c ny number of intervals in the y direction.
+c if 'ny' is greater than 1000, then argument
+c 'yd' will be treated as an array of interval values
+c with 'ny-1000' elements. '-ny' indicates that the
+c actual horizontal line generations are to be suppressed.
+c YD (ny<1000) absolute coordinate distance between uniformly
+c spaced horizontal lines
+c (ny>1000) an array of values for spacing horizontal
+c lines at varying intervals
+c
+c lmask line mask bit pattern to be used in generating
+c the gridded form.
+c
+c calls: PLOTABS
+C
+ DIMENSION XD(*),YD(*)
+C
+C...Decode grid interval information
+ MX = IABS(nx)
+ MY = IABS(ny)
+ JX = MX/1000
+ JY = MY/1000
+ MX = MX - JX*1000
+ MY = MY - JY*1000
+C
+C...Save and set line mask pattern
+ LMSK = LMASK
+ CALL GETPAT(IMASK)
+ CALL NEWPAT(LMSK)
+C
+C...Set x ordinates for horizontal lines
+ X1 = X
+ X2 = X + XD(1)*FLOAT(MX)
+C
+C...Check for 'xd' single value or array
+ IF (JX.NE.0) THEN
+C...'XD' array, recompute right x ordinate
+ X2 = X
+ DO I=1,MX
+ X2 = X2 + XD(I)
+ END DO
+ ENDIF
+C
+C...Generate horizontal lines
+ Y2 = Y
+ IF (NY.GT.0) THEN
+ CALL PLOTABS(X1,Y2,+3)
+ CALL PLOTABS(X2,Y2,+2)
+ ENDIF
+ J = 1
+ DO I=1,MY
+ Y2 = Y2 + YD(J)
+ IF (NY.GT.0) THEN
+ CALL PLOTABS(X1,Y2,+3)
+ CALL PLOTABS(X2,Y2,+2)
+ ENDIF
+ J = J + JY
+ END DO
+C
+C...Generate vertical lines
+ IF (NX.GT.0) THEN
+ Y1 = y
+ CALL PLOTABS(X1,Y1,+3)
+ CALL PLOTABS(X1,Y2,+2)
+ J = 1
+ DO I=1,MX
+ X1 = X1 + XD(J)
+ CALL PLOTABS(X1,Y1,+3)
+ CALL PLOTABS(X1,Y2,+2)
+ J = J + JX
+ END DO
+ ENDIF
+C
+C...Restore line mask pattern
+ CALL NEWPAT(IMASK)
+C
+ RETURN
+ END
diff --git a/plotlib/plt_color.f b/plotlib/plt_color.f
new file mode 100644
index 0000000..3646ab2
--- /dev/null
+++ b/plotlib/plt_color.f
@@ -0,0 +1,623 @@
+C***********************************************************************
+C Module: plt_color.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 color plotting routines
+C
+C Version 4.46 11/28/01
+C
+C Note: These routines implement the interface to setup, select and
+C query colors in the XPLOT11 plot package.
+C***********************************************************************
+C
+C The default colormap defines these colors and associated color indices
+C (before the user defines any more)...
+C BLACK = 1
+C WHITE = 2
+C YELLOW = 3
+C ORANGE = 4
+C RED = 5
+C GREEN = 6
+C CYAN = 7
+C BLUE = 8
+C MAGENTA = 9
+C VIOLET = 10
+
+
+ subroutine NEWCOLOR(icol)
+C...Sets color by composite color index
+C color is set by the map index (for +icol)
+C or spectrum index (for -icol)
+C Color map indices run from 0 -> N_COLORS
+C Color spectrum indices run from -1 -> -N_SPECTRUM
+C
+C (see colormap subroutines below for setting colormap colors)
+C
+ include 'pltlib.inc'
+c
+ if(icol.GT.0) then
+ if(icol.GT.N_COLOR) then
+ write(*,*) 'NEWCOLOR: color index out of bounds: ',
+ & icol,N_COLOR
+ return
+ endif
+ icindex = icol
+ else
+ if(-icol.GT.N_SPECTRUM) then
+ write(*,*) 'NEWCOLOR: spectrum index out of bounds: ',
+ & -icol,N_SPECTRUM
+ return
+ endif
+ icindex = IFIRST_SPECTRUM - icol - 1
+ endif
+c
+C...Skip if this is the current color
+ if(icindex.EQ.I_CLR) return
+c
+C...Install color command into display primitives list
+ I_CLR = icindex
+ call putprim(ColorCommand,I_CLR,0.,0.)
+c
+ return
+ end
+
+
+ subroutine GETCOLOR(icol)
+C...Returns current foreground color composite index
+C if icol>0 the index is the color table index (non-spectrum colors)
+C if icol<0 the index is -(color spectrum index)
+C
+ include 'pltlib.inc'
+ if(I_CLR.ge.IFIRST_SPECTRUM .and.
+ & I_CLR.le.IFIRST_SPECTRUM+N_SPECTRUM-1) then
+ icol = IFIRST_SPECTRUM - I_CLR - 1
+ else
+ icol = I_CLR
+ endif
+ return
+ end
+
+
+ subroutine GETCOLORINDEX(icindex)
+C...Returns color table index (not spectrum color index)
+C of current foreground color table index (icindex runs from 0 -> N_COLOR)
+C
+ include 'pltlib.inc'
+ icindex = I_CLR
+ return
+ end
+
+
+ subroutine NEWCOLORNAME(colorname)
+C...Sets color for plotting by named string
+C (to circumvent knowing the color table index)
+C Valid color names (either upper or lower case) are found by
+C running the X11 command: showrgb
+C
+ character colorname*(*), colorin*22
+ include 'pltlib.inc'
+c
+C...Convert input color to uppercase
+ colorin = colorname
+ call convrt2uc(colorin)
+c
+C...Search for color name in current colortable
+ do ic = 1, N_COLOR
+c write(*,*) 'colorbyname table ic=',ic,' ',colorin,' ',
+c & COLOR_NAME(ic),' ci ',G_COLOR_CINDEX(ic)
+ if(colorin.eq.COLOR_NAME(ic)) then
+ call NEWCOLOR(ic)
+ return
+ endif
+ end do
+c
+C...Add new color to colortable
+C...Get RGB components for named color
+ call gw_cname2rgb(colorname,ired,igreen,iblue)
+c write(*,*) 'cname->rgb ',colorname, ired,igreen,iblue
+c
+ if (ired.ge.0) then
+ N = N_COLOR + 1
+ if(N.gt.Ncolors_max) then
+ write(*,*)
+ & 'NEWCOLORNAME: Colortable overflow. New color ignored.'
+ return
+ endif
+ G_COLOR_CINDEX(N) = -1
+ COLOR_RGB(N) = iblue + 256*(igreen + 256*ired)
+ COLOR_NAME(N) = colorin
+ N_COLOR = N
+ call NEWCOLOR(N)
+ else
+ write(*,*)
+ & 'NEWCOLORNAME: Color not found ',colorname
+ endif
+c
+ return
+ end
+
+
+ subroutine NEWCOLORRGB(ired,igreen,iblue)
+C...Sets color for plotting by R,G,B components
+C (to circumvent knowing the color table index)
+C Valid color components for red,green,blue run from 0-255
+C
+ include 'pltlib.inc'
+c
+C...Search for r,g,b color in current colortable
+ do ic = 1, N_COLOR
+ irgb = iblue + 256*(igreen + 256*ired)
+c write(*,*) 'NEWCOLORRGB table ic=',ic,' ',irgb,' ',
+c & COLOR_RGB(ic),
+c & COLOR_NAME(ic),' ci ',G_COLOR_CINDEX(ic)
+ if(irgb.eq.COLOR_RGB(ic)) then
+ call NEWCOLOR(ic)
+ return
+ endif
+ end do
+c
+ N = N_COLOR + 1
+ if(N.gt.Ncolors_max) then
+ write(*,*)
+ & 'NEWCOLORRGB: Colortable overflow. New color ignored.'
+ return
+ endif
+ G_COLOR_CINDEX(N) = -1
+ COLOR_RGB(N) = iblue + 256*(igreen + 256*ired)
+ COLOR_NAME(N) = 'RGBCOLOR'
+ N_COLOR = N
+ call NEWCOLOR(N)
+ return
+ end
+
+
+
+ subroutine GETCOLORRGB(icol,ired,igrn,iblu,colorname)
+C...Gets color information for color designated by index icol
+C if icol<=0, color -icol in Spectrum is queried
+C Returns ired - red color component (0-255) (-1 if no color)
+C igrn - green color component (0-255) (-1 if no color)
+C iblu - blue color component (0-255) (-1 if no color)
+C colorname - name of current color (lowercase)
+C
+ include 'pltlib.inc'
+ character*(*) colorname
+C
+C...First assume color "icol" does not exist
+ ired = -1
+ igrn = -1
+ iblu = -1
+ colorname = ' '
+c
+ if(icol.GT.0) then
+ ic = icol
+ else
+ if(-icol.GT.N_SPECTRUM) then
+ write(*,*) 'GETCOLORRGB: spectrum index out of bounds: ',
+ & -icol,N_SPECTRUM
+ return
+ endif
+ ic = IFIRST_SPECTRUM - icol - 1
+ endif
+c
+ if(ic.GT.N_COLOR) then
+ write(*,*) 'GETCOLORRGB: color index out of bounds: ',
+ & ic,N_COLOR
+ return
+ endif
+c
+ irgb = COLOR_RGB(ic)
+ irg = irgb/256
+ ired = irg/256
+ igrn = irg - 256*ired
+ iblu = irgb - 256*irg
+ colorname = COLOR_NAME(ic)
+c
+ return
+ end
+
+
+ subroutine convrt2uc(input)
+C...Convert string to uppercase
+C Note that the string must be writeable (a variable, not a constant)
+c
+ character*(*) input
+ character*26 lcase, ucase
+ data lcase /'abcdefghijklmnopqrstuvwxyz'/
+ data ucase /'ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
+c
+ n = len(input)
+ do i=1, n
+ k = index(lcase, input(i:i))
+ if(k.gt.0) input(i:i) = ucase(k:k)
+ end do
+c
+ return
+ end
+
+
+ subroutine GETNUMCOLOR(ncol)
+C...Gets current number of defined colors
+C
+ include 'pltlib.inc'
+ ncol = N_COLOR
+ return
+ end
+
+
+ subroutine GETNUMSPECTRUM(nspec)
+C...Gets current number of defined colors in Spectrum
+C
+ include 'pltlib.inc'
+ nspec = N_SPECTRUM
+ return
+ end
+
+
+ subroutine COLORMAPDEFAULT
+C
+C...Creates default colormap palette containing a small number of basic
+C colors defined in DATA statement below. The first two colors
+C are used as the default foreground and background.
+C
+C The default colormap contains these defined colors
+C BLACK = 1
+C WHITE = 2
+C YELLOW = 3
+C ORANGE = 4
+C RED = 5
+C GREEN = 6
+C CYAN = 7
+C BLUE = 8
+C MAGENTA = 9
+C VIOLET = 10
+C
+C These colors are then accessible by a normal NEWCOLOR(icol) call:
+C icol = 1 .. NCMAP
+C
+C Also installs the RGB components of these colors and these color
+C names in the color table. The colorindex is set to -1 to indicate
+C that the color has not yet been mapped to the screen color hardware
+C (this step happens the first time the color is actually used).
+C
+ include 'pltlib.inc'
+c
+ PARAMETER (NCMAP=10)
+C
+ INTEGER DEFCMAPRGB1(3,NCMAP), DEFCMAPRGB0(3,NCMAP)
+ CHARACTER*10 DEFCMAPNAMES(NCMAP)
+c
+ SAVE ifirst
+ DATA ifirst / 0 /
+c
+c DATA ((DEFCMAPRGB(L,I),L=1,3),I=1,NCMAP)
+c & / 0, 0, 0, ! black
+c & 255, 255, 255, ! white
+c & 255, 0, 0, ! red
+c & 255, 165, 0, ! orange
+c & 255, 255, 0, ! yellow
+c & 0, 255, 0, ! green
+c & 0, 255, 255, ! cyan
+c & 0, 0, 255, ! blue
+c & 148, 0, 211 / ! violet
+c & 255, 0, 255, ! magenta
+C
+C---- hues for reverse-video (black background), use full saturation
+ DATA ((DEFCMAPRGB1(L,I),L=1,3),I=1,NCMAP)
+ & / 0, 0, 0, ! black
+ & 255, 255, 255, ! white
+ & 255, 0, 0, ! red
+ & 255, 165, 0, ! orange
+ & 255, 255, 0, ! yellow
+ & 0, 255, 0, ! green
+ & 0, 255, 255, ! cyan
+ & 30, 140, 255, ! blue
+ & 205, 55, 255, ! violet
+ & 255, 0, 255 / ! magenta
+C
+C---- hues for regular-video (white background), use partial saturation
+ DATA ((DEFCMAPRGB0(L,I),L=1,3),I=1,NCMAP)
+ & / 0, 0, 0, ! black
+ & 255, 255, 255, ! white
+ & 255, 0, 0, ! red
+ & 255, 165, 0, ! orange
+ & 220, 220, 0, ! yellow
+ & 0, 225, 0, ! green
+ & 0, 210, 210, ! cyan
+ & 30, 140, 255, ! blue
+ & 205, 55, 255, ! violet
+ & 255, 0, 255 / ! magenta
+C
+ DATA DEFCMAPNAMES
+ & / 'BLACK ',
+ & 'WHITE ',
+ & 'RED ',
+ & 'ORANGE ',
+ & 'YELLOW ',
+ & 'GREEN ',
+ & 'CYAN ',
+ & 'BLUE ',
+ & 'VIOLET ',
+ & 'MAGENTA ' /
+C
+c
+C---Initialize the colormap indices for first call
+ if(ifirst.EQ.0) then
+ N_COLOR = 0
+ N_SPECTRUM = 0
+ IFIRST_SPECTRUM = 0
+ ifirst = 1
+ endif
+C
+C--- Skip installing new default map if there already are NCMAP colors
+ if(N_COLOR.EQ.NCMAP) return
+C
+C--- Flush current colormap if any, to free up space for new map
+ if(N_COLOR.GT.0) call gw_newcmap
+c
+C--- Fill in the colormap with with the default colors and set colorindex
+C to -1 to indicate that the color is still unallocated by hardware
+ IF(LGW_REVVIDEO) THEN
+ do n = 1, NCMAP
+ ired = DEFCMAPRGB1(1,n)
+ igrn = DEFCMAPRGB1(2,n)
+ iblu = DEFCMAPRGB1(3,n)
+ COLOR_RGB(n) = iblu + 256*(igrn + 256*ired)
+ COLOR_NAME(n) = DEFCMAPNAMES(n)
+ G_COLOR_CINDEX(n) = -1
+ end do
+ ELSE
+ do n = 1, NCMAP
+ ired = DEFCMAPRGB0(1,n)
+ igrn = DEFCMAPRGB0(2,n)
+ iblu = DEFCMAPRGB0(3,n)
+ COLOR_RGB(n) = iblu + 256*(igrn + 256*ired)
+ COLOR_NAME(n) = DEFCMAPNAMES(n)
+ G_COLOR_CINDEX(n) = -1
+ end do
+ ENDIF
+C
+ N_COLOR = NCMAP
+c write(*,*) 'COLORMAPDEFAULT: NCOLOR ',N_COLOR
+C
+ return
+ end
+
+
+ subroutine COLORSPECTRUMHUES(ncols,HUESTR)
+ character*(*) HUESTR
+C
+C...Sets up a color "Spectrum" table that gives a continuous
+C blend between a small number of base colors specified in the
+C character string HUESTR, which can be "RYGCBM" or any subset thereof.
+C
+C The RGB components associated with each specified color are set in
+C the DATA statement below. These colors are appended to any existing
+C colormap data, typically set up by COLORMAPDEFAULT.
+C
+C These Spectrum colors are then accessible by NEWCOLOR(-icol)
+C -icol = 1 .. ncols
+C
+C NOTE: The maximum number of colors available to the Spectrum is LESS
+C than the screen depth would indicate. Some of the X colormap
+C is used by other X window applications, typically this will be
+C around 30-40 colormap entries. So, for an 8 bit depth, this
+C leaves around 220 or so available for use, only 210 or so after
+C the Palette colors (typ. 10) are assigned. Less are available
+C if other applications are using the X colormap.
+C
+ include 'pltlib.inc'
+c
+C
+C...RGB components of the Spectrum-defining base colors
+C COLWIDTH controls the relative extent of that defining color
+C
+ parameter (NRGB = 7)
+ dimension irgbhue(3,NRGB), huewidth(NRGB)
+C
+ DIMENSION IRGBTABLE(3,NRGB)
+ DIMENSION COLORWIDTH(NRGB)
+ CHARACTER*(NRGB) COLORCHARS
+c
+ DATA COLORCHARS / 'MBCGYOR' /
+ DATA ( (IRGBTABLE(L,I),L=1,3),COLORWIDTH(I), I=1, NRGB )
+ & / 240, 0, 240, 1.5, ! Magenta
+ & 32, 32, 255, 1.0, ! Blue
+ & 0, 240, 240, 1.0, ! Cyan
+ & 32, 255, 32, 1.0, ! Green
+ & 240, 240, 0, 1.0, ! Yellow
+ & 255, 160, 0, 1.0, ! Orange
+ & 255, 32, 32, 1.5 / ! Red
+C Red Green Blue
+C
+ call convrt2uc(HUESTR)
+ nhuemax = len(HUESTR)
+c
+ nhue = 0
+ do k=1, nhuemax
+ i = index( COLORCHARS , HUESTR(k:k) )
+ if(i.ne.0) then
+ nhue = nhue + 1
+ irgbhue(1,nhue) = IRGBTABLE(1,i)
+ irgbhue(2,nhue) = IRGBTABLE(2,i)
+ irgbhue(3,nhue) = IRGBTABLE(3,i)
+ huewidth(nhue) = COLORWIDTH(i)
+ endif
+ enddo
+c
+ CALL COLORSPECTRUMTRP(ncols,nhue,irgbhue,huewidth)
+C
+ return
+ end
+
+
+
+ subroutine COLORSPECTRUMTRP(ncols,NBASE,IRGBBASE,COLWIDTH)
+C...Interpolates a color "Spectrum" table of 1..ncols colors that are
+C a continuous blend between a small number of defined base colors.
+C The blending between the base colors is controlled by the color
+C "width" COLWIDTH.
+C
+C Input:
+C ncols number desired interpolated colors in spectrum
+C NBASE number base colors defined in IRGBBASE
+C IRGBBASE array(3,*) of integer RGB components for the base colors
+C COLWIDTH color pseudo "width" to use for interpolation
+C
+C Overwrites the definition of any existing Spectrum.
+C
+C
+ DIMENSION IRGBBASE(3,NBASE)
+ DIMENSION COLWIDTH(NBASE)
+C
+ include 'pltlib.inc'
+C
+ DIMENSION COLAXIS(NColors_max), IRGBTBL(3,NColors_max)
+c
+ if(NBASE.GT.NColors_max)
+ & STOP 'COLORSPECTRUM: Local IRGBBASE array overflow.'
+C
+C
+C---Don't allow less than 2 spectrum colors defined by interpolation table
+ if(ncols.LT.2) return
+c
+C--- Check to make sure we have enough room in the color table
+ if(N_COLOR+ncols+1 .gt. Ncolors_max) then
+ write(*,*) 'COLORSPECTRUMTRP: Too many colors specified.'
+ return
+ endif
+C
+ COLAXIS(1) = 0.
+ do ibase=2, NBASE
+ COLAXIS(ibase) = COLAXIS(ibase-1)
+ & + 0.5*(COLWIDTH(ibase-1)+COLWIDTH(ibase))
+ if(COLAXIS(ibase) .LE. COLAXIS(ibase-1))
+ & STOP 'COLORSPECTRUM: Non-monotonic color axis. Check COLWIDTH.'
+ enddo
+C
+C--- Now fill in the rgb table for the Spectrum colors,
+C interpolating colors between the entries in the passed-in color table
+ ibase = 1
+ do i = 1, ncols
+ xcol = COLAXIS(NBASE) * float(i-1)/float(ncols-1)
+c
+ 5 xnorm = (xcol -COLAXIS(ibase))
+ & / (COLAXIS(ibase+1)-COLAXIS(ibase))
+c
+ if(xnorm.GT.1.0 .AND. ibase.LT.NBASE) then
+ ibase = ibase + 1
+ go to 5
+ endif
+c
+ w0 = COLWIDTH(ibase )
+ w1 = COLWIDTH(ibase+1)
+ frac = w1*xnorm / (w0 + (w1-w0)*xnorm)
+C
+ red0 = float(IRGBBASE(1,ibase) )
+ grn0 = float(IRGBBASE(2,ibase) )
+ blu0 = float(IRGBBASE(3,ibase) )
+ red1 = float(IRGBBASE(1,ibase+1))
+ grn1 = float(IRGBBASE(2,ibase+1))
+ blu1 = float(IRGBBASE(3,ibase+1))
+c
+ IRGBTBL(1,i) = ifix( (red0 + frac*(red1-red0)) + 0.5 )
+ IRGBTBL(2,i) = ifix( (grn0 + frac*(grn1-grn0)) + 0.5 )
+ IRGBTBL(3,i) = ifix( (blu0 + frac*(blu1-blu0)) + 0.5 )
+ end do
+ call COLORSPECTRUMRGB(ncols,IRGBTBL)
+c
+ return
+ end
+
+
+ subroutine COLORSPECTRUMRGB(NRGB,IRGB)
+C...Sets up a color "Spectrum" table for NRGB colors that are
+C defined by r,g,b values (0-255) in the IRGB array.
+C
+C Input:
+C NRGB number r,g,b colors defined in IRGB
+C IRGB array(3,*) of integer RGB components for the colors
+C
+C Overwrites any existing Spectrum.
+C
+ DIMENSION IRGB(3,NRGB)
+C
+ include 'pltlib.inc'
+C
+ if(N_COLOR.LE.0 .OR. N_COLOR.GT.10) then
+ CALL COLORMAPDEFAULT
+ endif
+C
+C--- Check to make sure we have enough room in the color table
+ if(N_COLOR+NRGB .gt. Ncolors_max) then
+ write(*,*) 'COLORSPECTRUMRGB: Too many colors specified.'
+ return
+ endif
+C
+C--- starting index of Spectrum in colormap arrays
+ IFIRST_SPECTRUM = N_COLOR + 1
+C
+C--- Now fill in the Spectrum colors from the passed-in color table
+ do i = 1, NRGB
+ ired = IRGB(1,i)
+ igrn = IRGB(2,i)
+ iblu = IRGB(3,i)
+C
+ IC = IFIRST_SPECTRUM + i - 1
+c
+ COLOR_RGB(IC) = iblu + 256*(igrn + 256*ired)
+ COLOR_NAME(IC) = 'SPECTRUM'
+ G_COLOR_CINDEX(IC) = -1
+ end do
+c
+ N_SPECTRUM = NRGB
+ N_COLOR = IC
+c write(*,*) 'COLORSPECTRUMRGB: NCOLOR,NSPECTRUM ',N_COLOR,N_SPECTRUM
+c
+ return
+ end
+
+
+
+ subroutine LWR2UPR(INPUT)
+ CHARACTER*(*) INPUT
+C
+ CHARACTER*26 LCASE, UCASE
+ DATA LCASE / 'abcdefghijklmnopqrstuvwxyz' /
+ DATA UCASE / 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /
+C
+ N = LEN(INPUT)
+C
+ do I=1, N
+ K = INDEX( LCASE , INPUT(I:I) )
+ IF(K.GT.0) INPUT(I:I) = UCASE(K:K)
+ end do
+C
+ return
+ end
+
+
+
+
+
+
diff --git a/plotlib/plt_font.f b/plotlib/plt_font.f
new file mode 100644
index 0000000..0333061
--- /dev/null
+++ b/plotlib/plt_font.f
@@ -0,0 +1,767 @@
+C***********************************************************************
+C Module: plt_font.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Font-related utility routines
+C
+C--- in user-coordinates...
+C PLNUMB - formats and plots a number (using PLCHAR)
+C PLCHAR - plots characters using CHAR font (WYSIWYG ASCII)
+C PLSLAN - plots characters using SLAN font (slanted ASCII)
+C PLMATH - plots characters using MATH font (LaTex-like symbols)
+C PLSYMB - plots plot-point symbol
+C
+C--- similarly, in absolute coordinates
+C PLNUMBABS - formats and plots a number
+C PLCHARABS - plots characters using CHAR font (normal ASCII)
+C PLSLANABS - plots characters using SLAN font (slanted ASCII)
+C PLMATHABS - plots characters using MATH font (LaTex-like symbols)
+C PLSYMBABS - plots plot-point symbol
+C
+C Version 4.46 11/28/01
+C
+C Notes: These routines require the include files that define the
+C stroked fonts CHAR, MATH, SLAN, SYMB.
+C***********************************************************************
+
+
+
+ subroutine PLNUMB(xc,yc,chx,FPN,ANGLE,ndig)
+C----------------------------------------------------------------
+C Plots a floating-point number as a string of characters
+C
+C xc,yc = user coordinate position for plotting first character
+C (lower left point)
+C if xc=999. the last x plotting position is used
+C if yc=999. the last y plotting position is used
+C chx = character width in x (user coordinate length)
+C FPN = floating-point number to be plotted
+C ANGLE = angle of character string (degrees from x-axis)
+C ndig = specification of the number of digits and the type
+C of numeric string to be plotted (integer)
+C > 0 = number of digits to the right of the decimal
+C point to be plotted (last digit is rounded)
+C = 0 = rounded integer portion of fpn is plotted
+C with a decimal point
+C = -1 = rounded integer portion of fpn is plotted
+C without the decimal point
+C < -1 = rounded integer portion of fpn is plotted
+C after having the least significant digits
+C truncated (IABS(NDID)-1 digits are truncated)
+C
+C CALLS: GETFACTORS, PLNUMABS
+C----------------------------------------------------------------
+C
+C---Convert user coordinates and size to absolute coordinates
+ XABS = xc
+ YABS = yc
+ if (xc.NE.999.) XABS = xusr2ABS(xc)
+ if (yc.NE.999.) YABS = yusr2ABS(yc)
+ call GETFACTORS(xscale,yscale)
+ CHXABS = xscale*chx
+C---Call absolute coordinate routine
+ CALL PLNUMBABS(XABS,YABS,CHXABS,FPN,ANGLE,ndig)
+C
+ RETURN
+ END
+
+ subroutine PLCHAR(xc,yc,chx,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with standard character font
+C
+C xc,yc = user coordinate position for first character in string
+C if xc=999. the last x plotting position is used
+C if yc=999. the last y plotting position is used
+C chx = character width (user coordinates)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETFACTORS, PLCHARABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+C---Convert user coordinates and size to absolute coordinates
+ XABS = xc
+ YABS = yc
+ if (xc.NE.999.) XABS = xusr2ABS(xc)
+ if (yc.NE.999.) YABS = yusr2ABS(yc)
+ call GETFACTORS(xscale,yscale)
+ CHXABS = xscale*chx
+C---Call absolute coordinate routine
+ CALL PLCHARABS(XABS,YABS,CHXABS,STRING,ANGLE,nc)
+C
+ RETURN
+ END
+
+ subroutine PLSLAN(xc,yc,chx,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with slanted character font
+C
+C xc,yc = user coordinate position for first character in string
+C if xc=999. the last x plotting position is used
+C if yc=999. the last y plotting position is used
+C chx = character width (user coordinates)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETFACTORS, PLCHARABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+C---Convert user coordinates and size to absolute coordinates
+ XABS = xc
+ YABS = yc
+ if (xc.NE.999.) XABS = xusr2ABS(xc)
+ if (yc.NE.999.) YABS = yusr2ABS(yc)
+ call GETFACTORS(xscale,yscale)
+ CHXABS = xscale*chx
+C---Call absolute coordinate routine
+ CALL PLSLANABS(XABS,YABS,CHXABS,STRING,ANGLE,nc)
+C
+ RETURN
+ END
+
+ subroutine PLMATH(xc,yc,chx,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with math character font
+C
+C xc,yc = user coordinate position for first character in string
+C if xc=999. the last x plotting position is used
+C if yc=999. the last y plotting position is used
+C chx = character width (user coordinates)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETFACTORS, PLMATHABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+C---Convert user coordinates and size to absolute coordinates
+ XABS = xc
+ YABS = yc
+ if (xc.NE.999.) XABS = xusr2ABS(xc)
+ if (yc.NE.999.) YABS = yusr2ABS(yc)
+ call GETFACTORS(xscale,yscale)
+ CHXABS = xscale*chx
+C---Call absolute coordinate routine
+ CALL PLMATHABS(XABS,YABS,CHXABS,STRING,ANGLE,nc)
+C
+ RETURN
+ END
+
+ subroutine PLSYMB(xc,yc,chx,ISYM,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots a symbol with symbol font indexed by integer
+C
+C xc,yc = user coordinate position for plotting symbol
+C if xc=999. the last x plotting position is used
+C if yc=999. the last y plotting position is used
+C chx = symbol width
+C ISYM = integer to select symbol (0..?)
+C ANGLE = angle for symbol (radians, positive is righthanded rotation)
+C nc = 0 just move to x,y before plotting symbol
+C .ne.0 draw line to x,y before plotting symbol
+C
+C Plots a symbol using vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 48,48)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETFACTORS, PLSYMBABS
+C----------------------------------------------------------------
+ INTEGER ISYM
+C
+C---Convert user coordinates and size to absolute coordinates
+ XABS = xc
+ YABS = yc
+ if (xc.NE.999.) XABS = xusr2ABS(xc)
+ if (yc.NE.999.) YABS = yusr2ABS(yc)
+ call GETFACTORS(xscale,yscale)
+ CHXABS = xscale*chx
+C---Call absolute coordinate routine
+ CALL PLSYMBABS(XABS,YABS,CHXABS,ISYM,ANGLE,nc)
+C
+ RETURN
+ END
+
+
+
+
+
+
+ subroutine PLNUMBABS(XC,YC,CHX,FPN,ANGLE,ndig)
+C----------------------------------------------------------------
+C Plots a floating-point number as a string of characters
+C
+C XC,YC = absolute coordinate position for plotting first character
+C (lower left point)
+C if XC=999. the last x plotting position is used
+C if YC=999. the last y plotting position is used
+C CHX = character width in x (absolute coordinate length)
+C FPN = floating-point number to be plotted
+C ANGLE = angle of character string (degrees from x-axis)
+C ndig = specification of the number of digits and the type
+C of numeric string to be plotted (integer)
+C > 0 = number of digits to the right of the decimal
+C point to be plotted (last digit is rounded)
+C = 0 = rounded integer portion of fpn is plotted
+C with a decimal point
+C = -1 = rounded integer portion of fpn is plotted
+C without the decimal point
+C < -1 = rounded integer portion of fpn is plotted
+C after having the least significant digits
+C truncated (IABS(NDID)-1 digits are truncated)
+C
+C CALLS: PLCHARABS
+C----------------------------------------------------------------
+ CHARACTER*1 MINUS, POINT, CHDIG
+ DATA MINUS/'-'/, POINT/'.'/
+C
+ IZERO = ichar('0')
+C
+ T1 = FPN
+ XX = XC
+ YY = YC
+C...Number negative?
+ IF (T1 .LT. 0.0) THEN
+ CALL PLCHARABS(XX,YY,CHX,MINUS,ANGLE,1)
+ xx = 999.
+ yy = 999.
+ T1 = -T1
+ ENDIF
+C
+C...Set working digit count
+ ND = -ndig
+C
+C...Integer only to be plotted?
+ IF (ndig.LE.0) THEN
+C...Round and truncate for integer
+ IF(ndig.EQ.0) ND = 1
+ ND = ND - 1
+ T2 = FLOAT(IFIX((T1 + 0.5)/(10.**ND))) + 0.5
+ ND = 0
+ IF (ndig.EQ.0) ND = -1
+ ELSE
+C...Round for fraction
+ T2 = T1 + 0.5/(10.**ndig)
+ ENDIF
+C
+C...Find number of digits to the left of decimal point
+ NL = 1
+C...Any more digits to the left of the d.p.
+ 60 IF (T2 .GE. 10.) THEN
+ T2 = T2/10.
+ NL = NL + 1
+ GO TO 60
+ ENDIF
+C
+C...Set plottable digit count
+ NP = NL - ND
+C...Bad digit count?
+ IF (NP.LE.0) NP = 1
+C
+C...Plot decimal point (NL=0)
+ 80 IF(NL.EQ.0) THEN
+C...No decimal point?
+ IF (ndig.LT.0) GO TO 120
+ CALL PLCHARABS(XX,YY,CHX,POINT,ANGLE,1)
+ IF (ndig.NE.0) NP = NP + 1
+ ELSE
+C...Plot digit
+ IDIG = IFIX(T2)
+ T2 = (T2 - FLOAT (IDIG))*10.
+ CHDIG = char(IDIG + IZERO)
+ CALL PLCHARABS(XX,YY,CHX,CHDIG,ANGLE,1)
+ ENDIF
+ xx = 999.
+ yy = 999.
+C
+C...Count digit
+ NP = NP - 1
+ 120 NL = NL - 1
+C
+C...More digits to plot?
+ IF(NP.GT.0) GO TO 80
+ RETURN
+ END
+
+ subroutine PLCHARABS(XC,YC,CHX,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with standard character font
+C
+C XC,YC = absolute coordinate position for first character in string
+C if XC=999. the last x plotting position is used
+C if YC=999. the last y plotting position is used
+C CHX = character width in x (absolute coordinate length)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETLASTXYABS, GETPAT, NEWPAT, PLOTABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+ INCLUDE 'CHAR.INC'
+C
+ DATA PI /3.1415926535897932384/
+C
+ SINA = SIN(ANGLE*PI/180.0)
+ COSA = COS(ANGLE*PI/180.0)
+C
+ XX = XC
+ YY = YC
+C---- if XC=999. or YC=999. get last x,y character plotting position
+ IF (xc.EQ.999. .OR. yc.EQ.999.) THEN
+ CALL GETLASTXYABS(XCHR,YCHR)
+ IF(XC.EQ.999.) XX = XCHR
+ IF(YC.EQ.999.) YY = YCHR
+ ENDIF
+C
+C---- get the old line pattern, only plot characters & symbols with solid lines
+ CALL GETPAT(lmask)
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(-1)
+ ENDIF
+C
+C---- if number of characters
+ ncc = nc
+ if(ncc.LT.0) ncc = LEN(STRING)
+ if(ncc.EQ.0) return
+c
+C---- go over each character...
+ DO 12 IC=1, ncc
+C
+C------ set character origin location
+ X0 = XX + CHX*FLOAT(IC-1)*COSA
+ Y0 = YY + CHX*FLOAT(IC-1)*SINA
+C
+ KC = INDEX(CHARS,STRING(IC:IC))
+C
+ IF(KC.NE.0) THEN
+C
+C-------- decode and plot each node
+ DO K=1, 20
+C
+C---------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+ FI = FLOAT(I-16)/64.0
+ FJ = FLOAT(J-16)/64.0
+C
+ X = X0 + CHX*(FI*COSA - FJ*SINA)
+ Y = Y0 + CHX*(FI*SINA + FJ*COSA)
+C
+ IF (ISTAT.EQ.0) THEN
+ GOTO 12
+ ELSEIF (ISTAT.EQ.1) THEN
+ CALL PLOTABS(X,Y,2)
+ ELSE
+ CALL PLOTABS(X,Y,3)
+ ENDIF
+C
+ ENDDO
+ ENDIF
+C
+ 12 CONTINUE
+C
+C---- move to bottom right corner x,y for next call with x,y = 999.,999.
+ X0 = XX + CHX*FLOAT(ncc)*COSA
+ Y0 = YY + CHX*FLOAT(ncc)*SINA
+ CALL PLOTABS(X0,Y0,3)
+C
+C---- restore line pattern
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(lmask)
+ ENDIF
+C
+ RETURN
+ END
+
+ subroutine PLSLANABS(XC,YC,CHX,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with slanted character font
+C
+C XC,YC = absolute coordinate position for first character in string
+C if XC=999. the last x plotting position is used
+C if YC=999. the last y plotting position is used
+C CHX = character width in x (absolute coordinate length)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETLASTXYABS, GETPAT, NEWPAT, PLOTABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+ INCLUDE 'SLAN.INC'
+C
+ DATA PI /3.1415926535897932384/
+C
+ SINA = SIN(ANGLE*PI/180.0)
+ COSA = COS(ANGLE*PI/180.0)
+C
+ XX = XC
+ YY = YC
+C---- if XC=999. or YC=999. get last x,y character plotting position
+ IF (xc.EQ.999. .OR. yc.EQ.999.) THEN
+ CALL GETLASTXYABS(XCHR,YCHR)
+ IF(XC.EQ.999.) XX = XCHR
+ IF(YC.EQ.999.) YY = YCHR
+ ENDIF
+C
+C---- get the old line pattern, only plot characters & symbols with solid lines
+ CALL GETPAT(lmask)
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(-1)
+ ENDIF
+C
+C---- if number of characters
+ ncc = nc
+ if(ncc.LT.0) ncc = LEN(STRING)
+ if(ncc.EQ.0) return
+c
+C---- go over each character...
+ DO 12 IC=1, ncc
+C
+C------ set character origin location
+ X0 = XX + CHX*FLOAT(IC-1)*COSA
+ Y0 = YY + CHX*FLOAT(IC-1)*SINA
+C
+ KC = INDEX(CHARS,STRING(IC:IC))
+C
+ IF(KC.NE.0) THEN
+C
+C-------- decode and plot each node
+ DO K=1, 20
+C
+C---------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+ FI = FLOAT(I-16)/64.0
+ FJ = FLOAT(J-16)/64.0
+C
+ X = X0 + CHX*(FI*COSA - FJ*SINA)
+ Y = Y0 + CHX*(FI*SINA + FJ*COSA)
+C
+ IF (ISTAT.EQ.0) THEN
+ GOTO 12
+ ELSEIF (ISTAT.EQ.1) THEN
+ CALL PLOTABS(X,Y,2)
+ ELSE
+ CALL PLOTABS(X,Y,3)
+ ENDIF
+C
+ ENDDO
+ ENDIF
+C
+ 12 CONTINUE
+C
+C---- move to bottom right corner x,y for next call with x,y = 999.,999.
+ X0 = XX + CHX*FLOAT(ncc)*COSA
+ Y0 = YY + CHX*FLOAT(ncc)*SINA
+ CALL PLOTABS(X0,Y0,3)
+C
+C---- restore line pattern
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(lmask)
+ ENDIF
+C
+ RETURN
+ END
+
+ subroutine PLMATHABS(XC,YC,CHX,STRING,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots character string with math character font
+C
+C XC,YC = absolute coordinate position for first character in string
+C if XC=999. the last x plotting position is used
+C if YC=999. the last y plotting position is used
+C CHX = character width in x (absolute coordinate length)
+C STRING = character string to plot with nc characters
+C ANGLE = angle of character (radians, positive is righthanded rotation)
+C nc = number of characters to plot
+C if nc<0 the length of the string is determined automatically
+C
+C Character plotting uses the vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 16,16)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETLASTXYABS, GETPAT, NEWPAT, PLOTABS
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+ INCLUDE 'MATH.INC'
+C
+ DATA PI /3.1415926535897932384/
+C
+ SINA = SIN(ANGLE*PI/180.0)
+ COSA = COS(ANGLE*PI/180.0)
+C
+ XX = XC
+ YY = YC
+C---- if XC=999. or YC=999. get last x,y character plotting position
+ IF (xc.EQ.999. .OR. yc.EQ.999.) THEN
+ CALL GETLASTXYABS(XCHR,YCHR)
+ IF(XC.EQ.999.) XX = XCHR
+ IF(YC.EQ.999.) YY = YCHR
+ ENDIF
+C
+C---- get the old line pattern, only plot characters & symbols with solid lines
+ CALL GETPAT(lmask)
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(-1)
+ ENDIF
+C
+C---- if number of characters
+ ncc = nc
+ if(ncc.LT.0) ncc = LEN(STRING)
+ if(ncc.EQ.0) return
+c
+C---- go over each character...
+ DO 12 IC=1, ncc
+C
+C------ set character origin location
+ X0 = XX + CHX*FLOAT(IC-1)*COSA
+ Y0 = YY + CHX*FLOAT(IC-1)*SINA
+C
+ KC = INDEX(CHARS,STRING(IC:IC))
+C
+ IF(KC.NE.0) THEN
+C
+C-------- decode and plot each node
+ DO K=1, 20
+C
+C---------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+ FI = FLOAT(I-16)/64.0
+ FJ = FLOAT(J-16)/64.0
+C
+ X = X0 + CHX*(FI*COSA - FJ*SINA)
+ Y = Y0 + CHX*(FI*SINA + FJ*COSA)
+C
+ IF (ISTAT.EQ.0) THEN
+ GOTO 12
+ ELSEIF (ISTAT.EQ.1) THEN
+ CALL PLOTABS(X,Y,2)
+ ELSE
+ CALL PLOTABS(X,Y,3)
+ ENDIF
+C
+ ENDDO
+ ENDIF
+C
+ 12 CONTINUE
+C
+C---- move to bottom right corner x,y for next call with x,y = 999.,999.
+ X0 = XX + CHX*FLOAT(ncc)*COSA
+ Y0 = YY + CHX*FLOAT(ncc)*SINA
+ CALL PLOTABS(X0,Y0,3)
+C
+C---- restore line pattern
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(lmask)
+ ENDIF
+C
+ RETURN
+ END
+
+ subroutine PLSYMBABS(XC,YC,CHX,ISYM,ANGLE,nc)
+C----------------------------------------------------------------
+C Plots a symbol with symbol font indexed by integer
+C
+C XC,YC = absolute coordinate position for plotting symbol
+C if XC=999. the last x plotting position is used
+C if YC=999. the last y plotting position is used
+C CHX = symbol width in x (absolute coordinate length)
+C ISYM = integer to select symbol (0..?)
+C ANGLE = angle for symbol (radians, positive is righthanded rotation)
+C nc = 0 just move to x,y before plotting symbol
+C .ne.0 draw line to x,y before plotting symbol
+C
+C Plots a symbol using vector font database NODE(..)
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy (origin assumed to be at 48,48)
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C
+C CALLS: GETLASTXYABS, GETPAT, NEWPAT, PLOTABS
+C----------------------------------------------------------------
+ INTEGER ISYM
+C
+ INCLUDE 'SYMB.INC'
+C
+ DATA PI /3.1415926535897932384/
+C
+ SINA = SIN(ANGLE*PI/180.0)
+ COSA = COS(ANGLE*PI/180.0)
+C
+ XX = XC
+ YY = YC
+C---- if XC=999. or YC=999. get last x,y character plotting position
+ IF (XC.EQ.999. .OR. YC.EQ.999.) THEN
+ CALL GETLASTXYABS(XCHR,YCHR)
+ IF(XC.EQ.999.) XX = XCHR
+ IF(YC.EQ.999.) YY = YCHR
+ ENDIF
+C
+C------ set character origin location
+ X0 = XX
+ Y0 = YY
+C------ draw to X0,Y0 first ?
+ IF(nc .NE. 0) CALL PLOTABS(X0,Y0,2)
+C
+C---- get the old line pattern, only plot characters & symbols with solid lines
+ CALL GETPAT(lmask)
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(-1)
+ ENDIF
+C
+C
+C---Plot symbol index modulo symbol count (NCHARS defined symbols)
+ccc KC = ISYM + 1
+ KC = MOD(ISYM,NCHARS) + 1
+C
+ IF(KC.GE.1 .AND. KC.LE.NCHARS) THEN
+C
+C-------- decode and plot each node
+ DO K=1, 20
+C
+C---------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+ FI = FLOAT(I-48)/64.0
+ FJ = FLOAT(J-48)/64.0
+C
+ X = X0 + CHX*(FI*COSA - FJ*SINA)
+ Y = Y0 + CHX*(FI*SINA + FJ*COSA)
+C
+ IF (ISTAT.EQ.0) THEN
+ GOTO 12
+ ELSEIF (ISTAT.EQ.1) THEN
+ CALL PLOTABS(X,Y,2)
+ ELSE
+ CALL PLOTABS(X,Y,3)
+ ENDIF
+C
+ ENDDO
+ ENDIF
+C
+ 12 CONTINUE
+C
+C---- move to origin x,y for next call with x,y = 999.,999.
+ CALL PLOTABS(X0,Y0,3)
+C
+C---- restore line pattern
+ IF(lmask.ne.-1) THEN
+ CALL NEWPAT(lmask)
+ ENDIF
+C
+ RETURN
+ END
+
diff --git a/plotlib/plt_old.f b/plotlib/plt_old.f
new file mode 100644
index 0000000..eff6e60
--- /dev/null
+++ b/plotlib/plt_old.f
@@ -0,0 +1,1455 @@
+C***********************************************************************
+C Module: plt_old.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 "old Versatec-like" routines
+C
+C Version 4.46 11/28/01
+C
+C Xplot11 interface for older plot routines (similar to that for
+C Versatec graphics) as a bridge to backwards compatibility with
+C old programs.
+C
+C These routines are not preferred for creating a new application,
+C although they will work. Use the equivalent routines in
+C plt_base.f, plt_util.f, etc. if you want more capability.
+C
+C...Note:
+C If your compiler supports passing character data as integers without
+C complaining and you want old style Versatec SYMBOL compatibility (so
+C you can call SYMBOL with either characters stuffed into an integer
+C array or with integer arguments to specify plot symbols) you can use
+C the sections of the following code marked with C+++OldVersatec comments.
+C In that case you don't need the SYMBL routine, just call SYMBOL with
+C integer arguments. You also need to switch marked statements in
+C SYMBOL, NUMBER and LINE.
+C
+C***********************************************************************
+C
+C
+ subroutine PLOTS(idummy,ihard,ldev)
+C--- Open plotting
+C IHARD - sets hardcopy option
+C IHARD=>0 hardcopy on
+C IHARD <0 hardcopy off (typically IHARD=-999 sets no hardcopy)
+C
+C LDEV - output device (used to be LDEV=6 for Xwindows)
+C currently LDEV =0 gives BW hardcopy only
+C currently LDEV<>0 gives Xwindow (+ BW hardcopy if IHARD>0)
+C
+C This routine uses IHARD>=0 to select hardcopy output
+C The Xwindow defaults to 2/3 of the root window, landscape mode
+C
+ SAVE ifirst, relsize, nunit
+ DATA ifirst / 0 /
+C
+ if(ifirst.EQ.0) then
+ ifirst = 1
+ call PLINITIALIZE
+ relsize = 0.6666
+ nunit = 0
+ endif
+c
+ idev = 0
+ if(ldev.NE.0) idev = 1
+ if(ihard.GE.0) then
+ idev = idev + 2
+ endif
+cc write(*,*) 'calling plopen with ',relsize,nunit,idev
+ call PLOPEN(relsize,nunit,idev)
+c
+ return
+ end
+
+
+ subroutine PLOTON
+ return
+ end
+
+
+ subroutine PLOTOF
+ call PLFLUSH
+ return
+ end
+
+
+ subroutine ERASE
+ call WINERASE
+ return
+ end
+
+
+ subroutine FACTOR(scl)
+ call NEWFACTOR(scl)
+ return
+ end
+
+
+ subroutine WHERE(xnow,ynow,fact)
+C--- Returns last x,y position and scale factor
+ call GETLASTXY(xnow,ynow)
+ call GETFACTORS(fact,dum)
+ return
+ end
+
+ subroutine WHEREC(xcurs,ycurs)
+ character*1 chkey
+ call GETCURSORXY(xcurs,ycurs,chkey)
+ return
+ end
+
+
+ subroutine WINPIX(nxpix,nypix,ppi)
+C--- Returns Xwindow size in pixels and the pixels per inch of
+C postsript output (not pixels/inch on the screen!)
+C--- WINPIX has been officially replaced by GETWINSIZEABS in XPLOT11
+ include 'pltlib.inc'
+ nxpix = GX_SIZ
+ nypix = GY_SIZ
+ ppi = G_SCALE
+ return
+ end
+
+ subroutine GETWINPIX(nxpix,nypix,ppi)
+C--- Same as WINPIX
+ call WINPIX(nxpix,nypix,ppi)
+ return
+ end
+
+
+
+ subroutine GRID (X,Y,NX,XD,NY,YD,LMASK)
+ call PLGRID (X,Y,NX,XD,NY,YD,LMASK)
+ return
+ end
+
+
+
+ subroutine COLOR (icol)
+C--- Selects a foreground color for defined (old-style) colormap
+ common / PLT10_OLD / ncols_old, icolmap_old(0:255)
+c
+ if(ncols_old.LE.0) then
+ write(*,*) '*** COLOR no colormap defined'
+ endif
+ if(icol.LT.0 .OR. icol.GT.ncols_old) then
+ write(*,*) '*** COLOR out of bounds: ',icol
+ endif
+C--- Use colormap entry
+ ic = icolmap_old(icol)
+c write(*,*) 'COLOR ',icol,ic
+ call NEWCOLOR(ic)
+ return
+ end
+
+
+ subroutine SETCOL (icol,red,grn,blu)
+C--- Set up a colormap entry
+C The "old" color routines simply set up rgb entries in the regular
+C colormap. They do not use the spectrum colors.
+C Note: repeated calls to SETCOL without reseting the colormap will
+C (eventually) fill up the allocated 'old-style' colormap.
+C
+C To reset the 'old-style' colormap give a color
+C index icol<0, this resets the number of allocated colors to 0.
+C
+ common / PLT10_OLD / ncols_old, icolmap_old(0:255)
+ data ifirst / 0 /
+c
+ if(ifirst.EQ.0) then
+ ifirst = 1
+ ncols_old = 0
+ endif
+c
+ if(ncols_old.GE.256) then
+ write(*,*) '*** SETCOL no more colors available: ',ncols_old
+ return
+ endif
+c
+C--- Reset the colormap if icol<0
+ if(ncols_old.LT.0) then
+ ncols_old = 0
+ return
+ endif
+c
+ ired = ifix(255.*red)
+ igrn = ifix(255.*grn)
+ iblu = ifix(255.*blu)
+C--- Install as a regular colormap color
+ call NEWCOLORRGB(ired,igrn,iblu)
+ call GETCOLOR(ic)
+c write(*,*) 'SETCOL ',icol,ired,igrn,iblu,ic
+ ncols_old = ncols_old + 1
+ icolmap_old(icol) = ic
+ return
+ end
+
+
+C***********************************************************
+C Versatec-style Utility routines
+C LINE
+C CURVE
+C AXIS
+C AXIS2
+C SCALE
+C SYMBL - plots graphics symbol given by integer argument
+C SYMBOL - plots character symbol using stroke graphics that
+C call the basic PLOT plotting function
+C NUMBER - plots numbers using a format conversion to characters
+C***********************************************************
+
+
+
+ SUBROUTINE LINE (XARRAY,YARRAY,NPTS,INC,LINTYP,ISYM)
+C...Plots array of x,y data as a piecewise linear set of line segments
+C
+C Input: XARRAY is an array of coordinate points to be joined
+C YARRAY by smooth curve.
+C
+C NPTS ABS(NPTS) is the number of points to plot from points
+C in XARRAY and YARRAY.
+C NPTS<0 indicates that scale factors are located as the
+C last two elements of each data array (i.e.
+C NPTS+1 AND NPTS+2).
+C NPTS>0 indicates that the coordinate points are already
+C scaled for plotting (no scale factors).
+c
+C INC increment used to access points in XARRAY,YARRAY
+C LINTYP Plotting flag, ABS(LINTYP) is the symbol plotting
+C increment (i.e. +2 gives a symbol at every other point)
+C LINTYP<0 symbols only
+C LINTYP=0 lines only
+C LINTYP>0 lines and symbols
+C ISYM Symbol index to be used for points with symbols
+C
+C Calls: PLOT
+C
+C...Note:
+C You might need to change the SYMBL call below to SYMBOL if your compiler
+C supports passing character literals as integers without complaining
+C and you enable old style Versatec SYMBOL calls with integer arguments.
+C See SYMBOL below...
+C
+ DIMENSION XARRAY(*),YARRAY(*)
+ DATA SYMSIZE / 0.08 /
+C
+C...Initialize subscripts
+ LMIN = NPTS*INC + 1
+ LDX = LMIN + INC
+ NL = LMIN - INC
+C
+C...Set limits and scaling factors
+ FIRSTX = XARRAY(LMIN)
+ DELTAX = XARRAY(LDX)
+ FIRSTY = YARRAY(LMIN)
+ DELTAY = YARRAY(LDX)
+C
+C...Current plotting location
+ CALL GETLASTXY (XN,YN)
+ DF = AMAX1 (ABS ((XARRAY(1) - FIRSTX)/DELTAX - XN),
+ & ABS ((YARRAY(1) - FIRSTY)/DELTAY - YN))
+ DL = AMAX1 (ABS ((XARRAY(NL) - FIRSTX)/DELTAX - XN),
+ & ABS ((YARRAY(NL) - FIRSTY)/DELTAY - YN))
+ IPEN = 3
+ ICODE = -1
+ NT = IABS(LINTYP)
+C
+C...Symbols plotted?
+ IF (LINTYP.EQ.0) NT = 1
+C
+C
+ IF (DL.GE.DF) THEN
+C...Ascending order
+ NF = 1
+ NA = NT
+ KK = INC
+ ELSE
+C...Descending order
+ NF = NL
+ NA = ((NPTS - 1)/NT)*NT + NT - (NPTS - 1)
+ KK = -INC
+ ENDIF
+C
+C
+ IF(LINTYP.LT.0) THEN
+C...Symbols only
+ IPENA = 3
+ ICODEA = -1
+ LSW = 1
+ ELSE
+C...Symbols
+ IPENA = 2
+ ICODEA = -2
+ LSW = 0
+C...Lines only
+ IF(LINTYP.EQ.0) NA = LDX
+ ENDIF
+C
+C...Plot data
+ DO 120 I=1,NPTS
+ XN = (XARRAY(NF) - FIRSTX)/DELTAX
+ YN = (YARRAY(NF) - FIRSTY)/DELTAY
+C...Plot symbol
+ IF (NA.EQ.NT) THEN
+C---For new style SYMBL call (character string input to SYMBOL)
+ CALL SYMBL(XN,YN,SYMSIZE,ISYM,0.0,ICODE)
+C+++OldVersatec (integer variable as input to SYMBOL)
+C CALL SYMBL(XN,YN,SYMSIZE,ISYM,0.0,ICODE)
+C+++OldVersatec
+ NA = 1
+ GO TO 110
+ ENDIF
+C...Or lines between symbols
+ IF(NA.LT.NT .AND. LSW.NE.0) GO TO 100
+C
+C...Plot line to new point
+ CALL PLOT(XN,YN,IPEN)
+C
+C...Counters for plotting points and symbols
+ 100 NA = NA + 1
+ 110 NF = NF + KK
+ ICODE = ICODEA
+ IPEN = IPENA
+ 120 CONTINUE
+ CALL PLOTOF
+C
+ RETURN
+ END
+
+
+
+ SUBROUTINE CURVE (X,Y,NE,DELTA)
+C...Plots curve with solid or dashed lines
+C
+C Input: X,Y is an array of coordinate points to be joined
+C by smooth curve.
+C
+C NE ABS(NE) is the number of coordinate points in X and Y.
+C NE<0 indicates that scale factors are located as the
+C last two elements of each data array (i.e. NE+1 AND NE+2).
+C NE>0 indicates that the coordinate points are already
+C scaled for plotting (no scale factors).
+C
+C DELTA ABS(DELTA) is the segment length for approximating
+C the curve.
+C DELTA<0 indicates that the curve is plotted with dashed lines
+C of 'delta' length.
+C DELTA>0 indicates that the curve is plotted with a solid line.
+C
+C Calls: PLOT
+C
+ DIMENSION X(NE),Y(NE)
+C
+C...Default scale factors
+ XOFF = 0.
+ YOFF = 0.
+ XFAC = 1.
+ YFAC = 1.
+ NET = NE
+ IF(NET.EQ.0) RETURN
+C
+ IF(NE.LT.0) THEN
+C...Scale factors in last two array elements
+ NET = -NET
+ XOFF = X(NET+1)
+ YOFF = Y(NET+1)
+ XFAC = X(NET+2)
+ YFAC = Y(NET+2)
+ ENDIF
+C
+C...Solid or dashed lines?
+ IF(DELTA.EQ.0.0) RETURN
+ MPEN = 4
+ DELT = DELTA
+ IF (DELT.LT.0.0) THEN
+ DELT = -DELT
+ MPEN = 5
+ ENDIF
+C
+C...Initialize everything
+ K = 1
+ IPEN = 3
+ DLTSQ = DELTA*DELTA
+C
+C
+C...Begin main loop.
+C (X1,Y1) is joined to (X2,Y2) by arc with direction cosines
+C (C1,S1) and (C2,S2) at end points. Final values for previous
+C arc are initial values for new arc.
+C
+C...New end point
+ 110 X2 = (X(K)-XOFF)/XFAC
+ Y2 = (Y(K)-YOFF)/YFAC
+ IF (K.EQ.NET) GO TO 130
+ IF (K.GT.1) GO TO 140
+C
+C...First data point (K=1)
+ 120 IF (NET-2) 122,124,126
+ 122 X1 = (X(1)-XOFF)/XFAC
+ Y1 = (Y(1)-YOFF)/YFAC
+ CALL PLOT (X1,Y1,+3)
+ GOTO 500
+ 124 DLTX1 = (X(2)-X(1))/XFAC
+ DLTY1 = (Y(2)-Y(1))/YFAC
+ DLTX2 = DLTX1
+ DLTY2 = DLTY1
+ GOTO 128
+ 126 DLTX1 = (X(2)-X(1))/XFAC
+ DLTY1 = (Y(2)-Y(1))/YFAC
+ DLTX2 = (X(3)-X(2))/XFAC
+ DLTY2 = (Y(3)-Y(2))/YFAC
+ 128 T1 = DLTX1*DLTX1 + DLTY1*DLTY1
+ T2 = DLTX2*DLTX2 + DLTY2*DLTY2
+ T3 = 2.*SQRT(T1*T2)
+ T1 = -T1
+ T2 = T3 + T2
+ GO TO 150
+C
+C...Last data point (K=NET)
+ 130 DLTX1 = X1 - (X(K-2)-XOFF)/XFAC
+ DLTY1 = Y1 - (Y(K-2)-YOFF)/YFAC
+ DLTX2 = X2 - X1
+ DLTY2 = Y2 - Y1
+ T1 = DLTX1*DLTX1 + DLTY1*DLTY1
+ T2 = DLTX2*DLTX2 + DLTY2*DLTY2
+ T3 = 2.*SQRT(T1*T2)
+ T2 = -T2
+ T1 = T3 + T1
+ GO TO 150
+C
+C...Intermediate data point (1<K<NET)
+ 140 DLTX1 = X2 - X1
+ DLTY1 = Y2 - Y1
+ DLTX2 = (X(K+1)-X(K))/XFAC
+ DLTY2 = (Y(K+1)-Y(K))/YFAC
+ T1 = DLTX1*DLTX1 + DLTY1*DLTY1
+ T2 = DLTX2*DLTX2 + DLTY2*DLTY2
+C
+ 150 E = DLTX1*T2 + DLTX2*T1
+ F = DLTY1*T2 + DLTY2*T1
+ G = SQRT(E*E+F*F)
+ IF (G.NE.0.) G = 1./G
+ C2 = G*E
+ S2 = G*F
+ IF (K.EQ.1) GO TO 180
+C
+ U = X2 - X1
+ V = Y2 - Y1
+ G = U*U + V*V
+ A = C1*C2 + S1*S2
+C
+C...Check if (X2,Y2) is more than 'DELTA' from (X1,Y1)
+ IF (G.GE.DLTSQ) GO TO 200
+C
+C...Distinguish between close points and coincident points
+ IF (G.GT.0.) GO TO 170
+C
+C...Test for matching tangents
+ IF (A.LE.0.99996) GO TO 180
+C
+C...(X1,Y1),(X2,Y2) less than 'DELTA' apart, hop to next point.
+ 170 K = K + 1
+ IF (K.LE.NET) GO TO 110
+C
+ 180 CALL PLOT (X2,Y2,IPEN)
+ H = DELT
+ IPEN = 2
+ GO TO 320
+C
+C...Cubic coefficients for X and Y
+ 200 A = 7. - A
+ E = C1 + C2
+ F = S1 + S2
+ B = U*E + V*F
+ T = SQRT(B*B+2.*A*G)
+ C = (T+B)/G
+ T = 3.*(T-B)/A
+ G = C/12.
+ A = G*(C*U-3.*E)
+ B = G*(C*V-3.*F)
+ U = G*(C2-C1) + A
+ V = G*(S2-S1) + B
+ C = -C/9.
+ A = A*C
+ B = B*C
+ G = H
+C
+C...X AND Y coordinates of arc are given as parametric cubics with
+C parameter going from zero to T and held in G. The increment is DELTA.
+C G is set initially to space the first point of the new arc
+C at distance DELTA from the last point of the previous arc.
+C
+C...Generate approximation for each segment
+ 220 E = G*(G*(A*G+U)+C1) + X1
+ F = G*(G*(B*G+V)+S1) + Y1
+ CALL PLOT (E,F,IPEN)
+ IPEN = MPEN - IPEN
+ G = G + DELT
+ H = G - T
+ IF (H.LE.0.) GO TO 220
+C
+C...Arc (X1,Y1) to (X2,Y2) complete, setup for next arc
+ 320 X1 = X2
+ Y1 = Y2
+ C1 = C2
+ S1 = S2
+ K = K + 1
+ IF (K.LE.NET) GO TO 110
+C
+C
+C...Close to last point of curve
+ CALL PLOT (X2,Y2,IPEN)
+ 500 CALL PLOTOF
+ RETURN
+ END
+
+
+ SUBROUTINE AXIS (X,Y,LABEL,NCHAR,AXLEN,ANGLE,FVAL,DV)
+C...Plots labeled axis with tic marks and annotations
+C
+C Input: X,Y Starting coordinates for axis (REAL)
+C
+C LABEL Text string for labeling the axis
+C
+C NCHAR Number of characters in the axis label (INTEGER)
+C NCHAR>0 annotations generated above axis
+C NCHAR<0 annotations generated below axis
+C
+C AXLEN Axis length in inches (REAL)
+C ANGLE Axis angle in degrees (positive CCW) (REAL)
+C
+C FVAL First annotation value (REAL)
+C DV Delta annotation value (REAL)
+C
+C Calls: NUMBER, SYMBOL
+C
+C...Note:
+C If your compiler supports passing character data as integers without
+C complaining and you want old style Versatec SYMBOL compatibility (so
+C you can call SYMBOL with either characters stuffed into an integer
+C array or with integer arguments to specify plot symbols) you can use
+C the sections of the following code marked with C+++OldVersatec comments.
+C
+C---Declaration as a character variable
+ CHARACTER*(*) LABEL
+C---Declaration of as integer or byte variable
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C LOGICAL*1 LABEL(1)
+C INTEGER*1 LABEL(1)
+C BYTE LABEL(1)
+C+++OldVersatec
+C
+ DATA RADN/0.01745329/
+C
+C
+C...Side of axis to annotate and label
+ SIDE = +1.
+ NC = NCHAR
+C...NCHAR<0 means plot below axis
+ IF (NC.LT.0) THEN
+ NC = -NC
+ SIDE = -1.
+ ENDIF
+C
+C...Value of 'DV' exponent
+ EXP = 0.0
+ ADV = ABS (DV)
+C
+C...Check for zero delta annotation value?
+ IF (ADV.NE.0.) THEN
+C
+C...Get exponent by dividing by decades
+ 20 IF (ADV.LT.99.) GO TO 40
+ ADV = ADV/10.
+ EXP = EXP + 1.
+ GO TO 20
+C
+ 30 ADV = ADV*10.
+ EXP = EXP - 1.
+C...If too small cut the exponent
+ 40 IF (ADV.LT.0.01) GO TO 30
+C
+ ENDIF
+C
+C...Normalized 'FVAL' and 'DV'
+ VAL = FVAL*(10.**(-EXP))
+ ADV = DV*(10.**(-EXP))
+C
+C...Angular orientation variables
+ T2 = ANGLE*RADN
+ SINA = SIN (T2)
+ COSA = COS (T2)
+C
+ DX = -0.1
+ DY = 0.15*SIDE - 0.05
+ XX = X + DX*COSA - DY*SINA
+ YY = Y + DY*COSA + DX*SINA
+C
+C...Annotate axis
+ NTIC = AXLEN + 1.0
+ DO I=1,NTIC
+ CALL NUMBER (XX,YY,0.105,VAL,ANGLE,2)
+ VAL = VAL + ADV
+ XX = XX + COSA
+ YY = YY + SINA
+ END DO
+C
+C...Label axis
+ T2 = NC
+C
+C...Do we have a valid exponent?
+ IF (EXP.NE.0.) T2 = NC + 6
+C
+ DX = -0.07*T2 + 0.5*AXLEN
+ DY = 0.325*SIDE - 0.075
+ XX = X + DX*COSA - DY*SINA
+ YY = Y + DY*COSA + DX*SINA
+ CALL SYMBOL (XX,YY,0.14,LABEL,ANGLE,NC)
+C
+C...Plot exponent
+ IF (EXP.NE.0.) THEN
+ CALL SYMBOL (999.,999.,0.14,' *10',ANGLE,5)
+ T2 = NC + 5
+ XX = XX + (T2*COSA - 0.8*SINA)*0.14
+ YY = YY + (T2*SINA + 0.8*COSA)*0.14
+ CALL NUMBER (XX,YY,0.07,EXP,ANGLE,-1)
+ ENDIF
+C
+C...Draw axis and tic marks
+ DX = -0.07*SIDE*SINA
+ DY = +0.07*SIDE*COSA
+ XX = X
+ YY = Y
+ CALL PLOT (XX,YY,3)
+ DO I=1,NTIC
+ CALL PLOT (XX,YY,2)
+ CALL PLOT (XX+DX,YY+DY,2)
+ CALL PLOT (XX,YY,3)
+ XX = XX + COSA
+ YY = YY + SINA
+ END DO
+C
+ CALL PLOTOF
+ RETURN
+ END
+
+
+ SUBROUTINE AXIS2 (X,Y,LABEL,NCHAR,CSCAL,AXLEN,DAX,ANGLE,FVAL,DV)
+C...Plots labeled axis with tic marks and annotations
+C
+C Input: X,Y Starting coordinates for axis (REAL)
+C
+C LABEL Text string for labeling the axis
+C
+C NCHAR Number of characters in the axis label (INTEGER)
+C NCHAR>0 annotations generated above axis
+C NCHAR<0 annotations generated below axis
+C
+C CSCAL Character height scale factor
+C AXLEN Axis length in inches (REAL)
+C DAX Distance between annotations in inches
+C DAX>0 first annotation value plotted
+C DAX<0 first annotation value not plotted
+C (using DAX=1.0 corresponds to AXIS routine)
+C ANGLE Axis angle in degrees (positive CCW) (REAL)
+C
+C FVAL First annotation value (REAL) [not plotted if DAX < 0]
+C DV Delta annotation value (REAL)
+C
+C Calls: NUMBER, SYMBOL
+C
+C...Note:
+C If your compiler supports passing character data as integers without
+C complaining and you want old style Versatec SYMBOL compatibility (so
+C you can call SYMBOL with either characters stuffed into an integer
+C array or with integer arguments to specify plot symbols) you can use
+C the sections of the following code marked with C+++OldVersatec comments.
+C
+C---Declaration as a character variable
+ CHARACTER*(*) LABEL
+C---Declaration of as integer or byte variable
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C LOGICAL*1 LABEL(1)
+C INTEGER*1 LABEL(1)
+C BYTE LABEL(1)
+C+++OldVersatec
+C
+ DATA RADN/0.01745329/
+C
+ ADAX = ABS(DAX)
+ ISTART = 1
+ IF(DAX.LT.0.0) ISTART = 2
+C
+C...Character heights
+ CHARH = 0.140*ADAX*CSCAL
+ RNUMH = 0.105*ADAX*CSCAL
+C
+C
+C...Side of axis to annotate and label
+ SIDE = +1.
+ NC = NCHAR
+C...NCHAR<0 is lower side
+ IF (NC.LT.0) THEN
+ NC = -NC
+ SIDE = -1.
+ ENDIF
+C
+C...Exponent?
+ EXP = 0.0
+ ADV = ABS (DV)
+C
+C...Check for zero delta annotation value?
+ IF (ADV.NE.0.) THEN
+C
+C...Check exponent by dividing by decades
+ 20 IF (ADV.LT.99.) GO TO 40
+ ADV = ADV/10.
+ EXP = EXP + 1.
+ GO TO 20
+C
+ 30 ADV = ADV*10.
+ EXP = EXP - 1.
+C...If too small cut the exponent
+ 40 IF (ADV.LT.0.01) GO TO 30
+C
+ ENDIF
+C
+C...Normalize 'FVAL' AND 'DV'
+ AFVAL = FVAL*(10.**(-EXP))
+ ADV = DV*(10.**(-EXP))
+C
+C...Angular orientation variables
+ T2 = ANGLE*RADN
+ SINA = SIN (T2)
+ COSA = COS (T2)
+C
+ DY = 1.4*RNUMH*SIDE - 0.5*RNUMH
+C
+C...Annotate axis
+ NTIC = INT(AXLEN/ADAX) + 1
+ DO I=ISTART, NTIC
+ RNT = FLOAT(I-1)
+ VAL = AFVAL + ADV*RNT
+C...Number of digits before decimal point
+ NV10 = INT(ABS(VAL)/10.)
+ NDIG = 1
+ IF(NV10.GT.0) NDIG = NDIG + 1
+C...Add one for minus sign
+ IF(VAL.LT.0.) NDIG = NDIG + 1
+C
+ DX = -(FLOAT(NDIG) + 0.5)*0.84*RNUMH
+ XX = X + DX*COSA - DY*SINA + ADAX*COSA*RNT
+ YY = Y + DY*COSA + DX*SINA + ADAX*SINA*RNT
+ CALL NUMBER (XX,YY,RNUMH,VAL,ANGLE,2)
+ END DO
+C
+C...Label axis
+ T2 = FLOAT(NC)
+C
+C...Do we have a valid exponent?
+ IF (EXP.NE.0.) T2 = FLOAT(NC + 6)
+C
+ DX = -0.5*CHARH*T2 + 0.5*AXLEN
+ DY = (1.5*RNUMH + 1.5*CHARH)*SIDE - 0.5*CHARH
+ XX = X + DX*COSA - DY*SINA
+ YY = Y + DY*COSA + DX*SINA
+ CALL SYMBOL (XX,YY,CHARH,LABEL,ANGLE,NC)
+C
+C...Plot exponent
+ IF (EXP.NE.0.) THEN
+ CALL SYMBOL (999.,999.,CHARH,' X 10',ANGLE,6)
+ T2 = FLOAT(NC + 6)
+ XX = XX + (T2*COSA - 0.75*SINA)*CHARH
+ YY = YY + (T2*SINA + 0.75*COSA)*CHARH
+ CALL NUMBER (XX,YY,0.5*CHARH,EXP,ANGLE,-1)
+ ENDIF
+C
+C...Tic marks
+ DX = -0.4*RNUMH*SIDE*SINA
+ DY = +0.4*RNUMH*SIDE*COSA
+ DO I=1, NTIC
+ RNT = FLOAT(I-1)
+ XX = X + COSA*ADAX*RNT
+ YY = Y + SINA*ADAX*RNT
+ CALL PLOT (XX,YY,3)
+ CALL PLOT (XX+DX,YY+DY,2)
+ END DO
+C
+C...Axis
+ XX = X + COSA*AXLEN
+ YY = Y + SINA*AXLEN
+ CALL PLOT (X,Y,3)
+ CALL PLOT (XX,YY,2)
+C
+ CALL PLOTOF
+ RETURN
+ END
+
+
+
+ SUBROUTINE SCALE (ARRAY,AXLEN,NPTS,INC)
+C...Determines scale factor and offset for elements in array and
+C installs values in last 2 array elements
+C
+C Input: ARRAY is an array of data points (REAL)
+C
+C AXLEN Axis length in inches (REAL)
+C NPTS Number of data points to be scaled (INTEGER)
+C INC Increment between points in ARRAY (INTEGER)
+C
+ DIMENSION ARRAY(1)
+C
+ DIMENSION UNITS(7)
+ DATA UNITS(1)/1./,UNITS(2)/2./,UNITS(3)/4./,UNITS(4)/5./
+ DATA UNITS(5)/8./,UNITS(6)/10./,UNITS(7)/20./
+C
+C
+C...Min and max values of 'ARRAY' accessed by 'INC' stride
+ K = IABS(INC)
+ J = NPTS*K
+ ARMIN = ARRAY(1)
+ ARMAX = ARMIN
+ DO I=1,J,K
+ AR = ARRAY(I)
+ ARMIN = MIN(ARMIN,AR)
+ ARMAX = MAX(ARMAX,AR)
+ END DO
+C
+C...Delta value for unit interval
+ DV = (ARMAX - ARMIN)/AXLEN
+C
+C...If negative or zero scale use the sum of min and max
+ IF (DV.LE.0.) THEN
+ DV = ABS((ARMIN + ARMIN)/AXLEN) + 1.
+ ENDIF
+C
+C...Exponent for DV
+ A = 10.0**(IFIX (LOG10 (DV) + 1000.) - 1000)
+C
+C...Normalized 'DV' value (1<DV<10)
+ DV = DV/A - 0.01
+C...Find appropriate unit and range for DV value from desirable unit list
+ DO I=1,6
+ IF (UNITS(I).GE.DV) GO TO 40
+ END DO
+C
+C...Set direction for rounding
+ 40 SGNF = 0.01
+ IF (ARMIN.LT.0.) SGNF = -0.99
+C
+C...Delta value and min value from normalized unit and exponent
+ 50 DV = UNITS(I)*A
+ TMIN = DV*AINT (ARMIN/DV + SGNF)
+C
+C...Check to make sure the selected scale is big enough
+ IF((TMIN + (AXLEN + 0.01)*DV).GE.ARMAX) GO TO 60
+ TMIN = AINT (ARMIN/A + SGNF) *A
+ IF((TMIN + (AXLEN + 0.01)*DV).GE.ARMAX) GO TO 60
+ I = I + 1
+ GO TO 50
+C
+C
+C...Recompute min value
+ 60 TMIN = TMIN - DV*AINT ((AXLEN + (TMIN - ARMAX)/DV)/2.0)
+ IF (ARMIN*TMIN.LE.0.0) TMIN = 0.0
+C
+C...Reverse direction if necessary
+ IF (INC.LE.0) THEN
+ TMIN = TMIN + DV*AINT (AXLEN + 0.5)
+ DV = -DV
+ ENDIF
+C
+C...Install scale and offset into array
+ J = J + 1
+ ARRAY(J) = TMIN
+ K = J + K
+ ARRAY(K) = DV
+C
+ RETURN
+ END
+
+
+
+
+ SUBROUTINE SYMBL (X,Y,HGT,ISYM,ANGLE,NC)
+C...Plot a symbol at the specified location with specified size and angle
+C
+C This routine accepts an integer symbol selector
+C instead of a character string as its argument
+C
+C X,Y starting coordinate for the symbol
+C HGT symbol height specification (in inches)
+C ISYM integer index corresponding to the symbol
+C ANGLE angle at which the symbol is plotted
+C NC NC must be NC<0
+C NC=-1 move to x,y with 'pen' up; plot symbol #ISYM
+C NC<-1 move to x,y with 'pen' down; plot symbol #ISYM
+CC...Note:
+C You might not need the SYMBL routine, if your compiler supports passing
+C character literals as integers without complaining and you enable old
+C style Versatec SYMBOL calls with integer arguments. See SYMBOL below...
+C
+ IF (NC.EQ.0) RETURN
+ IF (NC.GT.0) THEN
+ WRITE(*,*) 'Bad NC argument to SYMBL ',NC
+ RETURN
+ ENDIF
+ CALL SYMBOL (X,Y,HGT,char(ISYM),ANGLE,NC)
+ RETURN
+ END
+
+
+ SUBROUTINE SYMBOL(XZ,YZ,HGT,ITEXT,ANGLE,NZ)
+C...Plots characters using stroke representation of char. set
+C
+C XZ,YZ starting coordinate for the text
+C HGT character height (in inches)
+C ITEXT alphanumeric text to be generated
+C ANGLE angle at which the character line is plotted
+C NC number of characters to be plotted
+C NC>0 alpha text, number of characters to be plotted
+C NC=0 plot single character,right-justified in text
+C NC=-1 move to x,y with 'pen' up; plot symbol #TEXT
+C NC<-1 move to x,y with 'pen' down; plot symbol #TEXT
+C
+C...Note:
+C If your compiler supports passing character data as integers without
+C complaining and you want old style Versatec SYMBOL compatibility (so
+C you can call SYMBOL with either characters stuffed into an integer
+C array or with integer arguments to specify plot symbols) you can use
+C the sections of the following code marked with C+++OldVersatec comments.
+C In that case you don't need the SYMBL routine, just call SYMBOL with
+C integer arguments. However, with integer arguments, you lose some of
+C the nice things about character string manipulation.
+C
+C---Declaration of ITEXT as a character variable
+ CHARACTER*(*) ITEXT
+C
+C---Declaration of ITEXT as integer or byte variable
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C LOGICAL*1 ITEXT(1)
+C INTEGER*1 ITEXT(1)
+C BYTE ITEXT(1)
+C+++OldVersatec
+C
+ DIMENSION XA(14),YA(14)
+ DIMENSION ASIN(5),ACOS(5)
+ INTEGER*4 IRAM, AND
+ INTEGER*4 NCHR,KVAL,NODES,
+ & MSKALL,MSK4,MSK5,MSK7,MSK8,MSK11,
+ & KHAR(128),NODE(468),
+ & NOD1(160), NOD2(160), NOD3(160)
+C
+C...Assemble the NODE array (this silliness necessary because of f77
+C limitation on number of continuation lines)
+ EQUIVALENCE (NODE(1) ,NOD1(1))
+ EQUIVALENCE (NODE(161),NOD2(1))
+ EQUIVALENCE (NODE(321),NOD3(1))
+C...Constants
+ DATA NBITS /16/, NBYTES /2/
+ DATA NCHRS/128/
+ DATA RADCO/0.01745329/
+ DATA EPSIL/0.0000277 /
+ DATA ASIN /0.,1.,0.,-1.,0./,
+ & ACOS /1.,0.,-1.,0.,1./
+ DATA MSKALL/-1/, MSK4 /15/, MSK5 /31/,
+ & MSK7 /127/, MSK8 /255/, MSK11 /2047/
+C...Static variables (changed within SYMBOL)
+ DATA FCTR/0.7/, FACC/0.0/
+ DATA THETA/0.0/
+ DATA ANCC, ANCS /1.0, 0.0/
+ DATA XC, YC /0.0, 0.0/,
+ & XT, YT /0.0, 0.0/,
+ & XO, YO /0.0, 0.0/
+ DATA XA / 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0./,
+ & YA / 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0./
+C
+C...Characters encoding stroke commands for drawing
+ DATA KHAR/ 7, 267, 645, 839, 1095, 1350, 1574, 1797,
+ 1 1991, 2247, 2513, 3086, 3557, 3747, 3877, 4065,
+ 2 4129, 4192, 4232, 4519, 4772, 4928, 4967, 5223,
+ 3 5480, 5760, 5793, 5863, 6117, 6306, 6405, 6604,
+ 4 7008, 7046, 7272, 7562, 7915, 8301, 8745, 9059,
+ 5 9187, 9315, 9447, 9700, 9861, 10049, 10116, 10273,
+ 6 10344, 10629, 10823, 11084, 11498, 11848, 12138, 12484,
+ 7 12655, 13163, 13546, 13899, 14274, 14372, 14530, 14636,
+ 8 15055, 15561, 15883, 16263, 16518, 16743, 16998, 17225,
+ 9 17543, 17799, 18052, 18215, 18466, 18564, 18723, 18859,
+ A 19238, 19467, 19849, 20171, 20548, 20709, 20898, 20996,
+ 1 21156, 21317, 21510, 21731, 21857, 21923, 22050, 22145,
+ 2 22224, 22754, 22856, 23143, 23403, 23787, 24169, 24486,
+ 3 24712, 24998, 25229, 25675, 26056, 26343, 26592, 26624,
+ 4 26660, 26829, 27269, 27461, 27651, 27786, 28129, 28193,
+ 5 28263, 28516, 28679, 28938, 29284, 29444, 29604, 29764/
+C
+C...Node data for stroked characters (in 3 separate arrays due to problem
+C with some f77 compilers for continuation lines...). You could assemble
+C these all into one array and dispense with the equivalence statements if
+C your compiler supported lots of continuation lines.
+ DATA NOD1/ 8740, 1024, 16452, 9250, 8740, 5123, 272, 12353,
+ 1 17204, 9250, 8740, 321, 9250, 8770, -4060, 8432,
+ 2 546, 8772, -4092, 16624, 34, 8740, 544, 16932,
+ 3 8738, 8228, 578, 9250, 8704, 17412, 16418, 8772,
+ 4 1092, 64, 34, 8772, -4092, 8944, 8226, 8772,
+ 5 -4045, 12608, -4096, 4371, 1264, 4401, -4077, 13090,
+ 6 8770, -4060, 8432, 546, 17648, 1088, -4096, 8738,
+ 7 17412, 16384, 8738, 9248, 8754, 22642, 9862, 12834,
+ 8 25122, 9972, 8497, 16965, 22087, 19003, 11047, 26608,
+ 9 25893, -4061, 25365, 30038, 21621, -3292, 25840, 26150,
+ A -4045, 22307, 25584, 17480, -4058, 26209, 20802, 17718,
+ 1 18250, 23403, -2790,-30190, 8497, 16969, 23146, 31012,
+ 2 21605, 26199, 10022, 16998, 5157, 13651, 25460, 5157,
+ 3 13651, 25460, -3978, 25941, 14119, 5872, 18756, -4046,
+ 4 17234, 12887, 18777, 22512, 14121, 14647, 9316, 21587,
+ 5 22358, 26150, 13879, 13129, 17136, 9043, 25701, 22070,
+ 6 10040, 26680, 10281, 14648, -3991, 8944, 21347, 25170,
+ 7 21346, 14136, 18776, 9508, 13123, 25687, 18777, 22377,
+ 8 22611, 25129, 14387, 8741, 26096, 9063, -4057, 25412,
+ 9 18672, 9830, 16946, 13123, 16945, 9573, 16946, 13123/
+C
+ DATA NOD2/ 16930, 26984, 22841, 10275, 12882, 25448, 14409, 17136,
+ 1 12882, 10297, 22888, 26148, 8802, 10297, 22888, 26454,
+ 2 13910, 25955, 21042, 8996, 25840, 22866, -4055, 9456,
+ 3 16994, 9010, 21091, 25942, 9769, 26934, 22117, 25426,
+ 4 12835, 10297, 22888, 10601, 26691, 16982, 26472, 22841,
+ 5 10279, 13910, 25955, 21042, 8997, 13859, 12882, 25448,
+ 6 22841, 10278, 13653, 26165, 13894, 17717, -4030, 12851,
+ 7 17218, 13622, 17989, 13808, 16946, 13123, 16945, 26662,
+ 8 25636, 25840, 26150, 9318, 10290, 17234, 13040, 17478,
+ 9 22119, 26713, 14632, 26199, 18230, 13636, 21605, 26456,
+ C 14375, 9267, 21348, 8741, 26096, 9512, 14681, 26722,
+ 1 25445, 22054, 22119, 26713, 10530, 21091, 26713, 14632,
+ 2 9010, 21091, 26713, 10530, 21091, 26729, 10534, 22256,
+ 3 9762, 25193, 10534, 22256, 9762, 26713, 14632, 9010,
+ 4 21091, 25941, 8745, -4058, 26352, 26978, 12882, -4030,
+ 5 18928, 14681, 9010, 21091, 26921, 8944, 9577, -4025,
+ 6 25129, 8802, 8745, 17769, 25193, 25129, 8775, 27120,
+ 7 26713, 14632, 9010, 21091, 26658, 10585, 26727, 22054,
+ 8 26713, 14632, 9010, 21091, 26864, 17506, 8745, 22888,
+ 9 26454, 9814, 25954, 26713, 14632, 10038, 22117, 25426/
+C
+ DATA NOD3/ 12835, 10601, -4023, 16937, 9010, 21091, 26921, 17001,
+ 1 10530, 18018, 26921, 25328, 8809, 10567, 17136, 18281,
+ 2 10601, 8802, -4042, 22121, 10530, 25129, 25122, 25193,
+ 3 10530, 18018, 4481, 26455, 17975, 10006, 5412, 13381,
+ 4 17989, 21604, 30070, 26405, 30068, 8759, 13379, 21348,
+ 5 26468, 29491, 14320, 10087, -4009, 21314, 18672, 14118,
+ 6 9267, 21348, 26199, 14135, 9764, 13139, 25702, 22327,
+ 7 -4075, 29990, 13876, 17236, 22118, -4030, 18467, 26352,
+ 8 9782, 21347, 10020, 13124, 18244, 21348, 26408, 14149,
+ 9 25584, 8773, 26455, 17975, 10006, 5412, 13381, 17989,
+ E 21604, 22600, 14150, 22117, 25683, 17204, 13638, 26439,
+ 1 13876, 17251, -3995, 9766, 14150, 13382, 22374, 21233,
+ 2 -3471, 8534, 10874, 5477, -4045, 13380, 17203, -4042,
+ 3 14151, 17974, 26662, 25840, 25379, 25379, -4060, 26152,
+ 4 4679, 29202, 26199, 14118, 9267, 21348, -4030, 18453,
+ 5 29985, 10792, 14664, 17136, 18521, 26659, 13378, 19066,
+ 6 16969, -4044, 21744, 14424, 16969, -4044, 21744, 14424,
+ 7 -4042, 22037, 13876, 5493, 9063, -4057, 25410, 18743,
+ 8 22345, 16948, 21570, 18688, 0, 0, 0, 0,
+ 9 0, 0, 0, 0, 0, 0, 0, 0/
+C
+ X = XZ
+ Y = YZ
+ NC = NZ
+C
+C...Save and set line pattern, Symbols/text only drawn with solid lines
+C...Process a draw to character position before switching line pattern
+ CALL GETPAT(IMASK)
+ IF (NC.LT.-1) CALL PLOT(X,Y,2)
+ IF(IMASK.NE.-1) THEN
+ MSK = MSKALL
+ CALL NEWPAT(MSK)
+ ENDIF
+C
+C
+C...Get set to loop through the text array character by character
+ K = 0
+ IC = 3
+ DIV = 7.0
+C
+C
+C...Extract next character from text array, masking off high bit
+ 180 K = K + 1
+C
+C---For declaration of ITEXT as a character variable
+ NCHR = ICHAR(ITEXT(K:K))
+C---Declaration of ITEXT as integer or byte variable
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C NCHR = ITEXT(K)
+C+++OldVersatec
+C
+C
+ NCHR = IRAM(NCHR,0,MSK7)
+C
+C...NC<0 Centered symbol
+C NC=0 Right-justified symbol
+C NC>0 Regular left-justified text
+C
+ IF(NC.LT.0) THEN
+ IF (NCHR.LE.13) DIV = 4.0
+ ENDIF
+ NCC = NCHR
+C
+C...On first character, set character height, angle and position
+C
+ IF(K.EQ.1) THEN
+C...Use current height and angle?
+ IF (HGT.GT.0.0) THEN
+ ISTAT = 1
+ FCT = HGT/DIV
+C...Calculate a new theta if necessary
+C use stored quadrant angles if at n(90 deg).
+ IF (ANGLE.NE.THETA) THEN
+ FACC = FCT
+ THETA = ANGLE
+ ANG = MOD(ANGLE,360.0)
+ IF (ANG.LT.0) ANG = 360.0 - ANG
+ I = (ANG + EPSIL)/90.0
+ A = I*90.0
+ IF (ABS(ANG-A).GT.EPSIL) THEN
+ ANCC = THETA*RADCO
+ ANCS = SIN(ANCC)
+ ANCC = COS(ANCC)
+ ELSE
+ ANCS = ASIN(I+1)
+ ANCC = ACOS(I+1)
+ ENDIF
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+ ENDIF
+C...Calculate offsets for new FACC and/or ANGLE
+ IF (FCT.NE.FACC) THEN
+ FACC = FCT
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+ ENDIF
+ ENDIF
+C...Set character position
+C...If X,Y coordinate = 999.0; use previous value(s) of X and/or Y
+ IF (X.NE.999.0) THEN
+ XO = X-XA(3)+YA(3)
+ XC = XO
+ ENDIF
+ IF (Y.NE.999.0) THEN
+ YO = Y-XA(3)-YA(3)
+ YC = YO
+ ENDIF
+ X = XC
+ Y = YC
+ ENDIF
+C
+C
+C...Extract node count (5 bits) and index (11 bits) into node array
+ KDEX = MOD(NCC,NCHRS) + 1
+ KVAL = KHAR(KDEX)
+ NDKNT = AND(KVAL,MSK5)
+ INDX = IRAM(KVAL,5,MSK11)
+C
+C...Compute word index into node array for first node
+ NWD = INDX/NBYTES + 1
+C
+C...Compute byte index(NBT = shift count)into node word for node start
+ NBT = -8*MOD(INDX,NBYTES) - 8
+C
+C...Node processing loop
+ 210 IF(NBT+NBITS.LT.0) THEN
+ NWD = NWD + 1
+ NBT = -8
+ ENDIF
+C
+C...Extract the next node.
+ NODES = IRAM(NODE(NWD),NBT,MSK8)
+ NBT = NBT - 8
+ NODEY = AND(NODES,MSK4)
+ NODEX = IRAM(NODES,4,MSK4)
+C
+C...Check for special control functions (NODEX = 15)
+ IF (NODEX.GE.15) THEN
+C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+C...Decode special function (y-offset)
+C...Blank,superscript,subscript,carriage return,back space,null char?
+C
+C...Blank character
+ IF(NODEY.EQ.0) THEN
+ IC = 3
+ GO TO 245
+C...Superscript set/reset code: (first test existing state)
+ ELSEIF(NODEY.EQ.1) THEN
+ IF(ISTAT.EQ.0) THEN
+C - For ISTAT=0 return to normal STATE=1
+ ISTAT = 1
+ FACC = FACC/FCTR
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+ X = X-YA(2)
+ Y = Y+XA(2)
+ ELSEIF(ISTAT.EQ.1) THEN
+C - For ISTAT=1 Set superscript mode,ISTAT=2
+ ISTAT = 2
+ X = X-YA(5)
+ Y = Y+XA(5)
+ FACC = FACC*FCTR
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+ ENDIF
+C - For ISTAT=2 do nothing and branch to next character
+C
+C
+C...Subscript set/reset code: (first test existing state)
+ ELSEIF(NODEY.EQ.2) THEN
+C - For ISTAT=0 branch to next character
+C - For ISTAT=1) set subscript mode, ISTAT=0
+ IF(ISTAT.EQ.1) THEN
+ ISTAT = 0
+ X = X+YA(2)
+ Y = Y-XA(2)
+ FACC = FACC*FCTR
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+C - For ISTAT=2 return to normal mode, ISTAT=1
+ ELSEIF(ISTAT.EQ.2) THEN
+ ISTAT = 1
+ FACC = FACC/FCTR
+ CALL SOFFSET(FACC,ANCC,ANCS,XA,YA)
+ X = X+YA(5)
+ Y = Y-XA(5)
+ ENDIF
+C...Carriage return
+ ELSEIF(NODEY.EQ.3) THEN
+ X = XO + YA(13)
+ Y = YO - XA(13)
+ XO = X
+ YO = Y
+C...Backspace
+ ELSEIF(NODEY.EQ.4) THEN
+ X = X - XA(8)
+ Y = Y - YA(8)
+C...Null character
+ ELSEIF(NODEY.EQ.5) THEN
+ ENDIF
+C
+C...Go on to next character
+ GO TO 260
+ ENDIF
+C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+C...Process move to node
+ NODEX = NODEX + 1
+ NODEY = NODEY + 1
+ YT = Y + YA(NODEX) + XA(NODEY)
+ XT = X + XA(NODEX) - YA(NODEY)
+C
+C
+C...Plot the character stroke
+ CALL PLOT(XT,YT,IC)
+ IC = 2
+ X = XC
+ Y = YC
+C
+C...Decrement and test node count
+ 245 NDKNT = NDKNT - 1
+C
+C...Any nodes yet to be processed?
+ IF (NDKNT.GE.0) GO TO 210
+ X = X + XA(8)
+ Y = Y + YA(8)
+C
+C...Decrement and test symbol count
+ 260 XC = X
+ YC = Y
+ IC = 3
+ NC = NC - 1
+C
+C...Any symbols yet to be plotted?
+ IF (NC.GT.0) GO TO 180
+C
+C...End of SYMBOL processing, if necessary restore line pattern
+ IF(IMASK.NE.-1) THEN
+ CALL NEWPAT(IMASK)
+ ENDIF
+ RETURN
+ END
+
+ SUBROUTINE SOFFSET(FACC,ANCC,ANCS,XA,YA)
+C...Calculates character offsets using current factor and direction
+C sine and cosine
+ DIMENSION XA(14), YA(14)
+C
+ Z = FACC*ANCC
+ W = FACC*ANCS
+ XI = Z
+ YI = W
+ DO L=2,14
+ XA(L) = Z
+ YA(L) = W
+ Z = Z+XI
+ W = W+YI
+ END DO
+ RETURN
+ END
+
+
+ SUBROUTINE NUMBER (X,Y,HEIGHT,FPN,ANGLE,NDIG)
+C...Plot number as a string of characters
+C
+C (X,Y) = starting coordinates for 1st char (real)
+C HEIGHT = character height (real)
+C FPN = number to be converted to digits and plotted (real)
+C ANGLE = angle at which numeric string is to be plotted
+C in degrees measured from the x-axis (real)
+C NDIG = specification of the number of digits and the type
+C of numeric string to be plotted (integer)
+C > 0 = number of digits to the right of the decimal
+C point to be plotted (last digit is rounded)
+C = 0 = rounded integer portion of fpn is plotted
+C with a decimal point
+C = -1 = rounded integer portion of fpn is plotted
+C without the decimal point
+C < -1 = rounded integer portion of fpn is plotted
+C after having the least significant digits
+C truncated (IABS(NDEC)-1 digits are truncated)
+C
+C CALLS: SYMBOL
+C
+C...Note:
+C If your compiler supports passing character data as integers without
+C complaining and you want old style Versatec SYMBOL compatibility (so
+C you can call SYMBOL with either characters stuffed into an integer
+C array or with integer arguments to specify plot symbols) you can use
+C the sections of the following code marked with C+++OldVersatec comments.
+C
+C---Declaration using character variables
+ CHARACTER*1 MINUS, IPOINT, CHDIG
+C---Declaration of ITEXT as integer or byte variable
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C LOGICAL*1 MINUS, IPOINT, CHDIG
+C INTEGER*1 MINUS, IPOINT, CHDIG
+C BYTE MINUS, IPOINT, CHDIG
+C+++OldVersatec
+C
+ DATA MINUS/'-'/,IPOINT/'.'/
+C
+ IZERO = ichar('0')
+C
+ T1 = FPN
+ XZ = X
+ YZ = Y
+C...Number negative?
+ IF (T1.LT.0) THEN
+ CALL SYMBOL (XZ,YZ,HEIGHT,MINUS,ANGLE,1)
+ XZ = 999.
+ YZ = 999.
+ T1 = -T1
+ ENDIF
+C
+C...Set working digit count
+ ND = -NDIG
+C
+C...Integer only to be plotted?
+ IF (NDIG.LE.0) THEN
+C...Round and truncate for integer
+ IF(NDIG.EQ.0) ND = 1
+ ND = ND - 1
+ T2 = FLOAT (IFIX((T1 + 0.5)/(10.**ND))) + 0.5
+ ND = 0
+ IF (NDIG.EQ.0) ND = -1
+ ELSE
+C...Round for fraction
+ T2 = T1 + 0.5/(10.**NDIG)
+ ENDIF
+C
+C...Find number of digits to the left of decimal point
+ NL = 1
+C...Any more digits to the left of the d.p.
+ 60 IF (T2.GE.10.) THEN
+ T2 = T2/10.
+ NL = NL + 1
+ GO TO 60
+ ENDIF
+C
+C...Set plottable digit count
+ NP = NL - ND
+C...Bad digit count?
+ IF (NP.LE.0) NP = 1
+C
+C...Plot decimal point (NL=0)
+ 80 IF(NL.EQ.0) THEN
+C...No decimal point?
+ IF (NDIG.LT.0) GO TO 120
+ CALL SYMBOL (XZ,YZ,HEIGHT,IPOINT,ANGLE,1)
+ IF (NDIG.NE.0) NP = NP + 1
+ ELSE
+C...Plot digit
+ IDIG = IFIX(T2)
+ T2 = (T2 - FLOAT (IDIG))*10.
+C---For declaration of CHDIG as character variable
+ CHDIG = char(IDIG + IZERO)
+C+++OldVersatec (use either LOGICAL*1, INTEGER*1 or BYTE declaration)
+C CHDIG = IDIG + IZERO
+C+++OldVersatec
+ CALL SYMBOL (XZ,YZ,HEIGHT,CHDIG,ANGLE,-1)
+ ENDIF
+ XZ = 999.
+ YZ = 999.
+C
+C...Count digit
+ NP = NP - 1
+ 120 NL = NL - 1
+C
+C...More digits to plot?
+ IF(NP.GT.0) GO TO 80
+ RETURN
+ END
+
+
+ INTEGER*4 FUNCTION IRAM(IWORD,K,MASK)
+C...Rotate And Mask 16 bits of a word and mask
+C Note that all inputs and outputs are I*4 (32bit)
+C New 32 bit version of IRAM HHY 4/1/96
+ INTEGER*4 MASK,IWORD,I4,I3,IT1,IT2
+ INTEGER RSHIFT, LSHIFT, AND
+ I4=LSHIFT(IWORD,16)
+ I3=LSHIFT(MASK,16)
+C
+ IF(K .NE. 0) THEN
+C
+ if (K .LT. 0) then
+ IT1=LSHIFT(I4,-K)
+ else
+ IT1=RSHIFT(I4,K)
+ endif
+C
+ IF(K .GT. 0) then
+ IT2=LSHIFT(I4,16-K)
+ else
+ IT2=RSHIFT(I4,abs(-K-16))
+ endif
+C
+ I4=IT1+IT2
+ ENDIF
+C
+ I4=AND(I4,I3)
+ IRAM=RSHIFT(I4,16)
+C
+ RETURN
+ END
+
+
+
+
+
diff --git a/plotlib/plt_util.f b/plotlib/plt_util.f
new file mode 100644
index 0000000..692f491
--- /dev/null
+++ b/plotlib/plt_util.f
@@ -0,0 +1,930 @@
+C***********************************************************************
+C Module: plt_util.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+***********************************************************************
+C --- Xplot11 utility routines
+C
+C Version 4.46 11/28/01
+C
+C Note: These are additional routines that supply additional plot
+C functionality. Included are routines for axis scaling,
+C axis plotting, line or curve plotting, contours, etc.
+C***********************************************************************
+
+
+ subroutine XAXIS(X1,Y1,XAXT,DXANN,FANN,DANN,CHT,NDIG)
+C.......................................................
+C
+C X1,Y1 starting point of x axis
+C XAXT length of x axis ( - = suppress zero annotation)
+C DXANN distance between annotations
+C FANN first annotation value
+C DANN delta annotation value
+C CHT character width ( - = annotation above axis)
+C NDIG number of digits to right of decimal point
+C = -1 no decimal point
+C = -2 number of digits determined internally
+C <= -3 no axis annotation (just hash marks)
+C.......................................................
+C
+ XAX = ABS(XAXT)
+ CH = ABS(CHT)
+C
+ IF(NDIG.LE.-2) THEN
+ ADANN = ABS(DANN)
+ ND = MAX( 1 , INT(-LOG10(ADANN)) )
+ IF(ADANN*10**ND - AINT(ADANN*10**ND+0.01) .GT. 0.01) ND = ND + 1
+ IF(ADANN*10**ND - AINT(ADANN*10**ND+0.01) .GT. 0.01) ND = ND + 1
+ ELSE
+ ND = NDIG
+ ENDIF
+C
+ CALL GETFACTORS(XFAC,YFAC)
+ CHX = CH
+ CHY = CH*XFAC/YFAC
+C
+C---- x-axis
+ CALL PLOT(X1,Y1,3)
+ CALL PLOT(X1+XAX,Y1,2)
+C
+C---- annotate x-axis
+ DO 10 NT=1, 12345
+ XT = X1 + DXANN*FLOAT(NT-1)
+ IF(XT-X1.GT.XAX+0.5*DXANN) GO TO 11
+C---- hash marks
+ CALL PLOT(XT,Y1-0.2*CHY,3)
+ CALL PLOT(XT,Y1+0.2*CHY,2)
+C---- Numeric annotations
+ IF(NDIG.LE.-3) GO TO 10
+ RN = FANN + DANN*FLOAT(NT-1)
+ IF(ABS(RN).LT.1.0E-5 .AND. XAXT.LT.0.0) GO TO 10
+ GRN = 0.
+ IF(RN.NE.0.0) GRN = LOG10(ABS(RN)+0.5/10.0**MAX(0,ND))
+ GRN = MAX(GRN,0.0)
+ NABC = INT(GRN) + 2 + ND
+ WIDTH = CHX*FLOAT(NABC)
+ IF(RN.LT.0.0) WIDTH = WIDTH + CHX
+ XNUM = XT - 0.5*WIDTH + 0.1*CHX
+ YNUM = Y1 - 2.1*CHY
+ IF(CHT.LT.0.0) YNUM = Y1 + 0.9*CHY
+ CALL PLNUMB(XNUM,YNUM,CH,RN,0.0,ND)
+ 10 CONTINUE
+ 11 CONTINUE
+C
+ RETURN
+ END
+
+
+ subroutine YAXIS(X1,Y1,YAXT,DYANN,FANN,DANN,CHT,NDIG)
+C.......................................................
+C
+C X1,Y1 starting point of y axis
+C YAXT length of y axis ( - = suppress zero annotation)
+C DYANN distance between annotations
+C FANN first annotation value
+C DANN delta annotation value
+C CHT character width ( - = annotation on right side )
+C NDIG number of digits to right of decimal point
+C = -1 no decimal point
+C = -2 number of digits determined internally
+C <= -3 no axis annotation (just hash marks)
+C.......................................................
+C
+ YAX = ABS(YAXT)
+ CH = ABS(CHT)
+C
+ IF(NDIG.LE.-2) THEN
+ ADANN = ABS(DANN)
+ ND = MAX( 1 , INT(-LOG10(ADANN)) )
+ IF(ADANN*10**ND - AINT(ADANN*10**ND+0.01) .GT. 0.01) ND = ND + 1
+ IF(ADANN*10**ND - AINT(ADANN*10**ND+0.01) .GT. 0.01) ND = ND + 1
+ ELSE
+ ND = NDIG
+ ENDIF
+C
+ CALL GETFACTORS(XFAC,YFAC)
+ CHX = CH
+ CHY = CH*XFAC/YFAC
+C
+C---- y-axis
+ CALL PLOT(X1,Y1,3)
+ CALL PLOT(X1,Y1+YAX,2)
+C
+C---- annotate y-axis
+ DO 10 NT=1, 12345
+ YT = Y1 + DYANN*FLOAT(NT-1)
+ IF(YT-Y1.GT.YAX+0.5*DYANN) GO TO 11
+C---- hash marks
+ CALL PLOT(X1-0.2*CHX,YT,3)
+ CALL PLOT(X1+0.2*CHX,YT,2)
+C---- Numeric annotations
+ IF(NDIG.LE.-3) GO TO 10
+ RN = FANN + DANN*FLOAT(NT-1)
+ IF(ABS(RN).LT.1.0E-5 .AND. YAXT.LT.0.0) GO TO 10
+ GRN = 0.
+ IF(RN.NE.0.0) GRN = LOG10(ABS(RN)+0.5/10.0**MAX(0,ND))
+ GRN = MAX(GRN,0.0)
+ NABC = INT(GRN) + 2 + ND
+ WIDTH = CHX*FLOAT(NABC)
+ IF(RN.LT.0.0) WIDTH = WIDTH + CHX
+ XT = X1 - (0.6*CHX + WIDTH)
+ IF(CHT.LT.0.0) XT = X1 + CHX
+ CALL PLNUMB(XT,YT-0.5*CHY,CH,RN,0.0,ND)
+ 10 CONTINUE
+ 11 CONTINUE
+C
+ RETURN
+ END
+
+
+
+ subroutine XYLINE(N,X,Y,XOFF,XWT,YOFF,YWT,ILIN)
+C....................................................................
+C
+C...General XY polyline plotting routine with offsets and scaling
+C
+C...INPUT X, Y Input arrays of length N
+C XOFF,XWT Offset and scale factor for X array...
+C YOFF,YWT Offset and scale factor for Y array...
+C Xplot = XWT*(X-XOFF)
+C Yplot = YWT*(Y-YOFF)
+C ILIN Selects line pattern
+C
+C...8 line patterns are available (repeat for ILIN>8)
+C 1 ***************************** SOLID
+C 2 **** **** **** **** **** **** LONG DASHED
+C 3 ** ** ** ** ** ** ** ** ** ** SHORT DASHED
+C 4 * * * * * * * * * * * * * * * DOTTED
+C 5 ***** * ***** * ***** * ***** DASH-DOT
+C 6 ***** * * ***** * * ***** * * DASH-DOT-DOT
+C 7 ***** * * * ***** * * * ***** DASH-DOT-DOT-DOT
+C 8 **** **** * * **** **** * * DASH-DASH-DOT-DOT
+C
+C....................................................................
+ DIMENSION X(N), Y(N)
+C
+ DIMENSION NMOV(7), SMOV(8,7)
+C
+ DATA NPAT / 8 /
+ DATA SCL1 / 0.125 /
+ DATA NMOV / 2, 2, 2, 4, 6, 8, 8 /
+ DATA SMOV /1.2, -.4, 0., 0., 0., 0., 0., 0.,
+ & .5, -.4, 0., 0., 0., 0., 0., 0.,
+ & .2, -.4, 0., 0., 0., 0., 0., 0.,
+ & 1.4, -.4, .2, -.4, 0., 0., 0., 0.,
+ & 1.4, -.4, .2, -.4, .2, -.4, 0., 0.,
+ & 1.4, -.4, .2, -.4, .2, -.4, .2, -.4,
+ & 1.2, -.4, 1.2, -.4, .2, -.4, .2, -.4 /
+C
+ IF(N.LE.1) RETURN
+C
+C---- set line pattern scale based on current user scaling factors
+ CALL GETFACTORS(XSCALE,YSCALE)
+ SCL = SCL1 / SQRT(XSCALE*YSCALE)
+C
+ NLIN = MAX(ILIN,1)
+ IPAT = MOD(NLIN-1,NPAT) + 1
+C
+ X2 = XWT*(X(1)-XOFF)
+ Y2 = YWT*(Y(1)-YOFF)
+ CALL PLOT(X2,Y2,3)
+C
+ IF (IPAT.EQ.1) THEN
+C...Plot using continuous line
+ DO 10 I=2, N
+ X1 = X2
+ Y1 = Y2
+ X2 = XWT*(X(I)-XOFF)
+ Y2 = YWT*(Y(I)-YOFF)
+ CALL PLOT(X2,Y2,2)
+ 10 CONTINUE
+C
+ ELSE
+C...Plot using stored patterns for lines
+ I = 1
+ S1 = 0.
+ S2 = 0.
+ S0 = 0.
+C
+ 20 DO 40 II=1, 99999
+C
+C...Pattern specifies pen up or down
+ IM = MOD(II+1,NMOV(IPAT-1)) + 1
+ IPEN = 3
+ IF(SMOV(IM,IPAT-1).GT.0.) IPEN = 2
+C
+ DS = SCL*ABS(SMOV(IM,IPAT-1))
+ SPAT = S0 + DS
+C
+C...Find data interval containing pattern point
+ 30 IF (SPAT.GE.S2 .AND. I+1.LE.N) THEN
+ I = I + 1
+ CALL PLOT(X2,Y2,IPEN)
+ X1 = X2
+ Y1 = Y2
+ S1 = S2
+ X2 = XWT*(X(I)-XOFF)
+ Y2 = YWT*(Y(I)-YOFF)
+ DS = SQRT((X2-X1)**2 + (Y2-Y1)**2)
+ S2 = S1 + DS
+ GO TO 30
+ ENDIF
+C
+C...Find point on interval using linear interpolation
+ IF (SPAT.GT.S2) SPAT = S2
+ IF(S2 .EQ. S1) THEN
+ FRAC = 0.0
+ ELSE
+ FRAC = (SPAT-S1)/(S2-S1)
+ ENDIF
+ XX = X1 + FRAC*(X2-X1)
+ YY = Y1 + FRAC*(Y2-Y1)
+C
+C...Move to new point using stored pattern to specify pen up or down
+ CALL PLOT(XX,YY,IPEN)
+ IF (I.GE.N .AND. SPAT.GE.S2) GO TO 50
+ S0 = SPAT
+ 40 CONTINUE
+C
+ 50 CONTINUE
+ ENDIF
+C
+ RETURN
+ END
+
+
+
+ subroutine XYSYMB(N,X,Y,XOFF,XWT,YOFF,YWT,SH,ISYM)
+C.............................................................
+C
+C...GENERAL XY MULTIPLE-SYMBOL PLOTTING ROUTINE
+C (useful for overplotting XYLINE plot with point symbols)
+C
+C...INPUT X, Y Input arrays of length N
+C XOFF,XWT Offset and scale factor for X array
+C YOFF,YWT Offset and scale factor for Y array
+C SH Symbol size
+C ISYM Selects symbol type
+C if ISYM < 0 ... no plotting
+C.............................................................
+C
+ DIMENSION X(N), Y(N)
+C
+ IF(ISYM.LT.0) RETURN
+C
+ DO 10 I=1, N
+ XPLT = XWT*(X(I)-XOFF)
+ YPLT = YWT*(Y(I)-YOFF)
+ CALL PLSYMB(XPLT,YPLT,SH,ISYM,0.0,0)
+ 10 CONTINUE
+C
+ RETURN
+ END
+
+
+ subroutine CONT_GRID(IX,JX,II,JJ,X,Y,F,FCON,XOFF,YOFF,XWT,YWT)
+ DIMENSION X(IX,JX), Y(IX,JX), F(IX,JX)
+ CALL CONTGRID(IX,JX,II,JJ,X,Y,F,FCON,XOFF,YOFF,XWT,YWT)
+ RETURN
+ END
+
+ subroutine CONTGRID(IX,JX,II,JJ,X,Y,F,FCON,XOFF,YOFF,XWT,YWT)
+ DIMENSION X(IX,JX), Y(IX,JX), F(IX,JX)
+C--------------------------------------------------------------------------
+C
+C Plots one contour of a function F on a logically rectangular grid.
+C (normally called repeatedly if a number of contours is to be drawn)
+C
+C IX JX dimensions of arrays X, Y, F
+C II JJ array limits of arrays X, Y, F
+C X(i,j) independent coordinates of point (i,j)
+C Y(i,j)
+C F(i,j) function value at point (i,j)
+C FCON value of F on the contour to be drawn
+C XOFF offset for X
+C YOFF offset for Y
+C XWT scaling factor for X
+C YWT scaling factor for Y
+C
+C XPLOT = (X - XOFF)*XWT
+C YPLOT = (Y - YOFF)*YWT
+C--------------------------------------------------------------------------
+C
+ LOGICAL FOUND
+C
+C---- go over all cells and draw contour in any cell which contains the contour
+ DO 10 IO=1, II-1
+ IP = IO+1
+C
+ DO 110 JO=1, JJ-1
+ JP = JO+1
+C
+ FOUND = .FALSE.
+C
+C op 3 pp
+C
+C 4 2
+C
+C oo 1 po
+C
+ XOO = X(IO,JO)
+ XOP = X(IO,JP)
+ XPO = X(IP,JO)
+ XPP = X(IP,JP)
+C
+ YOO = Y(IO,JO)
+ YOP = Y(IO,JP)
+ YPO = Y(IP,JO)
+ YPP = Y(IP,JP)
+C
+ FOO = F(IO,JO)
+ FOP = F(IO,JP)
+ FPO = F(IP,JO)
+ FPP = F(IP,JP)
+C
+C-------- bottom edge (side 1)
+ IF(FCON.GE.FOO .AND. FCON.LT.FPO .OR.
+ & FCON.LT.FOO .AND. FCON.GE.FPO ) THEN
+ XCON = XOO + (FCON-FOO)*(XPO-XOO)/(FPO-FOO)
+ YCON = YOO + (FCON-FOO)*(YPO-YOO)/(FPO-FOO)
+ IF(FOUND) THEN
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),2)
+ ELSE
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),3)
+ ENDIF
+ FOUND = .NOT.FOUND
+ ENDIF
+C
+C-------- left edge (side 4)
+ IF(FCON.GE.FOO .AND. FCON.LT.FOP .OR.
+ & FCON.LT.FOO .AND. FCON.GE.FOP ) THEN
+ XCON = XOO + (FCON-FOO)*(XOP-XOO)/(FOP-FOO)
+ YCON = YOO + (FCON-FOO)*(YOP-YOO)/(FOP-FOO)
+ IF(FOUND) THEN
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),2)
+ ELSE
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),3)
+ ENDIF
+ FOUND = .NOT.FOUND
+ ENDIF
+C
+C-------- right edge (side 2)
+ IF(FCON.GE.FPO .AND. FCON.LT.FPP .OR.
+ & FCON.LT.FPO .AND. FCON.GE.FPP ) THEN
+ XCON = XPO + (FCON-FPO)*(XPP-XPO)/(FPP-FPO)
+ YCON = YPO + (FCON-FPO)*(YPP-YPO)/(FPP-FPO)
+ IF(FOUND) THEN
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),2)
+ ELSE
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),3)
+ ENDIF
+ FOUND = .NOT.FOUND
+ ENDIF
+C
+C-------- top edge (side 3)
+ IF(FCON.GE.FOP .AND. FCON.LT.FPP .OR.
+ & FCON.LT.FOP .AND. FCON.GE.FPP ) THEN
+ XCON = XOP + (FCON-FOP)*(XPP-XOP)/(FPP-FOP)
+ YCON = YOP + (FCON-FOP)*(YPP-YOP)/(FPP-FOP)
+ IF(FOUND) THEN
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),2)
+ ELSE
+ CALL PLOT(XWT*(XCON-XOFF),YWT*(YCON-YOFF),3)
+ ENDIF
+ FOUND = .NOT.FOUND
+ ENDIF
+C
+ 110 CONTINUE
+ 10 CONTINUE
+C
+ RETURN
+ END
+
+
+
+
+ subroutine CONTQUAD(X,Y,F,
+ & FUPR,FLWR,
+ & NCU,XCU,YCU,
+ & NCL,XCL,YCL,
+ & NA,NE,NV,XP,YP)
+C--------------------------------------------------------------------------
+C Contour a single quadrilateral element between an upper and
+C a lower contour limit. The output from this routine is both the
+C line segments defining the upper and lower contours and a set of
+C polygons that define the area of the element lying between the
+C contour limits. These may be used to shade the area on a plot.
+C
+C X, Y Arrays containing quadrilateral coordinate data
+C F Array containing the quantity F(x,y) to be contoured,
+C ie. F(i) is defined at X(i),Y(i), i=1->4
+C FUPR, FLWR Upper and lower contour limits
+C NCU Number of upper limit contour line points
+C XCU, YCU Arrays of x,y points (in pairs) on upper contour
+C NCL Number of lower limit contour line points
+C XCL, YCL Arrays of x,y points (in pairs) on lower contour
+C NA Number of polygon areas in XP, YP, NE arrays
+C NE Array of numbers of points in each polygon area
+C NV Vertex count of points in XP,YP arrays
+C XP, YP Coordinate points of contour polygons
+C
+C Note: the output contour line points on the upper contour (XCU,YCU)
+C or lower contour (XCL,YCL) are only valid in point pairs, ie.
+C points 1 and 2 define a segment, points 3 and 4 define the next,
+C etc. In general, there is no guarantee that the cross-pair points
+C (like points 2 and 3) will be contiguous. DO NOT PLOT THESE AS A
+C CONTIGUOUS ARRAY OF POINTS.
+C
+C Note: the output areas (NA polygon areas) are stored with the points
+C for all polygons in one big XP,YP array. The number of points
+C in each polygon are stored in NE, i.e. NE(1) is the number of
+C points stored in XP,YP for the first polygon, NE(2) is the number
+C of vertices stored following those for the second polygon, etc.
+C The total number of vertices is NV=sum[NE(1)+NE(2)..+NE(NA)].
+C
+C Note: the NCU,NCL,NA,NV counters are cumulative in this routine!
+C If you want to contour each quadrilateral without accumulating
+C contour points or polygons reset NCU=0,NCL=0,NA=0,NV=0 before
+C each call to CONTQUAD.
+C
+C--------------------------------------------------------------------------
+ DIMENSION X(4), Y(4), F(4)
+ DIMENSION XP(1), YP(1), NE(1)
+ DIMENSION XCL(1), YCL(1), XCU(1), YCU(1)
+C
+ DIMENSION IANG(4)
+ DIMENSION XTMP(3), YTMP(3), FTMP(3)
+C
+C---- NCU tracks the number of upper contour points
+C NCL tracks the number of lower contour points
+C NA tracks the number of polygon areas
+C NV tracks the total number of stored vertices in the XP,YP arrays
+C---- Uncomment these if you want to reset the counters each time you
+C contour a quadrilateral
+C NA = 0
+C NV = 0
+C NCU = 0
+C NCL = 0
+C
+ FHI = FUPR
+ FLO = FLWR
+ IF (FHI.LT.FLO) THEN
+ FHI = FLWR
+ FLO = FUPR
+ ENDIF
+C
+C---- Extrema
+ FMAX = AMAX1(F(1),F(2),F(3),F(4))
+ FMIN = AMIN1(F(1),F(2),F(3),F(4))
+C
+C---- If cell is above contour band or below contour band skip it
+ IF (FMAX.LE.FLO .OR. FMIN.GE.FHI) RETURN
+C
+C---- If cell is totally within contour band there are no contour lines,
+C and cell can be shaded directly
+ IF (FMAX.LE.FHI .AND. FMIN.GE.FLO) THEN
+ DO 2 I = 1, 4
+ NV = NV + 1
+ XP(NV) = X(I)
+ YP(NV) = Y(I)
+ 2 CONTINUE
+ NA = NA + 1
+ NE(NA) = 4
+ GO TO 100
+ ENDIF
+C
+C----Check for convex or concave quadrilaterals
+ ISUM = 0
+ DO 3 J = 1, 4
+ JM = MOD(J+2,4) + 1
+ JP = MOD(J, 4) + 1
+ IANG(J) = 1
+ IF ( (X(J)-X(JM))*(Y(JP)-Y(J)) .LT.
+ & (X(JP)-X(J))*(Y(J)-Y(JM)) ) IANG(J) = -1
+ ISUM = ISUM + IANG(J)
+ 3 CONTINUE
+ DO 4 J = 1, 4
+ IF (IANG(J)*ISUM.LT.0) GO TO 10
+ 4 CONTINUE
+C
+C----All angles < 180 deg., split into 4 triangles with average center pt
+ XTMP(3) = 0.25*(X(1)+X(2)+X(3)+X(4))
+ YTMP(3) = 0.25*(Y(1)+Y(2)+Y(3)+Y(4))
+ FTMP(3) = 0.25*(F(1)+F(2)+F(3)+F(4))
+C
+ DO 5 I = 1, 4
+ IP = MOD(I,4) + 1
+ XTMP(1) = X(I)
+ YTMP(1) = Y(I)
+ FTMP(1) = F(I)
+ XTMP(2) = X(IP)
+ YTMP(2) = Y(IP)
+ FTMP(2) = F(IP)
+ CALL CONTTRI(XTMP,YTMP,FTMP,FHI,FLO,
+ & NCU,XCU,YCU,NCL,XCL,YCL,NA,NE,NV,XP,YP)
+ 5 CONTINUE
+ GO TO 100
+C
+C----Quadrilaterals with an angle > 180, two triangles
+ 10 XTMP(3) = X(J)
+ YTMP(3) = Y(J)
+ FTMP(3) = F(J)
+C
+ JP1 = MOD(J,4) + 1
+ XTMP(1) = X(JP1)
+ YTMP(1) = Y(JP1)
+ FTMP(1) = F(JP1)
+ JP2 = MOD(JP1,4) + 1
+ XTMP(2) = X(JP2)
+ YTMP(2) = Y(JP2)
+ FTMP(2) = F(JP2)
+ CALL CONTTRI(XTMP,YTMP,FTMP,FHI,FLO,
+ & NCU,XCU,YCU,NCL,XCL,YCL,NA,NE,NV,XP,YP)
+C
+ JM2 = MOD(JM+1,4) + 1
+ XTMP(1) = X(JM2)
+ YTMP(1) = Y(JM2)
+ FTMP(1) = F(JM2)
+ JM1 = MOD(JM2,4) + 1
+ XTMP(2) = X(JM1)
+ YTMP(2) = Y(JM1)
+ FTMP(2) = F(JM1)
+ CALL CONTTRI(XTMP,YTMP,FTMP,FHI,FLO,
+ & NCU,XCU,YCU,NCL,XCL,YCL,NA,NE,NV,XP,YP)
+C
+ 100 RETURN
+ END
+
+
+
+ subroutine CONTTRI(X,Y,F,
+ & FUPR,FLWR,
+ & NCU,XCU,YCU,
+ & NCL,XCL,YCL,
+ & NA,NE,NV,XP,YP)
+C
+C Contour a single triangular element between an upper and
+C a lower contour limit. The output from this routine is both the line
+C segments defining the upper and lower contours and a set of
+C polygons that define the area of the element lying between the
+C contour limits. These may be used to shade the area on a plot.
+C
+C X, Y, Arrays containing triangular element points
+C F Array containing the quantity F(x,y) to be contoured,
+C ie. F(i) is defined at X(i),Y(i), i=1->3
+C FUPR, FLWR Upper and lower contour limits
+C NCU Number of upper limit contour line points
+C XCU, YCU Arrays of x,y points on upper contour
+C NCL Number of lower limit contour line points
+C XCL, YCL Arrays of x,y points on lower contour
+C NA Number of polygon areas in XP, YP, NE arrays
+C NE Array of numbers of points in each polygon area
+C NV Vertex count of points in XP,YP arrays
+C XP, YP Coordinate points of contour polygons
+C
+C Note: the output contour line points on the upper contour (XCU,YCU)
+C or lower contour (XCL,YCL) are only valid in point pairs, ie.
+C points 1 and 2 define a segment, points 3 and 4 define the next,
+C etc. In general, there is no guarantee that the cross-pair points
+C (like points 2 and 3) will be contiguous. DO NOT PLOT THESE AS A
+C CONTIGUOUS ARRAY OF POINTS.
+C
+C Note: the output areas (NA polygons) are stored with the points
+C for all polys in one big XP,YP array. The number of points
+C in each polygon are stored in NE, i.e. NE(1) is the number of
+C points stored in XP,YP for the first polygon, NE(2) is the number
+C of vertices stored following those for the second polygon, etc.
+C The total number of vertices is NV=sum[NE(1)+NE(2)..+NE(NA)].
+C
+C Note: the NCU,NCL,NA,NV counters are cumulative in this routine!
+C If you want to contour each triangle without accumulating
+C contour points or polygons reset NCU=0,NCL=0,NA=0,NV=0 before
+C each call to CONTTRI.
+C
+ DIMENSION X(3), Y(3), F(3), FH(3), FL(3),
+ & XCU(1), YCU(1), XCL(1), YCL(1), XP(1), YP(1), NE(1)
+C
+C---- NCU tracks the number of upper contour points
+C NCL tracks the number of lower contour points
+C NA tracks the number of polygon areas
+C NV tracks the total number of stored vertices in the XP,YP arrays
+C---- Uncomment these if you want to reset the counters each time you
+C contour a triangle
+C NA = 0
+C NV = 0
+C NCU = 0
+C NCL = 0
+C
+ FHI = FUPR
+ FLO = FLWR
+ IF (FHI.LT.FLO) THEN
+ FHI = FLWR
+ FLO = FUPR
+ ENDIF
+
+ NVFRST = NV
+C
+ EPS = 0.0001*(FHI-FLO)
+C
+C---- Temporary values
+ DO 1 I = 1, 3
+ FH(I) = F(I) - FHI
+ FL(I) = F(I) - FLO
+ IF (FH(I).GE.0. .AND. FH(I).LT. EPS) FH(I) = EPS
+ IF (FH(I).LE.0. .AND. FH(I).GT.-EPS) FH(I) = -EPS
+ IF (FL(I).GE.0. .AND. FL(I).LT. EPS) FL(I) = EPS
+ IF (FL(I).LE.0. .AND. FL(I).GT.-EPS) FL(I) = -EPS
+ 1 CONTINUE
+C
+C----Check point by point for points in contour limits
+ DO 50 I = 1, 3
+C
+C----Inside contour limits
+ IF (FH(I).LT.0. .AND. FL(I).GT.0.) THEN
+ NV = NV + 1
+ XP(NV) = X(I)
+ YP(NV) = Y(I)
+C
+ ELSE
+C
+ IF (FH(I).GE.0.) THEN
+C----Check for intersections with previous and next point
+ IP = MOD(I,3) + 1
+ IM = MOD(I+1,3) + 1
+ IF (FH(IM).LT.0.) THEN
+ ETA = -(FH(IM)+FH(I))/(FH(IM)-FH(I))
+ NCU = NCU + 1
+ XCU(NCU) = 0.5*(X(I) + X(IM) + ETA*(X(IM)-X(I)) )
+ YCU(NCU) = 0.5*(Y(I) + Y(IM) + ETA*(Y(IM)-Y(I)) )
+ NV = NV + 1
+ XP(NV) = XCU(NCU)
+ YP(NV) = YCU(NCU)
+ ENDIF
+ IF (FH(IP).LT.0.) THEN
+ ETA = -(FH(IP)+FH(I))/(FH(IP)-FH(I))
+ NCU = NCU + 1
+ XCU(NCU) = 0.5*(X(I) + X(IP) + ETA*(X(IP)-X(I)) )
+ YCU(NCU) = 0.5*(Y(I) + Y(IP) + ETA*(Y(IP)-Y(I)) )
+ NV = NV + 1
+ XP(NV) = XCU(NCU)
+ YP(NV) = YCU(NCU)
+ ENDIF
+ ENDIF
+C
+ IF (FL(I).LE.0.) THEN
+C----Check for intersections with previous and next point
+ IP = MOD(I,3) + 1
+ IM = MOD(I+1,3) + 1
+ IF (FL(IM).GT.0.) THEN
+ ETA = -(FL(IM)+FL(I))/(FL(IM)-FL(I))
+ NCL = NCL + 1
+ XCL(NCL) = 0.5*(X(I) + X(IM) + ETA*(X(IM)-X(I)) )
+ YCL(NCL) = 0.5*(Y(I) + Y(IM) + ETA*(Y(IM)-Y(I)) )
+ NV = NV + 1
+ XP(NV) = XCL(NCL)
+ YP(NV) = YCL(NCL)
+ ENDIF
+ IF (FL(IP).GT.0.) THEN
+ ETA = -(FL(IP)+FL(I))/(FL(IP)-FL(I))
+ NCL = NCL + 1
+ XCL(NCL) = 0.5*(X(I) + X(IP) + ETA*(X(IP)-X(I)) )
+ YCL(NCL) = 0.5*(Y(I) + Y(IP) + ETA*(Y(IP)-Y(I)) )
+ NV = NV + 1
+ XP(NV) = XCL(NCL)
+ YP(NV) = YCL(NCL)
+ ENDIF
+ ENDIF
+C
+ ENDIF
+C
+ 50 CONTINUE
+C
+ IF (NV.GT.NVFRST+2) THEN
+ NA = NA + 1
+ NE(NA) = NV - NVFRST
+ ENDIF
+C
+ RETURN
+ END
+
+
+
+ subroutine AXISADJ(xmin,xmax,xspan,deltax,ntics)
+C...Make scaled axes with engineering increments between tics
+C
+C Input: xmin, xmax - input range for which scaled axis is desired
+C
+C Output: xmin, xmax - adjusted range for scaled axis
+C xspan - adjusted span of scaled axis
+C deltax - increment to be used for scaled axis
+C nincr - number of tics to be used on axis
+C note that ntics=1+(xspan/deltax)
+C
+ real xmin,xmax,xspan,deltax,xinc,xinctbl(5)
+ integer ntics,i
+ data xinctbl / 0.1, 0.2, 0.25, 0.5, 1. /
+c
+ xspan1 = xmax-xmin
+ if (xspan1.eq.0.) xspan1 = 1.
+c
+ xpon = ifix(log10(xspan1))
+ xspan = xspan1 / 10.**xpon
+c
+ do i = 1, 5
+ xinc = xinctbl(i)
+ ntics = 1 + ifix(xspan/xinc + 0.1)
+ if (ntics.LE.6) go to 1
+ end do
+c
+ 1 deltax = xinc*10.**xpon
+ xmin = deltax* ifloor(xmin/deltax)
+ xmax = deltax*iceiling(xmax/deltax)
+ xspan = xmax - xmin
+ ntics = 1 + ifix(xspan/deltax + 0.1)
+ return
+ end
+
+ function iceiling(x)
+c--- returns next highest integer value if fraction is non-zero
+ integer iceiling
+ real x
+ i = ifix(x)
+ if(x-i.GT.0.) i = i+1
+ iceiling = i
+ return
+ end
+
+ function ifloor(x)
+c--- returns next lowest integer value if fraction is negative, non-zero
+ integer ifloor
+ real x
+ i = ifix(x)
+ if(x-i.LT.0.) i = i-1
+ ifloor = i
+ return
+ end
+
+
+
+
+
+ subroutine ANNOT(CH)
+C------------------------------------------------------
+C Interactive annotation menu for adding custom
+C ornaments to an active plot (before PLEND call).
+C------------------------------------------------------
+ CHARACTER*80 AA
+ CHARACTER*1 OPT, KCHAR
+C
+ SAVE CHF, ISYMB
+ DATA CHF, ISYMB / 1.0, 0 /
+C
+ 900 CONTINUE
+C
+ 1000 FORMAT(A)
+ 1010 FORMAT(A,$)
+ 1020 FORMAT(A,F7.3,A,$)
+ 1030 FORMAT(A,I2 ,A,$)
+C
+ WRITE(*,1050)
+ 1050 FORMAT(/' C haracters | '
+ & /' S lant characters | '
+ & /' M ath characters | plot '
+ & /' P oint symbol | '
+ & /' L ine | '
+ & /' A rrow | '
+ & /' '
+ & /' W idth of characters | modify'
+ & /' T ype of point symbol | ')
+C
+ 905 WRITE(*,*)
+ WRITE(*,1010) ' Select option or <return>: '
+ READ(*,1000) OPT
+ IF(OPT.EQ.' ') RETURN
+C
+ CHI = CHF*CH
+C
+C-------------------------------------------------------------
+ IF(INDEX('CcSsMm',OPT).NE.0) THEN
+C
+ WRITE(*,*) 'Click on lower left point of character string...'
+ CALL GETCURSORXY(XX,YY,KCHAR)
+ WRITE(*,1010) ' Enter character string: '
+ READ (*,1000) AA
+C
+C---- find index of last non-blank character
+ DO 112 NA=80, 1, -1
+ IF(AA(NA:NA).NE.' ') GO TO 113
+ 112 CONTINUE
+ 113 CONTINUE
+C
+ CALL NEWPEN(3)
+ IF(INDEX('Cc',OPT).NE.0) CALL PLCHAR(XX,YY,CHI,AA,0.0,NA)
+ IF(INDEX('Ss',OPT).NE.0) CALL PLSLAN(XX,YY,CHI,AA,0.0,NA)
+ IF(INDEX('Mm',OPT).NE.0) CALL PLMATH(XX,YY,CHI,AA,0.0,NA)
+ CALL PLFLUSH
+C
+C-------------------------------------------------------------
+ ELSE IF(INDEX('Pp',OPT).NE.0) THEN
+C
+ WRITE(*,*) 'Click on symbol locations ...'
+ CALL GETCURSORXY(XX,YY,KCHAR)
+ CALL NEWPEN(2)
+ CALL PLSYMB(XX,YY,CHI,ISYMB,0.0,0)
+ CALL PLFLUSH
+C
+C-------------------------------------------------------------
+ ELSE IF(INDEX('LlAa',OPT).NE.0) THEN
+C
+ WRITE(*,*) 'Click on line points, twice on last point...'
+C
+ CALL NEWPEN(1)
+ CALL GETCURSORXY(XXM,YYM,KCHAR)
+ CALL PLOT(XXM,YYM,3)
+ CALL PLOT(XXM,YYM,2)
+ XXL = XXM
+ YYL = YYM
+ CALL PLFLUSH
+ DO 131 IP=1, 12345
+ CALL GETCURSORXY(XX,YY,KCHAR)
+ CALL PLOT(XX,YY,2)
+
+ CALL PLFLUSH
+
+ IF(XXM.EQ.XX .AND. YYM.EQ.YY) GO TO 132
+ XXL = XXM
+ YYL = YYM
+ XXM = XX
+ YYM = YY
+ 131 CONTINUE
+ 132 CONTINUE
+C
+ IF(INDEX('Aa',OPT).NE.0) THEN
+C------ add arrowhead
+ DX = XX - XXL
+ DY = YY - YYL
+ DS = SQRT(DX**2 + DY**2)
+ ARLEN = 1.5*CHI
+ HAR = 0.1
+cc IF(DS .GT. ARLEN) THEN
+ CALL PLOT(XX-ARLEN*(DX+HAR*DY)/DS,YY-ARLEN*(DY-HAR*DX)/DS,2)
+ CALL PLOT(XX-ARLEN*(DX-HAR*DY)/DS,YY-ARLEN*(DY+HAR*DX)/DS,2)
+ CALL PLOT(XX,YY,2)
+cc ENDIF
+ ENDIF
+C
+ XX = XX + 0.7*CHI
+ YY = YY - 0.5*CHI
+ CALL PLFLUSH
+C
+C-------------------------------------------------------------
+ ELSE IF(INDEX('Ww',OPT).NE.0) THEN
+C
+ 140 WRITE(*,1020)
+ & ' Enter new character width factor (currently =',CHF,'): '
+ READ (*,*,ERR=140) CHF
+C
+C-------------------------------------------------------------
+ ELSE IF(INDEX('Tt',OPT).NE.0) THEN
+C
+ WRITE(*,*)
+ WRITE(*,*) ' 0 square 7 Y '
+ WRITE(*,*) ' 1 circle 8 flipped Y '
+ WRITE(*,*) ' 2 triangle 9 * '
+ WRITE(*,*) ' 3 + 10 flipped * '
+ WRITE(*,*) ' 4 x 11 hourglass '
+ WRITE(*,*) ' 5 diamond 12 bowtie '
+ WRITE(*,*) ' 6 yield sign 13 star '
+ WRITE(*,*)
+ 160 WRITE(*,1030) ' Enter new symbol type (currently =',ISYMB,'): '
+ READ (*,*,ERR=160) ISYMB
+C
+C-------------------------------------------------------------
+ ELSE
+C
+ GO TO 900
+C
+ ENDIF
+C
+ GO TO 905
+ END ! ANNOT
diff --git a/plotlib/pltlib.inc b/plotlib/pltlib.inc
new file mode 100644
index 0000000..b11ce36
--- /dev/null
+++ b/plotlib/pltlib.inc
@@ -0,0 +1,244 @@
+C***********************************************************************
+C Module: pltlib.inc
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C
+C*******************************
+C --- Global data for Xplot11
+C Version 4.46 11/28/01
+C*******************************
+C
+ parameter (Nstore_max=100000,Ncolors_max=256,MaxPolyLine=501)
+C
+ Real DEFAULT_PAGEHEIGHT,
+ & DEFAULT_PAGEWIDTH,
+ & DEFAULT_SCREENFRACTION
+C
+C---Set paper size here
+ parameter (DEFAULT_PAGEHEIGHT = 11.0, ! Letter size
+ & DEFAULT_PAGEWIDTH = 8.5,
+ & DEFAULT_SCREENFRACTION = 0.67)
+cc parameter (DEFAULT_PAGEHEIGHT = 11.65, ! A4 European
+cc & DEFAULT_PAGEWIDTH = 8.25,
+cc & DEFAULT_SCREENFRACTION = 0.67)
+C
+ Integer NPS_UNIT_DEFAULT,
+ & NPRIM_UNIT_DEFAULT
+C
+ parameter (NPS_UNIT_DEFAULT = 80)
+ parameter (NPRIM_UNIT_DEFAULT = 81)
+C
+ Integer PageCommand,
+ & PlotCommand,
+ & PenCommand,
+ & ScaleCommand,
+ & PatternCommand,
+ & ColorCommand,
+ & PolylinePointCommand,
+ & PolylineDrawCommand,
+ & MinClipCommand,
+ & MaxClipCommand
+C
+ parameter (PageCommand = 1)
+ parameter (PlotCommand = 2)
+ parameter (PenCommand = 3)
+ parameter (ScaleCommand = 4)
+ parameter (PatternCommand = 5)
+ parameter (ColorCommand = 6)
+ parameter (PolylinePointCommand = 7)
+ parameter (PolylineDrawCommand = 8)
+ parameter (MinClipCommand = 9)
+ parameter (MaxClipCommand = 10)
+C
+ Integer Page_Portrait,
+ & Page_Landscape
+C
+ parameter (Page_Portrait = 0)
+ parameter (Page_Landscape = 1)
+C
+ LOGICAL LPRIM_OPEN,
+ & LGW_GEN, LGW_OPEN, LGW_COLOR, LGW_REVVIDEO,
+ & LGW_CHANGED, LGW_RESIZE,
+ & LPS_GEN, LPS_OPEN, LPS_COLOR,
+ & LPS_UNSTROKED, LPS_EXTERNAL, LPS_ONEFILE
+ INTEGER GX_LOC, GY_LOC,
+ & GX_ORG, GY_ORG,
+ & GX_SIZ, GY_SIZ,
+ & GX_CRS, GY_CRS,
+ & G_WIDTH, G_HEIGHT, G_DEPTH,
+ & G_COLOR_CINDEX
+ INTEGER COLOR_RGB
+ CHARACTER COLOR_NAME*22
+ CHARACTER PS_FILE*80
+C
+C...Common storing current plot primitives
+ Common /PL_PRIML/
+ & LPRIM_OPEN
+ Common /PL_PRIMI/
+ & NPRIM_UNIT,
+ & N_PRIM, N_WRIT, N_INCORE,
+ & I_TYP(Nstore_max),
+ & I_PRIM(Nstore_max)
+ Common /PL_PRIMR/
+ & X_PRIM(Nstore_max),
+ & Y_PRIM(Nstore_max)
+C
+C...Global data for plotting, clipping, etc.
+ Common /PL_PLOTI/
+ & I_DEV, I_PAGETYPE,
+ & I_PEN, LST_PEN,
+ & I_PAT, LST_PAT,
+ & I_CLR, LST_CLR
+ Common /PL_PLOTR/
+ & X_SCALE, Y_SCALE,
+ & X_ORG, Y_ORG,
+ & X_LST, Y_LST,
+ & X_PAGE, Y_PAGE,
+ & X_WIND, Y_WIND,
+ & CLP_XMIN, CLP_XMAX, CLP_YMIN, CLP_YMAX,
+ & XOFF_ZOOM,YOFF_ZOOM,
+ & XFAC_ZOOM,YFAC_ZOOM
+C
+C...Global data for color definition
+ Common /PL_COLORI/
+ & N_COLOR, N_SPECTRUM, IFIRST_SPECTRUM,
+ & COLOR_RGB(Ncolors_max)
+ Common /PL_COLORC/
+ & COLOR_NAME(Ncolors_max)
+C
+C...Global data for X-window output
+ Common /PL_XWINL/
+ & LGW_GEN, LGW_OPEN, LGW_COLOR, LGW_REVVIDEO,
+ & LGW_CHANGED, LGW_RESIZE
+ Common /PL_XWINI/
+ & GX_LOC, GY_LOC,
+ & GX_ORG, GY_ORG,
+ & GX_SIZ, GY_SIZ,
+ & GX_CRS, GY_CRS,
+ & G_WIDTH, G_HEIGHT, G_DEPTH,
+ & G_COLOR_CINDEX(Ncolors_max)
+ Common /PL_XWINR/
+ & G_SCALE, G_SCRNFRAC
+C
+C...Global data for PostScript output
+ Common /PL_PSL/
+ & LPS_GEN, LPS_OPEN, LPS_COLOR, LPS_UNSTROKED,
+ & LPS_EXTERNAL, LPS_ONEFILE
+ Common /PL_PSI/
+ & IPS_MODE, NPS_UNIT, N_PAGES, I_PAGES, N_VECS
+ Common /PL_PSR/
+ & PX_ORG, PY_ORG, PX_SIZ, PY_SIZ, P_SCALE,
+ & BB_XMIN, BB_XMAX, BB_YMIN, BB_YMAX,
+ & PS_LSTX, PS_LSTY
+ Common /PL_PSC/
+ & PS_FILE
+
+
+C
+C LPRIM_OPEN T if primitives file is open
+C NPRIM_UNIT Fortran logical unit for primitives file (unit# 0)
+C N_PRIM Number of accumulated primitives
+C N_WRIT Number of primitives written to logfile
+C N_INCORE Number of primitives in buffer array
+C I_TYP(.) type-of-primitive index
+C I_PRIM(.) primitive data
+C X_PRIM(.) "
+C Y_PRIM(.) "
+C
+C I_DEV "Device" index, specifies X-graphics, PostScript output
+C I_PAGETYPE = Page_Landscape or Page_Portrait
+C I_PEN, LST_PEN current and previous pen thickness
+C I_PAT, LST_PAT current and previous pen pattern
+C I_CLR, LST_CLR current and previous color
+C
+C X_SCALE,Y_SCALE absolute-unit/user-unit scale factors
+C X_ORG, Y_ORG user x,y-axis origin in absolute coordinates
+C X_LST, Y_LST last pen location in absolute coordinates
+C
+C X_PAGE, Y_PAGE plot page size in absolute units (typ. 11.0"x8.5")
+C X_WIND, Y_WIND X-window size in absolute units
+C (will not exceed X_PAGE,Y_PAGE upon window resizing)
+C
+C CLP_XMIN, CLP_XMAX user-specified clipping limits
+C CLP_YMIN, CLP_YMAX (in absolute coordinates)
+C
+C XOFF_ZOOM zoom offsets
+C YOFF_ZOOM
+C XFAC_ZOOM zoom scaling factors
+C YFAC_ZOOM
+C
+C N_COLOR total number of defined colors 1..i..N_COLORS
+C N_SPECTRUM number of defined colors in Spectrum 0..s..N_SPECTRUM
+C IFIRST_SPECTRUM gives index i of first Spectrum color
+C COLOR_RGB(i) rgb color index
+C COLOR_NAME(i) color name string
+C
+C LGW_GEN T if X-window graphics are to be generated
+C LGW_OPEN T is X-window is currently open
+C LGW_COLOR T if X-window has color capability
+C LGW_RESIZE T if X-window is to be resized
+C LGW_REVVIDEO T if X-window is in reverse-video (swap white,black)
+C
+C GX_LOC, GY_LOC location of upper-left window corner in screen pixels
+C GX_ORG, GY_ORG user-specified origin in window pixels
+C GX_SIZ, GY_SIZ window size in pixels
+C GX_CRS, GY_CRS user-specified cursor location
+C
+C G_SCALE # pixels / user plot unit
+C G_SCRNFRAC fraction of screen taken up by X-window on opening
+C G_WIDTH pixel width of root X window display
+C G_HEIGHT pixel height of root X window display
+C G_DEPTH color bit depth of screen
+C G_COLOR_CINDEX(i) X-colormap index of Xplot11 color i
+C
+C LPS_GEN T if PostScript output is to be generated
+C LPS_OPEN T is PostScript file is currently open
+C LPS_COLOR T if color PostScript is to be generated
+C LPS_UNSTROKED T if current PostScript page has not been stroked
+C LPS_EXTERNAL T if postscript file opened/closed outside of Xplot11
+C LPS_ONEFILE T if one postscript file used for each plot, otherwise
+C separate numbered plot files will be used for each
+C plot
+C
+C IPS_MODE 0 if Portrait PostScript, 1 if Lansdcape PostScript
+C
+C PX_ORG, PY_ORG location of user-specified origin (in points)
+C PX_SIZ, PY_SIZ size of PostScript page (in points)
+C P_SCALE # points / user plot unit
+C
+C NPS_UNIT Fortran logical unit of PostScript file
+C N_PAGES Cumulative count of PS pages generated
+C I_PAGES Number of PS pages generated for current plot file
+C N_VECS Number of PS vectors generated so far
+C
+C BB_XMIN, BB_XMAX PostScript Bounding Box limits
+C BB_YMIN, BB_YMAX
+C
+C PS_LSTX, PS_LSTY last PostScript move-to or line-to location
+C PS_FILE PostScript output filename
+
+
+
+
+
+
+
diff --git a/plotlib/ps_subs.f b/plotlib/ps_subs.f
new file mode 100644
index 0000000..6c0abcc
--- /dev/null
+++ b/plotlib/ps_subs.f
@@ -0,0 +1,625 @@
+C***********************************************************************
+C Module: ps_subs.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 driver for postscript output to file
+C
+C Version 4.46 11/28/01
+C
+C Notes: PS Plotting coordinates in points (1pt=1/72in.)
+C are multiplied by 10 and truncated as integers to
+C eliminate extra characters (decimal pts.) in plot file.
+C Coordinates are converted to points again by output macros.
+C
+C Landscape orientation is done by translation and rotation
+C of upright plot.
+C
+C The option exists to check before overwriting all old
+C postscript output files (including the default file
+C "plot.ps") see the commented section below.
+C***********************************************************************
+
+ subroutine ps_setup(nunit)
+C
+C---Sets defaults for Postscript output
+C
+C nunit specifies logical unit and suffix for name for .ps output file
+C if nunit<0 output file is named "plotXXX.ps" where XXX is the
+C plot sequential number (i.e. separate plot files are created
+C for each plot)
+C if nunit=0 output file is named "plot.ps"
+C if nunit>0 output file is named "plotUUU.ps" where UUU is the
+C nunit unit number
+C
+ include 'pltlib.inc'
+ character numunit*3
+C
+ PX_ORG = 10.
+ PY_ORG = 10.
+ P_SCALE = 0.
+ LPS_OPEN = .FALSE.
+ LPS_UNSTROKED = .FALSE.
+ LPS_EXTERNAL = .FALSE.
+ LPS_ONEFILE = .TRUE.
+ I_PAGES = 0
+C
+C---Default postscript output file is "plot.ps", specified if nunit=0,
+C with logical IO to Fortran unit NPS_UNIT_DEFAULT.
+C (Note that unit NPRIM_UNIT_DEFAULT is also reserved and is dedicated
+C to the primitives overflow file)
+C
+C If user specifies nunit<0 each plot will be printed to a separate
+C file with name assigned as "plotNNN.ps" where NNN is the sequential
+C plot number
+C
+C If user specifies a logical unit to use for the plot file the logical
+C unit is used for IO and the name assigned is "plotNNN.ps" where
+C NNN is the logical unit number (0>NNN<1000)
+C
+ nunit0 = nunit
+ if(nunit.EQ.0) then
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot.ps'
+ elseif(nunit.EQ.NPRIM_UNIT_DEFAULT .OR. nunit.GT.999) then
+ write(*,*) 'PS_SETUP: PS file unit out of bounds: ',nunit
+ write(*,*) ' Using default unit ',NPS_UNIT_DEFAULT
+ write(*,*) ' Using default file "plot.ps"'
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot.ps'
+ elseif(nunit.LT.0) then
+c write(*,*) 'PS_SETUP: separate PS files used for each plot'
+c write(*,*) ' Using unit ',NPS_UNIT_DEFAULT
+c write(*,*) ' Using file "plot###.ps"'
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot000.ps'
+ LPS_ONEFILE = .FALSE.
+ else
+ write(numunit,10) nunit0
+ PS_FILE = 'plotunit' // numunit // '.ps'
+ endif
+ NPS_UNIT = nunit0
+C
+ 10 format(I3.3)
+ return
+ end
+
+
+ subroutine ps_init
+C---Initializes Postscript plotting and global plot variables
+ include 'pltlib.inc'
+C
+C---Change page orientation if required
+ IPS_MODE = 0
+ if(I_PAGETYPE.EQ.Page_Landscape) IPS_MODE = 1
+C
+ N_VECS = 0
+C...P_SCALE set so user graphics scales to 1.0inch/(absolute unit) on page
+ if(P_SCALE.EQ.0.) P_SCALE = 72.
+ PX_SIZ = P_SCALE*X_PAGE
+ PY_SIZ = P_SCALE*Y_PAGE
+ call ps_open
+C
+ return
+ end
+
+
+ subroutine ps_open
+C...Initializes PostScript file for plotting commands
+ include 'pltlib.inc'
+ logical LEXIST, LOPEN
+ character*80 PS_FILE2
+ character*1 ans
+ character numpage*3
+C
+ LOPEN = LPS_OPEN
+ call a_strip(' ',PS_FILE)
+ NCH = index(PS_FILE,' ') - 1
+C
+C---Check status on PS file
+C---PS file NOT OPENED.
+ if(.NOT.LPS_OPEN) then
+C
+C---Check unit to see if user opened it already (set status flag LPS_EXTERNAL)
+C if file is already open skip opening the file, just use it
+C if unit is unopened then open a file for output
+ if(LPS_EXTERNAL) go to 10
+C---Check if file pre-opened outside of Xplot11
+ inquire(unit=NPS_UNIT,opened=LPS_EXTERNAL,err=1)
+C
+ 1 if(.NOT.LPS_EXTERNAL) then
+C
+C---If we are writing separate plotxxx.ps files create plot file name for
+C this plot using cumulative plot number
+ if(.NOT.LPS_ONEFILE) then
+ write(numpage,100) N_PAGES
+ PS_FILE = 'plot' // numpage // '.ps'
+ endif
+ 100 format(I3.3)
+C
+C
+C.....PS_FILE doesn't exist, so open it and proceed
+ 2 open(unit=NPS_UNIT,file=PS_FILE,status='UNKNOWN',err=3)
+ rewind(NPS_UNIT)
+ go to 10
+C....On open error get some other name and try again...
+ 3 write(*,1020)
+ read (*,1100) PS_FILE2
+ call a_strip(' ',PS_FILE2)
+ if(PS_FILE2.EQ.' ') go to 3
+ PS_FILE = PS_FILE2
+ NCH = index(PS_FILE,' ') - 1
+ go to 2
+C
+ endif
+C
+ 1010 format(/' PostScript output file ',A,
+ & ' exists. Overwrite? [Y] ',$)
+ 1020 format(' Specify new output file: ',$)
+C
+C...Write Postscript file header to identify this as a .ps file
+ 10 write(NPS_UNIT,1030) PS_FILE
+ if(IPS_MODE.EQ.1) write(NPS_UNIT,1040)
+ write(NPS_UNIT,1050)
+C
+ 1030 format('%!PS-Adobe-2.0'/
+ & '%%Title: ',A/
+ & '%%Creator: Xplot11'/
+ & '%%Pages: (atend)'/
+ & '%%BoundingBox: (atend)')
+ 1040 format('%%Orientation: Landscape')
+ 1050 format('%%EndComments'/)
+C
+ LPS_OPEN = .TRUE.
+C
+ endif
+C
+C
+C...For any ps_open -> Initialize Postscript last point and bounding box
+ PS_LSTX = -99999.
+ PS_LSTY = -99999.
+ BB_XMIN = 99999.
+ BB_YMIN = 99999.
+ BB_XMAX = -99999.
+ BB_YMAX = -99999.
+C
+ if(LOPEN) then
+ if(LPS_EXTERNAL) then
+ write(*,1064)
+ else
+ write(*,1065) PS_FILE(1:NCH)
+ endif
+ else
+ if(LPS_EXTERNAL) then
+ write(*,1059)
+ else
+ write(*,1060) PS_FILE(1:NCH)
+ endif
+ endif
+ 1059 format(' Writing PostScript to external file ...')
+ 1060 format(' Writing PostScript to file ',A,' ...')
+ 1064 format(' Appending PostScript to external file ...')
+ 1065 format(' Appending PostScript to file ',A,' ...')
+C
+C...Put out a page preamble
+ N_PAGES = N_PAGES + 1
+ I_PAGES = I_PAGES + 1
+ write(NPS_UNIT,1070) I_PAGES, I_PAGES
+ 1070 format('%%Page: ',I4,2X,I4/
+ & 'gsave %Save current context'/
+ & '% Define macros for drawing'/
+ & '/rscal {10 div exch 10 div exch } bind def'/
+ & '/M { rscal moveto } bind def'/
+ & '/L { rscal lineto } bind def'/
+ & '/SG { setgray } bind def'/
+ & '/NP { newpath } bind def'/
+ & '/SL { setlinewidth } bind def'/
+ & '/CPSM { currentpoint stroke moveto } bind def'/
+ & '/CFS { closepath fill stroke } bind def'/
+ & '/CO { 2 index 255 div 2 index 255 div 2 index 255 div'/
+ & ' setrgbcolor pop pop pop } bind def'/
+ & '/LAND { 0 790 translate -90 rotate } bind def'//
+ & '% Set up for default line type and width'/
+ & ' 1 setlinejoin 0.25 SL [ ] 0 setdash 0 SG')
+C
+C---Use one of these sets for rotating/translating to landscape, depending
+C on your postscript screen viewer (right-side up/upside-down)
+C--------------------------------------------------------------
+c ixtrans = 0
+c iytrans = ifix(P_SCALE*X_PAGE)
+c irotate = -90
+C--------------------------------------------------------------
+ ixtrans = ifix(P_SCALE*Y_PAGE)
+ iytrans = 0
+ irotate = 90
+C--------------------------------------------------------------
+ 1080 format('% Rotate and translate for Landscape format'/
+ & I4,1X,I4,' translate ',I4,' rotate')
+ if(IPS_MODE.EQ.1) write(NPS_UNIT,1080) ixtrans,iytrans,irotate
+C
+ LPS_UNSTROKED = .TRUE.
+ N_VECS = 0
+C
+ 1100 format(a)
+ return
+ end
+
+
+ subroutine a_strip(ALPH,STRING)
+C
+C---- Strips all leading ALPH characters from STRING
+ character*(*) STRING
+ character*1 ALPH
+c
+ num = len(STRING)
+ do k=1, num
+ if(INDEX(STRING(k:k),ALPH) .EQ. 0) go to 10
+ enddo
+ return
+c
+ 10 STRING = STRING(k:num)
+ return
+ end
+
+
+ subroutine ps_close
+C...Closes PostScript file for plotting
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+C...Put out page count
+ write(NPS_UNIT,30) I_PAGES
+ 30 format('%%Trailer'/'%%Pages: ',I4)
+C
+C...Don't mess with external supplied units
+ if(.NOT.LPS_EXTERNAL) then
+ close(NPS_UNIT)
+ NPS_UNIT = -1
+ endif
+C
+ LPS_OPEN = .FALSE.
+ return
+ end
+
+
+ subroutine ps_endpage
+C...Ends PostScript page
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN ) return
+ if(.NOT.LPS_UNSTROKED) return
+C
+C...If a page has already been plotted, finish it
+ if(I_PAGES.GT.0) THEN
+ write(NPS_UNIT,20) BB_XMIN,BB_YMIN,
+ & BB_XMAX,BB_YMAX
+ endif
+ 20 format('stroke showpage grestore'/'%%BoundingBox: ',4F8.1/)
+C
+ LPS_UNSTROKED = .FALSE.
+ N_VECS = 0
+C
+ return
+ end
+
+
+ subroutine ps_flush
+C...Flushes out buffered plot output to PostScript file
+ include 'pltlib.inc'
+ return
+ end
+
+
+ subroutine ps_color(icolor)
+C...Sets PostScript foreground color from stored RGB colormap
+C Note: The background color for PS is always white
+C the foreground color is normally black
+C you get color when color PS printing is enabled
+C and the color is set to one of the colors in the color tables
+C icolor = 1 mapped to black
+C icolor = 2 mapped to white
+C ...
+C icolor = N_COLOR mapped to last color in color table
+C See the colormapping routines in plt_color.f for assigned colors
+C
+ include 'pltlib.inc'
+ character*22 colorname
+C
+ if(.NOT.LPS_OPEN .OR. .NOT.LPS_COLOR) return
+C
+C...Flush out existing lines at old color
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+C---Consult color map for RGB values
+ icol = icolor
+ if(N_COLOR.LE.0) icol = 1
+ call GETCOLORRGB(icol,ired,igrn,iblu,colorname)
+C
+C---RGB goes directly into postscript as color spec
+ write(NPS_UNIT,20) ired,igrn,iblu
+C
+ 10 format(' CPSM')
+ 20 format(' ',3(I5),' CO')
+ return
+ end
+
+ subroutine ps_pen(jpen)
+C...Sets PostScript line width
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+C...Change the line width for new lines
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+ write(NPS_UNIT,20) 0.25*float(jpen)
+C
+ 10 format(' CPSM')
+ 20 format(' ',F5.2,' SL')
+ return
+ end
+
+ subroutine ps_linepattern(lmask)
+C...Sets Postscript line pattern
+ include 'pltlib.inc'
+C
+ dimension iseg(32)
+ data mskall /-1/
+ data nsegmax / 8 /
+C
+ if(.NOT.LPS_OPEN) return
+C
+ if(lmask.EQ.0 .OR. lmask.eq.mskall) then
+ if(N_VECS.GT.0) write(NPS_UNIT,10)
+ write(NPS_UNIT,20)
+C
+ else
+C...Set line pattern from lower 16 bits of line mask (integer)
+C Note: no more than 10 pattern elements can be written to PS!
+ call bitpat(lmask,nseg,iseg)
+ nsg = min(nseg,nsegmax)
+ if(N_VECS.GT.0) write(NPS_UNIT,10)
+ write(NPS_UNIT,30) (iseg(i),i=1,nsg)
+ write(NPS_UNIT,40)
+ endif
+C
+ N_VECS = 0
+ 10 format(' CPSM')
+ 20 format(' [ ] 0 setdash')
+ 30 format(' [',10I3)
+ 40 format(' ] 0 setdash')
+C
+ return
+ end
+
+
+ subroutine ps_line(X1,Y1,X2,Y2)
+C
+C...Plots vector in absolute coordinates to PostScript file
+C
+C Note: coordinates are multiplied by 10 and truncated to integers (now
+C accurate to 1/10 of a point, or 1/720 in) to reduce the size of
+C the ascii plot file. Note that the moveto and lineto commands
+C defined in the preamble divide these by 10 before they hit the
+C paper.
+C
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+ PX1 = X1*P_SCALE + PX_ORG
+ PY1 = Y1*P_SCALE + PY_ORG
+ PX2 = X2*P_SCALE + PX_ORG
+ PY2 = Y2*P_SCALE + PY_ORG
+ BB_XMAX = MAX(BB_XMAX,PX1,PX2)
+ BB_XMIN = MIN(BB_XMIN,PX1,PX2)
+ BB_YMAX = MAX(BB_YMAX,PY1,PY2)
+ BB_YMIN = MIN(BB_YMIN,PY1,PY2)
+ ipx1 = ifix(10.0*PX1)
+ ipy1 = ifix(10.0*PY1)
+ ipx2 = ifix(10.0*PX2)
+ ipy2 = ifix(10.0*PY2)
+C
+ idx = iabs( ifix(10.0*PS_LSTX) - ipx1 )
+ idy = iabs( ifix(10.0*PS_LSTY) - ipy1 )
+C
+ if(N_VECS.GE.500) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+
+ if(idx.LE.1 .AND. idy.LE.1 .AND. N_VECS.NE.0) then
+CCC if(PX1.EQ.PS_LSTX .AND. PY1.EQ.PS_LSTY .AND. N_VECS.NE.0) then
+ write(NPS_UNIT,30) ipx2,ipy2
+ else
+ write(NPS_UNIT,20) ipx1,ipy1,ipx2,ipy2
+ endif
+C
+ PS_LSTX = PX2
+ PS_LSTY = PY2
+ N_VECS = N_VECS + 1
+C
+ 10 format(' CPSM')
+ 20 format(i5,1x,i5,' M ',i5,1x,i5,' L')
+ 30 format(i5,1x,i5,' L')
+C
+ return
+ end
+
+
+ subroutine ps_setscale(factor)
+C---Resets postscript plot scaling to factor*72pts/in
+ include 'pltlib.inc'
+C...P_SCALE set so user graphics scales to factor of 1.0inch/(absolute unit)
+ P_SCALE = factor*72.
+ PX_SIZ = P_SCALE*X_PAGE
+ PY_SIZ = P_SCALE*Y_PAGE
+ return
+ end
+
+
+
+ subroutine ps_polyline(X,Y,n,ifill)
+C...Plots polyline to postscript output
+C
+C Note for non-color postscript plots, colors in the colormap spectrum
+C can be used to shade filled polylines with a grey fill spectrum.
+C
+C Note: this simply uses the ps_line routine to put up the path,
+C then fills and strokes the path. It is important that
+C the number of points not exceed the stroke limit in ps_line
+C or it will try to stroke the path we need to fill...
+C
+ include 'pltlib.inc'
+ real mingrey, maxgrey
+ dimension X(n), Y(n)
+ data mingrey, maxgrey / 0.10, 0.95 /
+ if(n.LE.1) return
+C
+C...If this is a filled polyline flush out existing lines
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+ X1 = X(1)
+ Y1 = Y(1)
+ do i = 2, n
+ X2 = X(I)
+ Y2 = Y(i)
+ call ps_line(X1,Y1,X2,Y2)
+ X1 = X2
+ Y1 = Y2
+ end do
+C
+C...If this is not a color PS plot, shade any Spectrum color indices with
+C a grey shade from light grey to near black to replace the color shading
+ if(ifill.eq.0) then
+ write(NPS_UNIT,10)
+ else
+ grey = 0.0
+ if(.NOT.LPS_COLOR .AND. N_COLOR.GT.0) then
+ call GETCOLOR(icol)
+ if(icol.EQ.2) then
+ grey = 1.0
+ elseif(icol.LT.0) then
+ ispec = -icol
+ greyfrac = float(ispec-1)/float(N_SPECTRUM-1)
+ grey = mingrey + (maxgrey-mingrey)*greyfrac
+ else
+ grey = 0.0
+ endif
+ write(NPS_UNIT,15) grey
+ endif
+ write(NPS_UNIT,20)
+ endif
+C...Flush vector count since we are shading this now
+ N_VECS = 0
+ if(grey.NE.0.0) then
+ grey = 0.0
+ write(NPS_UNIT,15) grey
+ endif
+C
+ 10 format(' CPSM')
+ 15 format(' ',F5.2,' SG')
+ 20 format(' CFS')
+ return
+ end
+
+
+ subroutine bitpat(mask,nout,iout)
+c
+c--- Takes an integer mask and returns an integer array which contains
+c the on/off bit pattern,
+c for example: a mask with 0001000100010001 returns 8 integers
+c in the iout array (1,3,1,3,1,3,1,3)
+c a mask with 1110111011101110 returns 8 integers
+c in the iout array (3,1,3,1,3,1,3,1)
+c Note: the bit mask is shifted to always start counting on a '1' bit.
+c
+c--- Uses the library routines and() and rshift() for bit manipulation
+c which are present in most fortran libraries as extensions to f77.
+c
+ dimension iout(*)
+c
+c--- Shift the mask until the low order bit is 1 to start...
+ imask = mask
+ do n = 1, 16
+ ibitold = and(1,imask)
+ if(ibitold.NE.0) go to 5
+ nshft = n
+ imask = rshift(imask,1)
+ end do
+c
+ 5 nout = 0
+ if(nshft.GE.16) return
+ nbits = 0
+c
+c--- Cycle through 16 shifts to the right looking at the lower bit
+c and comparing with the previous one. If the bit changes record
+c the number of preceding contiguous bits in the output array.
+c
+ do n = 1, 16-nshft
+ ibit = and(1,imask)
+ccc write(*,*) 'n, imask,ibit,ibitold ',n,imask,ibit,ibitold
+c
+ if(ibit.ne.ibitold) then
+ nout = nout + 1
+ iout(nout) = nbits
+ccc write(*,*) 'nout ',nout,' adding nbits to iout ',nbits
+ nbits = 0
+ endif
+c
+ ibitold = ibit
+ nbits = nbits + 1
+ imask = rshift(imask,1)
+ end do
+c--- Add final bit(s) to end of 16 bits checked
+c--- Now append any zero bits shifted out originally
+ if(ibit.EQ.1) then
+ nout = nout + 1
+ iout(nout) = nbits
+ if(nshft.GT.0) then
+ nout = nout + 1
+ iout(nout) = nshft
+ endif
+ else
+ nout = nout + 1
+ iout(nout) = nbits + nshft
+ endif
+c
+ return
+ end
+
+
+
+
+
+
diff --git a/plotlib/ps_subs_old.f b/plotlib/ps_subs_old.f
new file mode 100644
index 0000000..e35becd
--- /dev/null
+++ b/plotlib/ps_subs_old.f
@@ -0,0 +1,620 @@
+C***********************************************************************
+C Module: ps_subs.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 driver for postscript output to file
+C
+C Version 4.46 11/28/01
+C
+C Notes: PS Plotting coordinates in points (1pt=1/72in.)
+C are multiplied by 10 and truncated as integers to
+C eliminate extra characters (decimal pts.) in plot file.
+C Coordinates are converted to points again by output macros.
+C
+C Landscape orientation is done by translation and rotation
+C of upright plot.
+C
+C The option exists to check before overwriting all old
+C postscript output files (including the default file
+C "plot.ps") see the commented section below.
+C***********************************************************************
+
+ subroutine ps_setup(nunit)
+C
+C---Sets defaults for Postscript output
+C
+C nunit specifies logical unit and suffix for name for .ps output file
+C if nunit<0 output file is named "plotXXX.ps" where XXX is the
+C plot sequential number (i.e. separate plot files are created
+C for each plot)
+C if nunit=0 output file is named "plot.ps"
+C if nunit>0 output file is named "plotUUU.ps" where UUU is the
+C nunit unit number
+C
+ include 'pltlib.inc'
+ character numunit*3
+C
+ PX_ORG = 10.
+ PY_ORG = 10.
+ P_SCALE = 0.
+ LPS_OPEN = .FALSE.
+ LPS_UNSTROKED = .FALSE.
+ LPS_EXTERNAL = .FALSE.
+ LPS_ONEFILE = .TRUE.
+ I_PAGES = 0
+C
+C---Default postscript output file is "plot.ps", specified if nunit=0,
+C with logical IO to Fortran unit NPS_UNIT_DEFAULT.
+C (Note that unit NPRIM_UNIT_DEFAULT is also reserved and is dedicated
+C to the primitives overflow file)
+C
+C If user specifies nunit<0 each plot will be printed to a separate
+C file with name assigned as "plotNNN.ps" where NNN is the sequential
+C plot number
+C
+C If user specifies a logical unit to use for the plot file the logical
+C unit is used for IO and the name assigned is "plotNNN.ps" where
+C NNN is the logical unit number (0>NNN<1000)
+C
+ nunit0 = nunit
+ if(nunit.EQ.0) then
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot.ps'
+ elseif(nunit.EQ.NPRIM_UNIT_DEFAULT .OR. nunit.GT.999) then
+ write(*,*) 'PS_SETUP: PS file unit out of bounds: ',nunit
+ write(*,*) ' Using default unit ',NPS_UNIT_DEFAULT
+ write(*,*) ' Using default file "plot.ps"'
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot.ps'
+ elseif(nunit.LT.0) then
+c write(*,*) 'PS_SETUP: separate PS files used for each plot'
+c write(*,*) ' Using unit ',NPS_UNIT_DEFAULT
+c write(*,*) ' Using file "plot###.ps"'
+ nunit0 = NPS_UNIT_DEFAULT
+ PS_FILE = 'plot000.ps'
+ LPS_ONEFILE = .FALSE.
+ else
+ write(numunit,10) nunit0
+ PS_FILE = 'plotunit' // numunit // '.ps'
+ endif
+ NPS_UNIT = nunit0
+C
+ 10 format(I3.3)
+ return
+ end
+
+
+ subroutine ps_init
+C---Initializes Postscript plotting and global plot variables
+ include 'pltlib.inc'
+C
+C---Change page orientation if required
+ IPS_MODE = 0
+ if(I_PAGETYPE.EQ.Page_Landscape) IPS_MODE = 1
+C
+ N_VECS = 0
+C...P_SCALE set so user graphics scales to 1.0inch/(absolute unit) on page
+ if(P_SCALE.EQ.0.) P_SCALE = 72.
+ PX_SIZ = P_SCALE*X_PAGE
+ PY_SIZ = P_SCALE*Y_PAGE
+ call ps_open
+C
+ return
+ end
+
+
+ subroutine ps_open
+C...Initializes PostScript file for plotting commands
+ include 'pltlib.inc'
+ logical LEXIST, LOPEN
+ character*80 PS_FILE2
+ character*1 ans
+ character numpage*3
+C
+ LOPEN = LPS_OPEN
+ call a_strip(' ',PS_FILE)
+ NCH = index(PS_FILE,' ') - 1
+C
+C---Check status on PS file
+C---PS file NOT OPENED.
+ if(.NOT.LPS_OPEN) then
+C
+C---Check unit to see if user opened it already (set status flag LPS_EXTERNAL)
+C if file is already open skip opening the file, just use it
+C if unit is unopened then open a file for output
+ if(LPS_EXTERNAL) go to 10
+C---Check if file pre-opened outside of Xplot11
+ inquire(unit=NPS_UNIT,opened=LPS_EXTERNAL,err=1)
+C
+ 1 if(.NOT.LPS_EXTERNAL) then
+C
+C---If we are writing separate plotxxx.ps files create plot file name for
+C this plot using cumulative plot number
+ if(.NOT.LPS_ONEFILE) then
+ write(numpage,100) N_PAGES
+ PS_FILE = 'plot' // numpage // '.ps'
+ endif
+ 100 format(I3.3)
+C
+C
+C.....PS_FILE doesn't exist, so open it and proceed
+ 2 open(unit=NPS_UNIT,file=PS_FILE,status='UNKNOWN',err=3)
+ rewind(NPS_UNIT)
+ go to 10
+C....On open error get some other name and try again...
+ 3 write(*,1020)
+ read (*,1100) PS_FILE2
+ call a_strip(' ',PS_FILE2)
+ if(PS_FILE2.EQ.' ') go to 3
+ PS_FILE = PS_FILE2
+ NCH = index(PS_FILE,' ') - 1
+ go to 2
+C
+ endif
+C
+ 1010 format(/' PostScript output file ',A,
+ & ' exists. Overwrite? [Y] ',$)
+ 1020 format(' Specify new output file: ',$)
+C
+C...Write Postscript file header to identify this as a .ps file
+ 10 write(NPS_UNIT,1030) PS_FILE
+ if(IPS_MODE.EQ.1) write(NPS_UNIT,1040)
+ write(NPS_UNIT,1050)
+C
+ 1030 format('%!PS-Adobe-2.0'/
+ & '%%Title: ',A/
+ & '%%Creator: Xplot11'/
+ & '%%Pages: (atend)'/
+ & '%%BoundingBox: (atend)')
+ 1040 format('%%Orientation: Landscape')
+ 1050 format('%%EndComments'/)
+C
+ LPS_OPEN = .TRUE.
+C
+ endif
+C
+C
+C...For any ps_open -> Initialize Postscript last point and bounding box
+ PS_LSTX = -99999.
+ PS_LSTY = -99999.
+ BB_XMIN = 99999.
+ BB_YMIN = 99999.
+ BB_XMAX = -99999.
+ BB_YMAX = -99999.
+C
+ if(LOPEN) then
+ if(LPS_EXTERNAL) then
+ write(*,1064)
+ else
+ write(*,1065) PS_FILE(1:NCH)
+ endif
+ else
+ if(LPS_EXTERNAL) then
+ write(*,1059)
+ else
+ write(*,1060) PS_FILE(1:NCH)
+ endif
+ endif
+ 1059 format(' Writing PostScript to external file ...')
+ 1060 format(' Writing PostScript to file ',A,' ...')
+ 1064 format(' Appending PostScript to external file ...')
+ 1065 format(' Appending PostScript to file ',A,' ...')
+C
+C...Put out a page preamble
+ N_PAGES = N_PAGES + 1
+ I_PAGES = I_PAGES + 1
+ write(NPS_UNIT,1070) I_PAGES, I_PAGES
+ 1070 format('%%Page: ',I4,2X,I4/
+ & 'gsave %Save current context'/
+ & '% Define macros for drawing'/
+ & '/rscal {10 div exch 10 div exch } bind def'/
+ & '/M { rscal moveto } bind def'/
+ & '/L { rscal lineto } bind def'/
+ & '/SG { setgray } bind def'/
+ & '/NP { newpath } bind def'/
+ & '/SL { setlinewidth } bind def'/
+ & '/CPSM { currentpoint stroke moveto } bind def'/
+ & '/CFS { closepath fill stroke } bind def'/
+ & '/CO { 2 index 255 div 2 index 255 div 2 index 255 div'/
+ & ' setrgbcolor pop pop pop } bind def'/
+ & '/LAND { 0 790 translate -90 rotate } bind def'//
+ & '% Set up for default line type and width'/
+ & ' 1 setlinejoin 0.25 SL [ ] 0 setdash 0 SG')
+C
+C---Use one of these sets for rotating/translating to landscape, depending
+C on your postscript screen viewer (right-side up/upside-down)
+C--------------------------------------------------------------
+c ixtrans = 0
+c iytrans = ifix(P_SCALE*X_PAGE)
+c irotate = -90
+C--------------------------------------------------------------
+ ixtrans = ifix(P_SCALE*Y_PAGE)
+ iytrans = 0
+ irotate = 90
+C--------------------------------------------------------------
+ 1080 format('% Rotate and translate for Landscape format'/
+ & I4,1X,I4,' translate ',I4,' rotate')
+ if(IPS_MODE.EQ.1) write(NPS_UNIT,1080) ixtrans,iytrans,irotate
+C
+ LPS_UNSTROKED = .TRUE.
+ N_VECS = 0
+C
+ 1100 format(a)
+ return
+ end
+
+
+ subroutine a_strip(ALPH,STRING)
+C
+C---- Strips all leading ALPH characters from STRING
+ character*(*) STRING
+ character*1 ALPH
+c
+ num = len(STRING)
+ do k=1, num
+ if(INDEX(STRING(k:k),ALPH) .EQ. 0) go to 10
+ enddo
+ return
+c
+ 10 STRING = STRING(k:num)
+ return
+ end
+
+
+ subroutine ps_close
+C...Closes PostScript file for plotting
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+C...Put out page count
+ write(NPS_UNIT,30) I_PAGES
+ 30 format('%%Trailer'/'%%Pages: ',I4)
+C
+C...Don't mess with external supplied units
+ if(.NOT.LPS_EXTERNAL) then
+ close(NPS_UNIT)
+ NPS_UNIT = -1
+ endif
+C
+ LPS_OPEN = .FALSE.
+ return
+ end
+
+
+ subroutine ps_endpage
+C...Ends PostScript page
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN ) return
+ if(.NOT.LPS_UNSTROKED) return
+C
+C...If a page has already been plotted, finish it
+ if(I_PAGES.GT.0) THEN
+ write(NPS_UNIT,20) BB_XMIN,BB_YMIN,
+ & BB_XMAX,BB_YMAX
+ endif
+ 20 format('stroke showpage grestore'/'%%BoundingBox: ',4F8.1/)
+C
+ LPS_UNSTROKED = .FALSE.
+ N_VECS = 0
+C
+ return
+ end
+
+
+ subroutine ps_flush
+C...Flushes out buffered plot output to PostScript file
+ include 'pltlib.inc'
+ return
+ end
+
+
+ subroutine ps_color(icolor)
+C...Sets PostScript foreground color from stored RGB colormap
+C Note: The background color for PS is always white
+C the foreground color is normally black
+C you get color when color PS printing is enabled
+C and the color is set to one of the colors in the color tables
+C icolor = 1 mapped to black
+C icolor = 2 mapped to white
+C ...
+C icolor = N_COLOR mapped to last color in color table
+C See the colormapping routines in plt_color.f for assigned colors
+C
+ include 'pltlib.inc'
+ character*22 colorname
+C
+ if(.NOT.LPS_OPEN .OR. .NOT.LPS_COLOR) return
+C
+C...Flush out existing lines at old color
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+C---Consult color map for RGB values
+ icol = icolor
+ if(N_COLOR.LE.0) icol = 1
+ call GETCOLORRGB(icol,ired,igrn,iblu,colorname)
+C
+C---RGB goes directly into postscript as color spec
+ write(NPS_UNIT,20) ired,igrn,iblu
+C
+ 10 format(' CPSM')
+ 20 format(' ',3(I5),' CO')
+ return
+ end
+
+ subroutine ps_pen(jpen)
+C...Sets PostScript line width
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+C...Change the line width for new lines
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+ write(NPS_UNIT,20) 0.25*float(jpen)
+C
+ 10 format(' CPSM')
+ 20 format(' ',F5.2,' SL')
+ return
+ end
+
+ subroutine ps_linepattern(lmask)
+C...Sets Postscript line pattern
+ include 'pltlib.inc'
+C
+ dimension iseg(32)
+ data mskall /-1/
+ data nsegmax / 8 /
+C
+ if(.NOT.LPS_OPEN) return
+C
+ if(lmask.EQ.0 .OR. lmask.eq.mskall) then
+ if(N_VECS.GT.0) write(NPS_UNIT,10)
+ write(NPS_UNIT,20)
+C
+ else
+C...Set line pattern from lower 16 bits of line mask (integer)
+C Note: no more than 10 pattern elements can be written to PS!
+ call bitpat(lmask,nseg,iseg)
+ nsg = min(nseg,nsegmax)
+ if(N_VECS.GT.0) write(NPS_UNIT,10)
+ write(NPS_UNIT,30) (iseg(i),i=1,nsg)
+ write(NPS_UNIT,40)
+ endif
+C
+ N_VECS = 0
+ 10 format(' CPSM')
+ 20 format(' [ ] 0 setdash')
+ 30 format(' [',10I3)
+ 40 format(' ] 0 setdash')
+C
+ return
+ end
+
+
+ subroutine ps_line(X1,Y1,X2,Y2)
+C
+C...Plots vector in absolute coordinates to PostScript file
+C
+C Note: coordinates are multiplied by 10 and truncated to integers (now
+C accurate to 1/10 of a point, or 1/720 in) to reduce the size of
+C the ascii plot file. Note that the moveto and lineto commands
+C defined in the preamble divide these by 10 before they hit the
+C paper.
+C
+ include 'pltlib.inc'
+C
+ if(.NOT.LPS_OPEN) return
+C
+ PX1 = X1*P_SCALE + PX_ORG
+ PY1 = Y1*P_SCALE + PY_ORG
+ PX2 = X2*P_SCALE + PX_ORG
+ PY2 = Y2*P_SCALE + PY_ORG
+ BB_XMAX = MAX(BB_XMAX,PX1,PX2)
+ BB_XMIN = MIN(BB_XMIN,PX1,PX2)
+ BB_YMAX = MAX(BB_YMAX,PY1,PY2)
+ BB_YMIN = MIN(BB_YMIN,PY1,PY2)
+ ipx1 = ifix(10.0*PX1)
+ ipy1 = ifix(10.0*PY1)
+ ipx2 = ifix(10.0*PX2)
+ ipy2 = ifix(10.0*PY2)
+C
+ if(N_VECS.GE.500) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+ if(PX1.EQ.PS_LSTX .AND. PY1.EQ.PS_LSTY .AND. N_VECS.NE.0) then
+ write(NPS_UNIT,30) ipx2,ipy2
+ else
+ write(NPS_UNIT,20) ipx1,ipy1,ipx2,ipy2
+ endif
+C
+ PS_LSTX = PX2
+ PS_LSTY = PY2
+ N_VECS = N_VECS + 1
+C
+ 10 format(' CPSM')
+ 20 format(i5,1x,i5,' M ',i5,1x,i5,' L')
+ 30 format(i5,1x,i5,' L')
+C
+ return
+ end
+
+
+ subroutine ps_setscale(factor)
+C---Resets postscript plot scaling to factor*72pts/in
+ include 'pltlib.inc'
+C...P_SCALE set so user graphics scales to factor of 1.0inch/(absolute unit)
+ P_SCALE = factor*72.
+ PX_SIZ = P_SCALE*X_PAGE
+ PY_SIZ = P_SCALE*Y_PAGE
+ return
+ end
+
+
+
+ subroutine ps_polyline(X,Y,n,ifill)
+C...Plots polyline to postscript output
+C
+C Note for non-color postscript plots, colors in the colormap spectrum
+C can be used to shade filled polylines with a grey fill spectrum.
+C
+C Note: this simply uses the ps_line routine to put up the path,
+C then fills and strokes the path. It is important that
+C the number of points not exceed the stroke limit in ps_line
+C or it will try to stroke the path we need to fill...
+C
+ include 'pltlib.inc'
+ real mingrey, maxgrey
+ dimension X(n), Y(n)
+ data mingrey, maxgrey / 0.10, 0.95 /
+ if(n.LE.1) return
+C
+C...If this is a filled polyline flush out existing lines
+ if(N_VECS.GT.0) then
+ write(NPS_UNIT,10)
+ N_VECS = 0
+ endif
+C
+ X1 = X(1)
+ Y1 = Y(1)
+ do i = 2, n
+ X2 = X(I)
+ Y2 = Y(i)
+ call ps_line(X1,Y1,X2,Y2)
+ X1 = X2
+ Y1 = Y2
+ end do
+C
+C...If this is not a color PS plot, shade any Spectrum color indices with
+C a grey shade from light grey to near black to replace the color shading
+ if(ifill.eq.0) then
+ write(NPS_UNIT,10)
+ else
+ grey = 0.0
+ if(.NOT.LPS_COLOR .AND. N_COLOR.GT.0) then
+ call GETCOLOR(icol)
+ if(icol.EQ.2) then
+ grey = 1.0
+ elseif(icol.LT.0) then
+ ispec = -icol
+ greyfrac = float(ispec-1)/float(N_SPECTRUM-1)
+ grey = mingrey + (maxgrey-mingrey)*greyfrac
+ else
+ grey = 0.0
+ endif
+ write(NPS_UNIT,15) grey
+ endif
+ write(NPS_UNIT,20)
+ endif
+C...Flush vector count since we are shading this now
+ N_VECS = 0
+ if(grey.NE.0.0) then
+ grey = 0.0
+ write(NPS_UNIT,15) grey
+ endif
+C
+ 10 format(' CPSM')
+ 15 format(' ',F5.2,' SG')
+ 20 format(' CFS')
+ return
+ end
+
+
+ subroutine bitpat(mask,nout,iout)
+c
+c--- Takes an integer mask and returns an integer array which contains
+c the on/off bit pattern,
+c for example: a mask with 0001000100010001 returns 8 integers
+c in the iout array (1,3,1,3,1,3,1,3)
+c a mask with 1110111011101110 returns 8 integers
+c in the iout array (3,1,3,1,3,1,3,1)
+c Note: the bit mask is shifted to always start counting on a '1' bit.
+c
+c--- Uses the library routines and() and rshift() for bit manipulation
+c which are present in most fortran libraries as extensions to f77.
+c
+ dimension iout(*)
+c
+c--- Shift the mask until the low order bit is 1 to start...
+ imask = mask
+ do n = 1, 16
+ ibitold = and(1,imask)
+ if(ibitold.NE.0) go to 5
+ nshft = n
+ imask = rshift(imask,1)
+ end do
+c
+ 5 nout = 0
+ if(nshft.GE.16) return
+ nbits = 0
+c
+c--- Cycle through 16 shifts to the right looking at the lower bit
+c and comparing with the previous one. If the bit changes record
+c the number of preceding contiguous bits in the output array.
+c
+ do n = 1, 16-nshft
+ ibit = and(1,imask)
+ccc write(*,*) 'n, imask,ibit,ibitold ',n,imask,ibit,ibitold
+c
+ if(ibit.ne.ibitold) then
+ nout = nout + 1
+ iout(nout) = nbits
+ccc write(*,*) 'nout ',nout,' adding nbits to iout ',nbits
+ nbits = 0
+ endif
+c
+ ibitold = ibit
+ nbits = nbits + 1
+ imask = rshift(imask,1)
+ end do
+c--- Add final bit(s) to end of 16 bits checked
+c--- Now append any zero bits shifted out originally
+ if(ibit.EQ.1) then
+ nout = nout + 1
+ iout(nout) = nbits
+ if(nshft.GT.0) then
+ nout = nout + 1
+ iout(nout) = nshft
+ endif
+ else
+ nout = nout + 1
+ iout(nout) = nbits + nshft
+ endif
+c
+ return
+ end
+
+
+
+
+
+
diff --git a/plotlib/set_subs.f b/plotlib/set_subs.f
new file mode 100644
index 0000000..70c13bc
--- /dev/null
+++ b/plotlib/set_subs.f
@@ -0,0 +1,774 @@
+C***********************************************************************
+C Module: plt_set.f
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This library is free software; you can redistribute it and/or
+C modify it under the terms of the GNU Library General Public
+C License as published by the Free Software Foundation; either
+C version 2 of the License, or (at your option) any later version.
+C
+C This library is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+C Library General Public License for more details.
+C
+C You should have received a copy of the GNU Library General Public
+C License along with this library; if not, write to the Free
+C Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+C
+C***********************************************************************
+C --- Xplot11 internal processing routines
+C
+C Version 4.46 11/28/01
+C
+C Note: These are plot-handling routines intended only
+C for internal use, including handling the replot buffer,
+C internal plot calls and clipping and zooming (the "set_xxx"
+C routines). Not intended for general consumption.
+C***********************************************************************
+
+ subroutine set_pen(ipen)
+C...Sets current pen width in pixels
+ include 'pltlib.inc'
+ LST_PEN = ipen
+ if(LGW_GEN) call gw_pen(ipen)
+ if(LPS_GEN) call ps_pen(ipen)
+ return
+ end
+
+
+ subroutine set_pat(ipat)
+C...Sets current line pattern as integer bit pattern
+ include 'pltlib.inc'
+ LST_PAT = ipat
+ if(LGW_GEN) call gw_linepattern(ipat)
+ if(LPS_GEN) call ps_linepattern(ipat)
+ return
+ end
+
+
+ subroutine set_color(icolor)
+C...Sets foreground color for plotting
+ include 'pltlib.inc'
+ LST_CLR = icolor
+ if(LGW_GEN) call gw_color(icolor)
+ if(LPS_GEN) call ps_color(icolor)
+ return
+ end
+
+
+ subroutine set_scl(xscale,yscale)
+C...Sets user's plotting scale factors to xscale,yscale
+ include 'pltlib.inc'
+ X_SCALE = xscale
+ Y_SCALE = yscale
+ return
+ end
+
+
+ subroutine putprim(ityp,ival,xval,yval)
+C...Installs plot primitive in save arrays
+C If the save arrays fill, the arrays are dumped to a temporary logfile
+C
+ include 'pltlib.inc'
+ SAVE incore
+C
+ if(N_PRIM.EQ.0) then
+ N_WRIT = 0
+ incore = 0
+ endif
+C
+C...Don't put primitives if at end of arrays and logging has been disabled
+ if(N_PRIM.GT.Nstore_max .AND. .NOT.LPRIM_OPEN) return
+C
+C...Check number of primitives in in-core save arrays for full arrays
+ if(incore.EQ.Nstore_max .AND. N_PRIM.NE.0) THEN
+C
+C...Primitives arrays are full, how about writing it out to logfile?
+ if(.NOT.LPRIM_OPEN) then
+C...Open new dump file, or overwrite existing one
+ open(NPRIM_UNIT,file='xplot11_logfile',form='UNFORMATTED',
+ & status='UNKNOWN',err=10)
+ rewind(NPRIM_UNIT)
+ LPRIM_OPEN = .TRUE.
+ N_WRIT = 0
+ endif
+C
+C...Append in-core save arrays to disk file
+C first record is number of elements in this save block,
+C second record is integer type and integer value arrays,
+C third record is x,y value arrays
+ write(NPRIM_UNIT) Nstore_max
+ call wr_array(NPRIM_UNIT,Nstore_max,I_TYP,I_PRIM,X_PRIM,Y_PRIM)
+ N_WRIT = N_WRIT + Nstore_max
+C...incore index is rolled over to 0 and resumes counting up as index
+C in the save arrays
+ incore = 0
+ endif
+C
+ N_PRIM = N_PRIM + 1
+ incore = incore + 1
+C
+ I_TYP (incore) = ityp
+ I_PRIM(incore) = ival
+ X_PRIM(incore) = xval
+ Y_PRIM(incore) = yval
+C
+ return
+C
+ 10 write(*,*) '*** Open error on xplot11_logfile, logging disabled'
+C...This will disable future logging (see first statement above)
+ N_PRIM = Nstore_max + 1
+ return
+ end
+
+
+ subroutine getprim(icount,ityp,ival,xval,yval)
+C...Gets plot primitive from saved plot array or from log file
+C
+C Input: icount integer giving primitive count
+C icount<=0 as input indicates restart on prims
+C list, rewind external prim file, if used
+C Output: icount is incremented each fetch until the prims
+C list is exhausted, then icount is returned as -1 to
+C signal that no more prims are available
+C
+ include 'pltlib.inc'
+ SAVE incore
+C
+ if(icount.LT.0) THEN
+C...primitives-fetching is to be restarted from beginning
+C
+ if(LPRIM_OPEN) then
+ if(N_WRIT .lt. N_PRIM) then
+C...append rest of save arrays to disk, so arrays can be used as i/o buffers
+ imax = N_PRIM - N_WRIT
+ write(NPRIM_UNIT) imax
+ call wr_array(NPRIM_UNIT,imax,I_TYP,I_PRIM,X_PRIM,Y_PRIM)
+ N_WRIT = N_WRIT + imax
+ endif
+ rewind(NPRIM_UNIT)
+C...now read a buffer of stored prims
+ read(NPRIM_UNIT,err=10) imax
+ call rd_array(NPRIM_UNIT,imax,I_TYP,I_PRIM,X_PRIM,Y_PRIM)
+ ELSE
+C...No prim file used initialize incore to total # of prims
+ imax = N_PRIM
+ endif
+ N_INCORE = imax
+ incore = 0
+ icount = 0
+C
+ elseif(icount.EQ.N_PRIM) THEN
+C...no more primitives are available
+ icount = -1
+ return
+ endif
+C
+C...Note: icount has the same meaning as N_PRIM in putprim
+C... incore has the same meaning as incore in putprim
+C
+ if(incore.EQ.N_INCORE .AND. icount.ne.0) then
+ if(LPRIM_OPEN) then
+C...Read next chunk of primitives from file if opened
+ read(NPRIM_UNIT,err=10) imax
+ call rd_array(NPRIM_UNIT,imax,I_TYP,I_PRIM,X_PRIM,Y_PRIM)
+ N_INCORE = imax
+ incore = 0
+ else
+C...Shouldn't get to here if all went OK.
+ write(*,*) 'Xplot11: Cannot read log file.'
+ icount = -1
+ return
+ endif
+ endif
+C
+C...Set the values for returning
+ icount = icount + 1
+ incore = incore + 1
+ ityp = I_TYP (incore)
+ ival = I_PRIM(incore)
+ xval = X_PRIM(incore)
+ yval = Y_PRIM(incore)
+C
+ return
+C
+ 10 write(*,*) '? Xplot11: Error on reading log file.'
+ return
+ end
+
+
+ subroutine rd_array(lunit,n,ityp,iprim,xprim,yprim)
+c--- Fast unformatted reading of 2 integer and 2 real arrays from log file
+ dimension ityp(n), iprim(n),
+ & xprim(n), yprim(n)
+ read(lunit,err=10) ityp,iprim
+ read(lunit,err=10) xprim,yprim
+ go to 20
+ 10 write(*,*) '? Xplot11: Error on reading log file.'
+ 20 return
+ end
+
+
+ subroutine wr_array(lunit,n,ityp,iprim,xprim,yprim)
+c--- Fast unformatted writing of 2 integer and 2 real arrays to log file
+ dimension ityp(n), iprim(n),
+ & xprim(n), yprim(n)
+ write(lunit) ityp,iprim
+ write(lunit) xprim,yprim
+ return
+ end
+
+
+ subroutine set_clip(XMIN,YMIN,XMAX,YMAX)
+ include 'pltlib.inc'
+C
+C... clip to at least window limits
+ CLP_XMIN = MAX( XMIN , 0.0 )
+ CLP_YMIN = MAX( YMIN , 0.0 )
+ CLP_XMAX = MIN( XMAX , X_PAGE )
+ CLP_YMAX = MIN( YMAX , Y_PAGE )
+C
+ return
+ end
+
+
+
+ subroutine plot_1(X,Y,icode)
+C...Processing routine for internal plotting calls, absolute coordinates
+C
+C X,Y absolute coordinates
+C icode function code (integer)
+C
+C 3 move to X,Y (move in absolute coordinates)
+C 2 line to X,Y (line in absolute coordinates)
+C
+C -2 line to X,Y (line and re-origin in absolute coordinates)
+C -3 move to X,Y (move and re-origin in absolute coordinates)
+C
+ include 'pltlib.inc'
+ logical LCODE_OK
+C
+ icabs = abs(icode)
+ LCODE_OK = (icabs.EQ.2 .OR. icabs.EQ.3)
+C
+ if(.NOT. LCODE_OK) then
+ write(*,*) 'PLOTABS_1: unknown function code ',icode
+ write(*,*) ' at point X,Y =',X,Y
+ return
+ endif
+C
+C...use absolute coordinates to call device plotting
+ X1 = X_LST
+ Y1 = Y_LST
+ X2 = X
+ Y2 = Y
+C
+ if(icabs.eq.2) then
+C...make copy of vector for zoomed clipping
+ XX1 = X1
+ YY1 = Y1
+ XX2 = X2
+ YY2 = Y2
+C...clip vector to user plot limits (CLP_XMIN,CLP_XMAX,CLP_YMIN,CLP_YMAX)
+ call clip_ls(XX1,YY1,XX2,YY2,ivis)
+C
+ if(ivis.NE.0) then
+C...check for change in pen, line pattern or color
+ if(I_PEN.NE.LST_PEN) call set_pen(I_PEN)
+ if(I_PAT.NE.LST_PAT) call set_pat(I_PAT)
+ if(I_CLR.NE.LST_CLR) call set_color(I_CLR)
+C
+C...plot line segment in page coordinates
+ if(LGW_GEN) call gw_line(XX1,YY1,XX2,YY2)
+ if(LPS_GEN) call ps_line(XX1,YY1,XX2,YY2)
+ endif
+ endif
+C
+C...passed-in endpoint (absolute coordinates) now becomes "last" location
+ X_LST = X2
+ Y_LST = Y2
+C
+ if(icode.LT.0) then
+C...re-origin
+ X_ORG = X2
+ Y_ORG = Y2
+ endif
+C
+ return
+ end
+
+
+ subroutine clip_ls(X1,Y1,X2,Y2,ivis)
+C...Clips line segment against the clip window defined by
+C CLP_XMIN,CLP_XMAX,CLP_YMIN,CLP_YMAX returning visibility flag ivis.
+C ivis=0 for no visible line segment
+C ivis=1 for a visible line segment
+C
+ include 'pltlib.inc'
+ integer iclip_1
+C
+C... clip to zoomed clipping window or page limits
+ CLPXMIN = MAX( X_ABS2ZM(CLP_XMIN) , 0.0 )
+ CLPYMIN = MAX( Y_ABS2ZM(CLP_YMIN) , 0.0 )
+ CLPXMAX = MIN( X_ABS2ZM(CLP_XMAX) , X_PAGE )
+ CLPYMAX = MIN( Y_ABS2ZM(CLP_YMAX) , Y_PAGE )
+C
+C... zoomed coordinates for clipping
+ X1 = X_ABS2ZM(X1)
+ Y1 = Y_ABS2ZM(Y1)
+ X2 = X_ABS2ZM(X2)
+ Y2 = Y_ABS2ZM(Y2)
+C
+ ivis = 0
+ if(iclip_1(X1,Y1,X2,Y2,CLPXMIN, 1.).eq.0) return
+ if(iclip_1(Y1,X1,Y2,X2,CLPYMIN, 1.).eq.0) return
+ if(iclip_1(X1,Y1,X2,Y2,CLPXMAX,-1.).eq.0) return
+ if(iclip_1(Y1,X1,Y2,X2,CLPYMAX,-1.).eq.0) return
+ ivis = 1
+ return
+ end
+
+
+ integer function iclip_1(x1,y1,x2,y2,xlim,dir)
+C...Basic line clipping, clips line segment against line x=xlim
+C with visible side determined by dir (+1. or -1.)
+C dir=+1. x>xlim is visible
+C dir=-1 x<xlim is visible
+C
+ iclip_1 = 0
+ d1 = dir*(x1-xlim)
+ d2 = dir*(x2-xlim)
+ if(d1.EQ.0. .AND. d2.EQ.0.) return
+C
+ if(d1.GE.0. .OR. d2.GE.0.) then
+ iclip_1 = 1
+ if(d1*d2 .LE. 0.) then
+ dy = y2-y1
+ d12 = d1-d2
+ if(d1 .LT. 0.) then
+ x1 = xlim
+ y1 = y1 + dy*d1/d12
+ endif
+ if(d2 .LT. 0.) then
+ x2 = xlim
+ y2 = y2 + dy*d2/d12
+ endif
+ endif
+ endif
+ return
+ end
+
+
+ subroutine polyline_1(X,Y,n,ifill)
+C...Processing routine for polyline calls, inputs in absolute coordinates
+C X,Y coordinate arrays in absolute units
+C n number of x,y points
+C ifill fill flag, 0 for no fill, 1 for filled polygon
+C
+ include 'pltlib.inc'
+ dimension X(n), Y(n)
+ dimension XZ(MaxPolyLine), YZ(MaxPolyLine)
+ dimension XOUT(MaxPolyLine), YOUT(MaxPolyLine)
+ dimension XCLP(5), YCLP(5)
+C
+C...For unfilled polyline treat this as a set of standard line segments
+C This avoids putting an unfilled polyline into the more complex filled
+C polyline clipper.
+ if(ifill.LE.0) then
+ if(n.gt.1) then
+ call plot_1(X(1),Y(1),3)
+ do i = 2, n
+ call plot_1(X(i),Y(i),2)
+ end do
+ endif
+ return
+ endif
+C
+ if(n.GT.MaxPolyLine) then
+ write(*,*) 'polyline_1: array overflow. Increase MaxPolyline.'
+ return
+ endif
+C
+ if(n.LE.1) return
+C
+C...save last point for next draw command, just in case
+ X_LST = X(n)
+ Y_LST = Y(n)
+C
+C...convert to absolute, zoomed coordinates, check for bounding box
+ XZ(1) = X_ABS2ZM(X(1))
+ YZ(1) = Y_ABS2ZM(Y(1))
+ xbbmin = XZ(1)
+ ybbmin = YZ(1)
+ xbbmax = xbbmin
+ ybbmax = ybbmin
+ do i=2, n
+ XZ(i) = X_ABS2ZM(X(i))
+ YZ(i) = Y_ABS2ZM(Y(i))
+ IF(XZ(i).LT.xbbmin) xbbmin = XZ(i)
+ IF(YZ(i).LT.ybbmin) ybbmin = YZ(i)
+ IF(XZ(i).GT.xbbmax) xbbmax = XZ(i)
+ IF(YZ(i).GT.ybbmax) ybbmax = YZ(i)
+ end do
+ NZ = n
+C
+C...Clip to zoomed clipping window or page limits
+ CLPXMIN = MAX( X_ABS2ZM(CLP_XMIN) , 0.0 )
+ CLPYMIN = MAX( Y_ABS2ZM(CLP_YMIN) , 0.0 )
+ CLPXMAX = MIN( X_ABS2ZM(CLP_XMAX) , X_PAGE )
+ CLPYMAX = MIN( Y_ABS2ZM(CLP_YMAX) , Y_PAGE )
+C
+C...Check for polygon outside clipping window, skip plotting
+ if((xbbmin.GT.CLPXMAX) .OR.
+ & (xbbmax.LT.CLPXMIN) .OR.
+ & (ybbmin.GT.CLPYMAX) .OR.
+ & (ybbmax.LT.CLPYMIN) ) RETURN
+C
+C...Is polygon fully inside clipping window?
+ if((xbbmax.GT.CLPXMAX) .OR.
+ & (xbbmin.LT.CLPXMIN) .OR.
+ & (xbbmax.GT.CLPYMAX) .OR.
+ & (ybbmin.LT.CLPYMIN) ) then
+c
+C...If polygon is not fully inside clipping window, clip it.
+C Get window vertices of clipping window assembled as a polygon,
+C these must be in clockwise order to clip inside the window
+ XCLP(1) = CLPXMIN
+ YCLP(1) = CLPYMIN
+ XCLP(2) = CLPXMIN
+ YCLP(2) = CLPYMAX
+ XCLP(3) = CLPXMAX
+ YCLP(3) = CLPYMAX
+ XCLP(4) = CLPXMAX
+ YCLP(4) = CLPYMIN
+ XCLP(5) = CLPXMIN
+ YCLP(5) = CLPYMIN
+ nclp = 5
+C...use special clipping for polylines that returns a clipped polyline
+ call clip_poly0(XZ,YZ,NZ,XCLP,YCLP,nclp,XOUT,YOUT,nout)
+c
+C...Or if fully inside clip box, just plot the polyline as it is..
+ else
+ do i = 1, NZ
+ XOUT(i) = XZ(i)
+ YOUT(i) = YZ(i)
+ end do
+ nout = NZ
+ endif
+c
+ if(nout.GT.1) then
+C...check for change in pen, line pattern or color
+ if(I_PEN.NE.LST_PEN) call set_pen(I_PEN)
+ if(I_PAT.NE.LST_PAT) call set_pat(I_PAT)
+ if(I_CLR.NE.LST_CLR) call set_color(I_CLR)
+C...plot polyline in page coordinates
+ if(LGW_GEN) call gw_polyline(XOUT,YOUT,nout,ifill)
+ if(LPS_GEN) call ps_polyline(XOUT,YOUT,nout,ifill)
+ endif
+ return
+ end
+
+
+
+ subroutine clip_poly0(xp,yp,np,xclp,yclp,nclp,xout,yout,nout)
+C...Clips polyline xx,yy,nn against the clip window defined by
+C xclp,yclp,nclp with output clipped polyline in xout,yout,nout
+C
+C Clipping algorithm is a Sutherland-Hodgman clipper, implemented here
+C as a recursive (in Fortran!!) routine that clips each vertex in order
+C against each of the window edges.
+C
+ dimension xp(np), yp(np),
+ & xclp(nclp), yclp(nclp),
+ & xout(nout), yout(nout)
+ dimension xfrst(5), yfrst(5),
+ & xlst(5), ylst(5), ivis(5)
+C
+ do n = 1, nclp
+ ivis(n) = -1
+ end do
+ nout = 0
+ nlvl = 0
+ ilast = 0
+c
+C--- Feed the polyline points through the clipper point by point
+ do n = 1, np
+ x = xp(n)
+ y = yp(n)
+ call clip_poly1(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+ end do
+C... Now do finish the clipping with a final call with last flag set
+ ilast = 1
+ call clip_poly1(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+c
+ return
+ end
+
+
+ subroutine clip_poly1(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+C...Clipping routine for polylines clipped by polyline xclp,yclp,nclp
+C This routine is a recursive (via a faked-out call of clip_poly2)
+C
+ logical intsct
+ dimension xclp(nclp), yclp(nclp),
+ & xout(nout), yout(nout)
+ dimension xfrst(5), yfrst(5),
+ & xlst(5), ylst(5), ivis(5)
+C
+C... Check for end of clipping process (ilast>0)
+ if(nlvl.GE.nclp-1) THEN
+ if(ilast.LE.0) then
+ nout = nout + 1
+ xout(nout) = x
+ yout(nout) = y
+c write(*,*) 'out ',nout,x,y
+ endif
+ return
+ endif
+C... Set clipping edge (same as recursion depth)
+ nlvl = nlvl + 1
+c
+C... Check for closing flag (ilast=1)
+C Use first point as last vertex
+ if(ilast.gt.0) then
+ x = xfrst(nlvl)
+ y = yfrst(nlvl)
+ endif
+c
+C... Check point visibility
+ x1 = xclp(nlvl)
+ y1 = yclp(nlvl)
+ dx = xclp(nlvl+1) - x1
+ dy = yclp(nlvl+1) - y1
+ d2 = dy*(x-x1) - dx*(y-y1)
+ ivisp = 0
+ if(d2.GT.0.0) ivisp = 1
+c
+C... Check for intersection, save first point in this level if ivis=-1
+ intsct = .FALSE.
+ if(ivis(nlvl).LT.0) then
+ xfrst(nlvl) = x
+ yfrst(nlvl) = y
+ go to 20
+ endif
+ if (ivisp+ivis(nlvl).EQ.1) then
+ d1 = dy*(xlst(nlvl)-x1) - dx*(ylst(nlvl)-y1)
+ if((d1-d2).NE.0.) then
+ intsct = .TRUE.
+ frac = d1/(d1-d2)
+ xint = xlst(nlvl) + frac*(x-xlst(nlvl))
+ yint = ylst(nlvl) + frac*(y-ylst(nlvl))
+ endif
+ endif
+c
+C... Save point for next call to this level
+C If the close level flag is set (ilast=1) save it in ivis
+ 20 xlst(nlvl) = x
+ ylst(nlvl) = y
+ ivis(nlvl) = ivisp
+ if(ilast.EQ.1) ivis(nlvl) = 2
+c
+C... Recurse to next level with intersection...
+ if(intsct) then
+ ilast = 0
+ x = xint
+ y = yint
+ call clip_poly2(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+ endif
+c
+C... Call next level with vertex (if visible) or to close next level
+ if(ivis(nlvl).GE.1) then
+ x = xlst(nlvl)
+ y = ylst(nlvl)
+ if(ivis(nlvl).EQ.2) ilast = 1
+ call clip_poly2(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+ endif
+c
+ nlvl = nlvl - 1
+ return
+ end
+
+
+ subroutine clip_poly2(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+C...Dummy calling routine to allow recursion of clip_poly1
+ dimension xclp(nclp), yclp(nclp),
+ & xout(nout), yout(nout)
+ dimension xfrst(5), yfrst(5),
+ & xlst(5), ylst(5), ivis(5)
+C
+ call clip_poly1(x,y,ilast,xclp,yclp,nclp,xout,yout,nout,
+ & xfrst,yfrst,xlst,ylst,ivis,nlvl)
+ return
+ end
+
+
+
+ subroutine set_zoom(XOFF_ZOOM,YOFF_ZOOM,XFAC_ZOOM,YFAC_ZOOM,
+ & LSAME,LCURS)
+ logical LSAME, LCURS
+ character chkey*1, line*80
+C---------------------------------------------------------------
+C Sets new zoom parameters from cursor or keyboard input.
+C
+C Input/ XOFF_ZOOM zoom offsets
+C output: YOFF_ZOOM
+C XFAC_ZOOM zoom scaling factors
+C YFAC_ZOOM
+C
+C Input: LSAME T if new zoom factors (XFAC,YFAC) must be the same
+C LSAME F if new zoom factor XFAC can be different than YFAC
+C LCURS T if input for zoom box comes from graphics input
+C LCURS F if input for zoom box comes from keyboard
+C---------------------------------------------------------------
+C
+ call GETWINSIZE(XSIZE,YSIZE)
+ call GETCOLORINDEX(icolsave)
+C--- Set zoom lines in default foreground color (black)
+ icol = 1
+C
+ write(*,*)
+ if(LCURS) then
+ write(*,*) 'Mark off corners of blowup area'
+ write(*,*) '(2 identical points default to current area)'
+ else
+ write(*,*) 'Enter x,y coordinates of blowup area corners'
+ write(*,*) '(2 identical points default to current area)'
+ write(*,*) '(default is user coords, use input "x y")'
+ write(*,*) '(to specify absolute coords, use input "abs x y")'
+ endif
+c
+C...Get first point
+ if(LCURS) then
+ call GETCURSORXYABS(XABS1,YABS1,chkey)
+ write(*,110) '1',XABS2usr(XABS1),YABS2usr(YABS1),XABS1,YABS1
+ else
+ 1 write(*,*) 'point 1: '
+ read(*,100,end=1) line
+ if(line.eq.' ') then
+ XABS1 = 0.
+ YABS1 = 0.
+ elseif(line(1:3).NE.'abs' .AND. line(1:3).NE.'ABS') then
+ read(line,*,err=1) x1, y1
+ XABS1 = xusr2ABS(x1)
+ YABS1 = yusr2ABS(y1)
+ else
+ read(line(4:80),*,err=1) XABS1, YABS1
+ endif
+ endif
+ XZ = X_ABS2ZM(XABS1)
+ YZ = Y_ABS2ZM(YABS1)
+C... Use direct plotting calls to Xwindow to put crosshairs on screen
+ call gw_color(icol)
+ call gw_line(XZ, 0.0, XZ, YSIZE)
+ call gw_line(0.0, YZ, XSIZE, YZ)
+ call gw_flush
+c
+C...Get second point
+ if(LCURS) then
+ call GETCURSORXYABS(XABS2,YABS2,chkey)
+ write(*,110) '2',XABS2usr(XABS2),YABS2usr(YABS2),XABS2,YABS2
+ else
+ 2 write(*,*) 'point 2: '
+ read(*,100,end=2) line
+ if(line.eq.' ') then
+ XABS2 = 0.
+ YABS2 = 0.
+ elseif(line(1:3).NE.'abs' .AND. line(1:3).NE.'ABS') then
+ read(line,*,err=2) x2, y2
+ XABS2 = xusr2ABS(x2)
+ YABS2 = yusr2ABS(y2)
+ else
+ read(line(4:80),*,err=2) XABS2, YABS2
+ endif
+ endif
+ XZ = X_ABS2ZM(XABS2)
+ YZ = Y_ABS2ZM(YABS2)
+C... Use direct plotting calls to Xwindow to put crosshairs on screen
+ call gw_line(XZ, 0.0, XZ, YSIZE)
+ call gw_line(0.0, YZ, XSIZE, YZ)
+ call gw_flush
+ call gw_color(icolsave)
+C
+C
+C... Skip zooming stuff if points are the same
+ if(XABS1.eq.XABS2 .and. YABS1.eq.YABS2) return
+c
+ XDIF = ABS(XABS2 - XABS1)
+ YDIF = ABS(YABS2 - YABS1)
+ if(XDIF.eq.0.0) XDIF = 0.0001*XSIZE
+ if(YDIF.eq.0.0) YDIF = 0.0001*YSIZE
+c
+ XOFF_ZOOM = -MIN(XABS1,XABS2)
+ YOFF_ZOOM = -MIN(YABS1,YABS2)
+ XFAC_ZOOM = XSIZE/XDIF
+ YFAC_ZOOM = YSIZE/YDIF
+c
+ if(LSAME) then
+C... set equal x,y zoom factors
+ fac = MIN(XFAC_ZOOM, YFAC_ZOOM)
+ XFAC_ZOOM = fac
+ YFAC_ZOOM = fac
+c
+C... re-center the zoom region
+ XOFF_ZOOM = XOFF_ZOOM + 0.5*(XSIZE/fac-XDIF)
+ YOFF_ZOOM = YOFF_ZOOM + 0.5*(YSIZE/fac-YDIF)
+ endif
+c
+ 100 format(a)
+ 110 format(' Pt ',a,2x,'usr x,y',2(2x,f11.6),3x,'abs X,Y',2(2x,f11.6))
+ return
+ end
+
+
+C***Zoom transformation functions - to and from absolute<->zoomed
+
+ function X_ABS2ZM(X)
+C...Converts absolute X to zoomed X'
+ include 'pltlib.inc'
+ X_ABS2ZM = XFAC_ZOOM*(X + XOFF_ZOOM)
+ return
+ end
+
+ function Y_ABS2ZM(Y)
+C...Converts absolute Y to zoomed Y'
+ include 'pltlib.inc'
+ Y_ABS2ZM = YFAC_ZOOM*(Y + YOFF_ZOOM)
+ return
+ end
+
+
+
+ function X_ZM2ABS(X)
+C...Converts zoomed X' to absolute X
+ include 'pltlib.inc'
+ X_ZM2ABS = X/XFAC_ZOOM - XOFF_ZOOM
+ return
+ end
+
+
+ function Y_ZM2ABS(Y)
+C...Converts zoomed Y' to absolute Y
+ include 'pltlib.inc'
+ Y_ZM2ABS = Y/YFAC_ZOOM - YOFF_ZOOM
+ return
+ end
+
+
+
+
+
+
+
+
diff --git a/plotlib/sym/Makefile b/plotlib/sym/Makefile
new file mode 100644
index 0000000..c5e1407
--- /dev/null
+++ b/plotlib/sym/Makefile
@@ -0,0 +1,65 @@
+#***********************************************************************
+# Module: Makefile (Xplot/sym directory)
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@mit.edu
+#***********************************************************************
+
+#Makefile for stroke font creation and editing programs
+
+FC = f77
+#FC = g77
+FFLAGS = -O1
+LIBS = ../libPlt.a -lX11
+
+PROGS = symgen test
+
+all: $(PROGS)
+
+clean:
+ -/bin/rm *.o
+ -/bin/rm *.a
+ -/bin/rm $(PROGS)
+
+
+symgen: symgen.o
+ $(FC) -o symgen symgen.o $(LIBS)
+
+symgen.o: symgen.f
+ $(FC) -c $(FFLAGS) symgen.f
+
+../plt_font.o: ../plt_font.f ../CHAR.INC ../SLAN.INC ../MATH.INC ../SYMB.INC
+ $(FC) -c $(FFLAGS) ../plt_font.f
+ mv ./plt_font.o ../
+
+
+
+test: test.o ../plt_font.o
+ $(FC) -o test test.o ../plt_font.o $(LIBS)
+
+test.o: test.f
+ $(FC) -c $(FFLAGS) test.f
+
+
+
+
+
+
+
+
diff --git a/plotlib/sym/Readme b/plotlib/sym/Readme
new file mode 100644
index 0000000..8a9409a
--- /dev/null
+++ b/plotlib/sym/Readme
@@ -0,0 +1,67 @@
+/***********************************************************************
+ Module: Readme
+
+ Copyright (C) 1996 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.com
+ or drela@mit.edu
+***********************************************************************/
+
+
+This directory contains programs and routines for creating,
+modifying, and using vector fonts.
+
+
+PROGRAM SYMGEN is an interactive program for creating or modifying
+font description files XXXX.FNT, and is invoked with
+
+ % make symgen (requires ../libPlt.a)
+ % symgen XXXX
+
+The header of symgen.f has a description of the format of
+a XXXX.FNT file, although this is of no concern to the user.
+SYMGEN can create an include file XXXX.INC which has the
+font encoding placed into Fortran DATA statements. XXXX.INC
+is then compiled with a Versaplot SYMBOL-type routine which
+is used in applications.
+
+Four sample databases, include files, and application routines
+already exist. The application routines are in ../plt_font.f:
+
+ CHAR.FNT CHAR.INC SUBR. PLCHAR (Upper,lower case letters, WYSIWYG)
+ SLAN.FNT SLAN.INC SUBR. PLSLAN (Upper,lower case slanted letters)
+ MATH.FNT MATH.INC SUBR. PLMATH (Latex-like Greek symbols, exponents)
+ SYMB.FNT SYMB.INC SUBR. PLSYMB (Versaplot plotting symbols)
+
+ also available: SUBR. PLNUMB (Whole floating-point numbers)
+
+One can generate analogous files and plot routines for any
+custom font, e.g.
+
+ USER.FNT USER.INC SUBR. PLUSER
+
+
+PROGRAM TEST plots the complete CHAR, SLAN, MATH, and SYMB fonts,
+and also plots sample character strings for examination.
+
+ % make test
+ % test
+
+Mark Drela
+10 March 96
+
+
diff --git a/plotlib/sym/char.fnt b/plotlib/sym/char.fnt
new file mode 100644
index 0000000..bbebaa2
--- /dev/null
+++ b/plotlib/sym/char.fnt
@@ -0,0 +1,93 @@
+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~
+ 21616 11672 12183 12888 14488 15183 15672 15616 21650 15650 0 0 0 0 0 0 0 0 0 0
+ 21616 11688 14288 15284 15676 15668 15260 14256 15252 15644 15628 15220 14216 11616 21656 14256 0 0 0 0
+ 25674 15183 14488 12888 12183 11672 11632 12121 12816 14416 15121 15629 0 0 0 0 0 0 0 0
+ 21416 14416 15121 15632 15672 15183 14488 11488 21816 11888 0 0 0 0 0 0 0 0 0 0
+ 25616 11616 11688 15688 21656 14756 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 11688 15688 21656 14656 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 25674 15183 14488 12888 12183 11672 11632 12121 12816 14416 15121 15632 15650 14050 0 0 0 0 0 0
+ 21616 11688 25616 15688 21656 15656 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23888 13816 22616 15016 22688 15088 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21430 11921 12616 13916 14621 15132 15188 25788 13688 0 0 0 0 0 0 0 0 0 0 0
+ 21688 11616 25688 11645 22858 15616 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22088 12016 16016 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21416 11488 13648 15888 15816 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 11688 15616 15688 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21632 11672 12183 12888 14488 15183 15672 15632 15121 14416 12816 12121 11632 0 0 0 0 0 0 0
+ 21616 11688 14288 15283 15676 15662 15255 14250 11650 0 0 0 0 0 0 0 0 0 0 0
+ 21632 11672 12183 12888 14488 15183 15672 15632 15121 14416 12816 12121 11632 24131 15616 0 0 0 0 0
+ 21616 11688 14288 15283 15676 15662 15255 14250 11650 24250 15816 0 0 0 0 0 0 0 0 0
+ 25676 15183 14288 13088 12183 11674 11670 12161 13056 14256 15151 15642 15630 15121 14216 13016 12121 11630 0 0
+ 23688 13616 21488 15888 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21688 11632 12121 12816 14416 15121 15632 15688 0 0 0 0 0 0 0 0 0 0 0 0
+ 21688 11682 13616 15682 15688 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21488 11452 11639 12516 13437 13646 13837 14716 15639 15852 15888 23646 13654 0 0 0 0 0 0 0
+ 21688 11682 15622 15616 25688 15682 11622 11616 0 0 0 0 0 0 0 0 0 0 0 0
+ 21688 11682 13656 15682 15688 23656 13616 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21688 15688 11616 15616 22756 14556 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22064 14264 15159 15650 15616 25642 12842 12038 11630 11628 12020 12816 14416 15220 15628 0 0 0 0 0
+ 21888 11816 21852 12260 13064 14664 15460 15852 15828 15420 14616 13016 12220 11828 0 0 0 0 0 0
+ 25652 15260 14464 12864 12060 11652 11628 12020 12816 14416 15220 15628 0 0 0 0 0 0 0 0
+ 25488 15416 25452 15060 14264 12664 11860 11452 11428 11820 12616 14216 15020 15428 0 0 0 0 0 0
+ 25626 15220 14416 12816 12020 11628 11652 12060 12864 14464 15260 15652 15641 11641 0 0 0 0 0 0
+ 26072 15680 14884 13684 12880 12472 12416 21656 14256 0 0 0 0 0 0 0 0 0 0 0
+ 21616 12008 12804 14404 15208 15616 15664 25652 15260 14464 12864 12060 11652 11637 12029 12825 14425 15229 15637 0
+ 21688 11616 21652 12060 12864 14464 15260 15652 15616 0 0 0 0 0 0 0 0 0 0 0
+ 22416 15216 24016 14062 12962 23377 13380 13582 13882 14080 14077 13875 13575 13377 0 0 0 0 0 0
+ 21416 11808 12604 13804 14608 15016 15062 13862 24375 14177 14180 14382 14682 14880 14877 14675 14375 0 0 0
+ 21888 11816 21844 15268 22750 15816 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22316 14916 23616 13688 12788 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21464 11416 21453 11760 12364 12764 13360 13653 13960 14564 14964 15560 15853 15816 23653 13624 0 0 0 0
+ 21664 11616 21652 12060 12864 14464 15260 15652 15616 0 0 0 0 0 0 0 0 0 0 0
+ 21628 11652 12060 12864 14464 15260 15652 15628 15220 14416 12816 12020 11628 0 0 0 0 0 0 0
+ 21864 11800 21852 12260 13064 14664 15460 15852 15836 15428 14624 13024 12228 11836 0 0 0 0 0 0
+ 25464 15400 25452 15060 14264 12664 11860 11452 11436 11828 12624 14224 15028 15436 0 0 0 0 0 0
+ 22064 12016 22052 12460 13264 14664 15460 15852 0 0 0 0 0 0 0 0 0 0 0 0
+ 25656 15361 14664 12664 11961 11654 11651 11945 12641 14641 15337 15631 15626 15319 14616 12616 11919 11624 0 0
+ 22484 12428 12820 13616 14816 15620 16028 21666 14266 0 0 0 0 0 0 0 0 0 0 0
+ 21664 11628 12020 12816 14416 15220 15628 25664 15616 0 0 0 0 0 0 0 0 0 0 0
+ 21664 11657 11849 13616 15449 15657 15664 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21464 11440 11630 12516 13429 13636 13829 14716 15630 15840 15864 23636 13642 0 0 0 0 0 0 0
+ 21864 15616 25464 11616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21664 11637 12029 12825 14425 15229 15637 25664 15616 15208 14404 12804 12008 11616 0 0 0 0 0 0
+ 21864 15464 11616 15616 22742 14442 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21628 11676 12084 12888 14488 15284 15676 15628 15220 14416 12816 12020 11628 0 0 0 0 0 0 0
+ 22678 13688 13616 22616 14616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21676 12084 12888 14488 15284 15676 15666 15258 12036 11628 11616 15616 0 0 0 0 0 0 0 0
+ 21878 12284 13088 14488 15284 15676 15669 15261 14457 15253 15644 15628 15220 14416 12816 12020 11626 24457 12857 0
+ 25088 15016 24016 16016 26040 11640 11688 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 25488 11688 11657 14457 15253 15645 15628 15220 14416 12816 12020 11628 0 0 0 0 0 0 0 0
+ 25678 15284 14488 12888 12084 11676 11628 12020 12816 14416 15220 15628 15645 15253 14457 12857 12053 11645 0 0
+ 21688 15688 15679 13228 13216 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24757 12557 11667 11676 12084 12888 14488 15284 15676 15667 14757 15647 15628 15220 14416 12816 12020 11628 11647 12557
+ 21626 12020 12816 14416 15220 15628 15676 15284 14488 12888 12084 11676 11659 12051 12847 14447 15251 15659 0 0
+ 22604 13416 13424 12624 12616 13215 12604 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22624 13424 13416 12616 12624 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22604 13215 12616 12624 13424 13416 12604 22656 12648 13448 13456 12656 0 0 0 0 0 0 0 0
+ 22624 12616 13416 13424 12624 22656 12648 13448 13456 12656 0 0 0 0 0 0 0 0 0 0
+ 25284 16268 15884 15284 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22184 12666 12784 12184 23784 14266 14384 13784 0 0 0 0 0 0 0 0 0 0 0 0
+ 23524 13316 13916 13724 13524 23639 14088 13288 13639 23685 13646 0 0 0 0 0 0 0 0 0
+ 22074 12283 13088 14288 15083 15274 14866 14160 13754 13647 13639 23524 13316 13916 13724 13524 0 0 0 0
+ 24543 13738 12843 12854 13761 14758 14543 14939 15439 15949 15865 15075 13877 12674 11863 11647 11931 13222 14422 15627
+ 23278 12622 24778 14122 21959 15759 21640 15440 0 0 0 0 0 0 0 0 0 0 0 0
+ 25176 12976 12273 11967 11959 12254 12852 14452 15050 15445 15437 15031 14328 12128 23616 13688 0 0 0 0
+ 21616 15688 22488 12084 12079 12475 12975 13379 13384 12988 12488 25116 15520 15525 15129 14629 14225 14220 14616 15116
+ 25636 15023 14418 13716 12816 12021 11629 11637 12246 13956 14564 14572 14377 13880 13280 12677 12469 12758 15616 0
+ 23696 13608 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 25092 14382 13965 13850 13935 14318 15008 24417 14230 14150 14270 14483 0 0 0 0 0 0 0 0
+ 22292 12982 13365 13450 13335 12918 12208 22883 13070 13150 13030 12817 0 0 0 0 0 0 0 0
+ 25294 13894 13806 15206 24094 14006 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22094 13494 13406 12006 23294 13206 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24896 13890 13853 12850 13846 13810 14804 24009 14045 13846 24091 14054 13853 0 0 0 0 0 0 0
+ 22496 13490 13453 14450 13446 13410 12304 23209 13245 13446 23291 13254 13453 0 0 0 0 0 0 0
+ 25666 11648 15630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21666 15648 11630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 20800 17200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21648 15648 23668 13628 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21648 15648 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22765 14531 22731 14565 21748 15548 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21656 15656 21640 15640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21208 16096 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21854 13868 15854 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21546 11951 12754 13452 14344 14942 15745 16150 0 0 0 0 0 0 0 0 0 0 0 0
diff --git a/plotlib/sym/math.fnt b/plotlib/sym/math.fnt
new file mode 100644
index 0000000..8e551c0
--- /dev/null
+++ b/plotlib/sym/math.fnt
@@ -0,0 +1,93 @@
+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21688 12488 25288 16088 21616 12416 25216 16016 22016 15688 21988 15516 22188 15716 0 0 0 0 0 0
+ 21216 13988 16416 11216 21318 16118 13884 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22816 14816 22888 14888 23788 13716 23988 13916 22575 11461 11443 12529 15129 16243 16261 15175 12575 0 0 0
+ 25888 16180 16188 11688 22288 12216 22488 12416 21616 13016 0 0 0 0 0 0 0 0 0 0
+ 20490 11096 11064 21964 13196 23890 14396 15296 15691 15684 13871 13864 15664 0 0 0 0 0 0 0
+ 26694 16696 16396 16191 15982 15346 15014 14805 14600 14300 14302 25014 15754 15982 0 0 0 0 0 0
+ 26396 16196 15891 15573 14923 14605 14300 14100 24956 14552 14544 14940 15540 15944 15952 15556 14956 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21516 12616 24916 16116 21816 13888 15816 25616 13784 0 0 0 0 0 0 0 0 0 0 0
+ 22890 13396 13362 22962 13762 20479 12079 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24416 16769 12169 14416 26565 12565 14518 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 14067 16416 11616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22416 13216 24416 15216 22716 12788 22916 12988 24716 14788 24916 14988 21888 11683 11688 16088 16083 15888 0 0
+ 22716 14816 15933 15971 14888 12888 11771 11733 12716 23052 14652 23056 13048 24656 14648 21973 11931 25773 15731 0
+ 23058 13658 14507 16196 17296 23658 13858 14613 0 0 0 0 0 0 0 0 0 0 0 0
+ 25616 16125 16016 11616 14654 12088 21688 15988 16179 21688 14452 0 0 0 0 0 0 0 0 0
+ 21347 11755 12255 12451 12235 12422 12916 13816 14522 15134 15552 15670 15582 14888 13988 13484 13277 13468 14362 16153
+ 23016 14616 21674 11984 12588 13184 13766 13716 26074 15784 15188 14584 13966 13916 23184 13966 24584 13766 0 0
+ 22124 13642 14456 14870 14983 14888 14688 14486 14080 13670 13253 12935 12924 13118 13516 14216 15019 15926 0 0
+ 21522 11716 13016 11548 11567 12283 13188 14588 15483 16167 16148 14616 15916 16122 21976 11758 11940 25776 15958 15740
+ 21626 11716 15916 16026 21678 11788 15988 16078 22660 12644 25060 15044 22654 15054 22650 15050 21720 15920 21784 15984
+ 23088 14688 23016 14616 23788 13716 23988 13916 21474 11769 11842 13029 14629 15842 15969 16274 21769 12040 25969 15640
+ 22088 11680 11688 16088 11816 16016 16025 15616 21816 11616 15888 0 0 0 0 0 0 0 0 0
+ 26064 15554 14937 14323 13617 12916 12217 11722 11534 11746 12256 12962 13564 14064 14460 14750 14737 14919 15416 16120
+ 21508 12655 13276 13986 14688 15287 15682 15671 15161 14256 12757 24256 15449 15837 15626 14918 13816 13016 11820 0
+ 21504 15866 25504 15104 14709 14317 13349 12662 12266 11866 0 0 0 0 0 0 0 0 0 0
+ 25184 14987 14588 13888 13485 13177 13267 13861 14857 15345 15233 14722 13716 12816 11922 11734 12150 12857 13861 0
+ 25559 14664 13764 12760 12052 11739 11729 12220 13116 14116 15220 21842 14142 0 0 0 0 0 0 0
+ 21645 12057 12863 13864 14962 15556 15744 15332 14427 13326 12427 11733 11645 23004 14388 0 0 0 0 0
+ 21557 12164 12867 13662 14246 14325 14113 13804 13500 13305 13416 13932 14950 16063 0 0 0 0 0 0
+ 21759 11962 12264 12563 12661 12755 11916 22755 13360 14164 14864 15361 15556 15546 14804 0 0 0 0 0
+ 23164 12424 12618 13016 14116 15018 15724 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22666 12060 11751 11740 12232 13329 14329 15333 15841 16049 15958 15662 15064 14564 14160 13747 13004 0 0 0
+ 22464 11616 25764 15264 14862 13448 12037 22843 13924 14218 14616 15116 0 0 0 0 0 0 0 0
+ 22788 13288 13685 14074 14627 15018 15316 15716 21316 14256 0 0 0 0 0 0 0 0 0 0
+ 22764 11600 22130 12122 12517 12916 13716 14418 14922 15664 24922 15017 15316 15616 0 0 0 0 0 0
+ 22064 12364 12562 12645 12631 12416 13825 15037 15753 15759 15662 15564 15264 0 0 0 0 0 0 0
+ 21641 12052 12962 13964 15062 15651 15641 15428 14418 13316 12119 11628 11641 0 0 0 0 0 0 0
+ 21559 11963 12566 15966 23266 12216 24766 14444 14430 14716 0 0 0 0 0 0 0 0 0 0
+ 25554 12154 12469 12779 13285 13988 14788 15285 15579 15669 15554 15236 14824 14319 13816 13016 12519 12224 12036 12154
+ 21500 12244 12655 13161 13864 14764 15460 15752 15640 15330 14223 13022 11923 0 0 0 0 0 0 0
+ 26264 13964 12962 12052 11641 11628 12119 13316 14418 15428 15641 15551 14961 13763 0 0 0 0 0 0
+ 21655 12061 12764 15964 23864 13016 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21958 12162 12464 12663 12658 12239 12224 12716 13716 14521 15333 15645 15657 15463 15164 0 0 0 0 0
+ 25660 14964 14264 13464 12761 12254 12147 12542 11936 11728 12020 12816 13816 14618 15321 22542 14042 0 0 0
+ 22764 12056 11645 11432 11621 12116 12716 13320 13816 14416 15120 15731 15942 15953 15564 23320 13740 0 0 0
+ 25386 14086 12977 12765 13357 14457 23357 12044 11733 12023 13317 15016 15213 14810 24086 13392 0 0 0 0
+ 21865 12163 12357 11947 11736 12025 12822 14222 15228 15938 16051 15865 23004 14388 0 0 0 0 0 0
+ 25482 14482 13473 12560 11942 11931 12422 13617 15016 15314 14809 23990 14482 0 0 0 0 0 0 0
+ 21272 11864 13064 13672 13688 13096 11896 11288 11272 0 0 0 0 0 0 0 0 0 0 0
+ 21687 12496 12460 21660 13260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21290 11896 13196 13690 13683 11268 11260 13660 0 0 0 0 0 0 0 0 0 0 0 0
+ 21391 11896 13196 13691 13684 13179 12079 23179 13674 13666 13060 11860 11266 0 0 0 0 0 0 0
+ 21296 11271 13771 23296 13260 22860 13560 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23696 11296 11280 13180 13675 13666 13060 11860 11266 0 0 0 0 0 0 0 0 0 0 0
+ 23691 13196 11896 11290 11266 11860 13060 13666 13675 13279 11679 11275 0 0 0 0 0 0 0 0
+ 21296 13696 13692 12268 12260 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21779 11284 11291 11796 13196 13691 13684 13179 13675 13665 13060 11860 11265 11275 11779 13179 0 0 0 0
+ 23682 13177 11777 11282 11290 11896 13096 13690 13666 13060 11860 11266 0 0 0 0 0 0 0 0
+ 22604 13215 12616 12624 13424 13416 12604 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22624 12616 13416 13424 12624 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21620 11616 12016 12020 11620 23820 13816 14216 14220 13820 26020 16016 16416 16420 16020 0 0 0 0 0
+ 21466 11890 12590 11466 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22696 13496 14092 14486 14478 14072 13468 12668 12072 11678 11686 12092 12696 0 0 0 0 0 0 0
+ 23130 12822 13622 13530 13130 23441 13588 14488 13441 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22064 15232 22032 15264 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23775 14380 15480 16075 16365 16242 15826 15016 13716 13021 12834 13245 14153 15053 16249 0 0 0 0 0
+ 21648 15648 23464 13460 13860 13864 13464 23436 13432 13832 13836 13436 0 0 0 0 0 0 0 0
+ 22001 11201 10708 10716 11223 12023 13601 14401 14908 14916 14423 13623 12001 0 0 0 0 0 0 0
+ 23696 13608 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24872 14159 13941 14121 14808 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22472 13159 13340 13121 12408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24266 11648 14230 26066 13448 16030 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21666 14248 11630 23466 16048 13430 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 27280 14016 17216 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22282 15482 24882 14786 15882 14578 14882 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 20896 17296 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23668 13628 21648 15648 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21648 15648 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23146 13150 13453 13853 14150 14146 13843 13443 13146 23450 13846 23850 13446 0 0 0 0 0 0 0
+ 21656 15656 21640 15640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21208 16096 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22480 14088 15680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22480 12985 13685 14479 15179 15684 0 0 0 0 0 0 0 0 0 0 0 0 0 0
diff --git a/plotlib/sym/slan.fnt b/plotlib/sym/slan.fnt
new file mode 100644
index 0000000..2248f0d
--- /dev/null
+++ b/plotlib/sym/slan.fnt
@@ -0,0 +1,93 @@
+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~
+ 21616 12472 13183 13888 15488 16183 16472 15616 22150 16150 0 0 0 0 0 0 0 0 0 0
+ 21616 12688 15188 16184 16476 16368 15860 14856 15752 16044 15728 15220 14216 11616 22256 14856 0 0 0 0
+ 26474 16183 15488 13888 13183 12472 11832 12121 12816 14416 15121 15729 0 0 0 0 0 0 0 0
+ 21416 14416 15121 15832 16472 16183 15488 12488 21816 12888 0 0 0 0 0 0 0 0 0 0
+ 25616 11616 12688 16688 22256 15356 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 12688 16688 22256 15256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 26474 16183 15488 13888 13183 12472 11832 12121 12816 14416 15121 15832 16150 14550 0 0 0 0 0 0
+ 21616 12688 25616 16688 22256 16256 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24888 13816 22616 15016 23688 16088 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21630 11921 12616 13916 14621 15332 16188 26788 14688 0 0 0 0 0 0 0 0 0 0 0
+ 22688 11616 26688 12045 23458 15616 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23088 12016 16016 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21416 12488 14048 16888 15816 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 12688 15616 16688 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21832 12472 13183 13888 15488 16183 16472 15832 15121 14416 12816 12121 11832 0 0 0 0 0 0 0
+ 21616 12688 15188 16183 16476 16262 15755 14750 12150 0 0 0 0 0 0 0 0 0 0 0
+ 21832 12472 13183 13888 15488 16183 16472 15832 15121 14416 12816 12121 11832 24331 15616 0 0 0 0 0
+ 21616 12688 15188 16183 16476 16262 15755 14750 12150 24750 15816 0 0 0 0 0 0 0 0 0
+ 26576 16183 15288 14088 13183 12474 12470 12761 13656 14856 15651 15942 15830 15121 14216 13016 12121 11830 0 0
+ 24688 13616 22488 16888 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22688 11832 12121 12816 14416 15121 15832 16688 0 0 0 0 0 0 0 0 0 0 0 0
+ 22688 12582 13616 16582 16688 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22488 11952 11939 12516 13737 14046 14137 14716 15939 16352 16888 24046 14154 0 0 0 0 0 0 0
+ 22688 12582 15622 15616 26688 16582 11622 11616 0 0 0 0 0 0 0 0 0 0 0 0
+ 22688 12582 14256 16582 16688 24256 13616 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22688 16688 11616 15616 23356 15156 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22764 14964 15759 16150 15616 25942 13142 12338 11730 11728 12020 12816 14416 15220 15728 0 0 0 0 0
+ 22888 11816 22352 12860 13764 15364 16060 16252 15928 15420 14616 13016 12220 12028 0 0 0 0 0 0
+ 26152 15860 15164 13564 12660 12152 11728 12020 12816 14416 15220 15728 0 0 0 0 0 0 0 0
+ 26488 15416 25952 15660 14964 13364 12460 11952 11528 11820 12616 14216 15020 15528 0 0 0 0 0 0
+ 25726 15220 14416 12816 12020 11728 12152 12660 13564 15164 15860 16152 15941 11941 0 0 0 0 0 0
+ 26872 16680 15884 14684 13880 13272 12416 22256 14856 0 0 0 0 0 0 0 0 0 0 0
+ 21616 11908 12704 14304 15108 15616 16364 26152 15860 15164 13564 12660 12152 11937 12129 12925 14525 15329 15937 0
+ 22688 11616 22152 12660 13564 15164 15860 16152 15616 0 0 0 0 0 0 0 0 0 0 0
+ 22416 15216 24016 14662 13562 24277 14280 14482 14782 14980 14977 14675 14375 14277 0 0 0 0 0 0
+ 21416 11708 12504 13704 14508 15016 15662 14462 25175 15077 15080 15282 15582 15780 15777 15475 15175 0 0 0
+ 22888 11816 22244 15968 23250 15816 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22316 14916 23616 14688 13788 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22164 11416 22053 12360 13064 13464 13960 14153 14560 15264 15664 16160 16353 15816 24153 13724 0 0 0 0
+ 22364 11616 22152 12660 13564 15164 15860 16152 15616 0 0 0 0 0 0 0 0 0 0 0
+ 21728 12152 12660 13564 15164 15860 16152 15728 15220 14416 12816 12020 11728 0 0 0 0 0 0 0
+ 22564 11600 22352 12860 13764 15364 16060 16352 16136 15528 14724 13124 12328 12136 0 0 0 0 0 0
+ 26164 15200 25952 15660 14964 13364 12460 11952 11736 11928 12724 14324 15128 15736 0 0 0 0 0 0
+ 22764 12016 22552 13060 13964 15364 16060 16352 0 0 0 0 0 0 0 0 0 0 0 0
+ 26256 15961 15364 13364 12661 12255 12151 12345 12941 14941 15637 15831 15726 15319 14616 12616 11919 11724 0 0
+ 23484 12528 12820 13616 14816 15620 16128 22366 14966 0 0 0 0 0 0 0 0 0 0 0
+ 22364 11728 12020 12816 14416 15220 15728 26364 15616 0 0 0 0 0 0 0 0 0 0 0
+ 22364 12154 13616 16154 16364 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22164 11840 11830 12516 13529 13936 14029 14716 15830 16140 16564 23936 14042 0 0 0 0 0 0 0
+ 22564 15616 26164 11616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22364 11937 12129 12925 14525 15329 15937 26364 15616 15108 14304 12704 11908 11616 0 0 0 0 0 0
+ 22564 16164 11616 15616 23042 14742 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21728 12576 13084 13888 15488 16284 16576 15728 15220 14416 12816 12020 11728 0 0 0 0 0 0 0
+ 23578 14688 13616 22616 14616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22576 13084 13888 15488 16284 16576 16466 15858 12336 11728 11616 15616 0 0 0 0 0 0 0 0
+ 22778 13284 14088 15488 16284 16576 16469 15861 15057 15753 16044 15728 15220 14416 12816 12020 11726 25057 13457 0
+ 26088 15016 24016 16016 26340 11940 12688 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 26488 12688 12257 15057 15753 16045 15728 15220 14416 12816 12020 11728 0 0 0 0 0 0 0 0
+ 26578 16284 15488 13888 13084 12576 11728 12020 12816 14416 15220 15728 16045 15753 15057 13457 12553 12045 0 0
+ 22688 16688 16579 13328 13216 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 25357 13157 12467 12576 13084 13888 15488 16284 16576 16367 15357 16047 15728 15220 14416 12816 12020 11728 12047 13157
+ 21726 12020 12816 14416 15220 15728 16576 16284 15488 13888 13084 12576 12259 12551 13247 14847 15751 16259 0 0
+ 22002 12916 13024 12224 12116 12515 12002 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22224 13024 12916 12116 12224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22002 12515 12116 12224 13024 12916 12002 22656 12548 13348 13456 12656 0 0 0 0 0 0 0 0
+ 22224 12116 12916 13024 12224 22656 12548 13348 13456 12656 0 0 0 0 0 0 0 0 0 0
+ 25784 16468 16384 15784 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22684 12866 13284 12684 24284 14466 14884 14284 0 0 0 0 0 0 0 0 0 0 0 0
+ 23124 12816 13416 13324 13124 23439 14588 13788 13439 24185 13546 0 0 0 0 0 0 0 0 0
+ 22374 12783 13588 14788 15583 15574 15066 14260 13754 13547 13439 23124 12816 13416 13324 13124 0 0 0 0
+ 24443 13538 12743 12854 13861 14858 14443 14739 15239 15849 16065 15375 14277 12974 12063 11547 11631 12722 13922 15227
+ 23678 12223 25178 13723 21859 15859 21440 15340 0 0 0 0 0 0 0 0 0 0 0 0
+ 25576 13376 12573 12167 12059 12254 12852 14452 15050 15345 15237 14731 13928 11728 23116 14188 0 0 0 0
+ 21116 16188 22888 12484 12479 12875 13375 13779 13784 13388 12888 24616 15020 15025 14629 14129 13725 13720 14116 14616
+ 25436 14623 13918 13216 12316 11521 11229 11437 12146 14056 14764 14872 14777 14280 13680 13077 12669 12858 15116 0
+ 23696 13608 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 26092 15282 14665 14350 14235 14418 14808 24515 14430 14650 15072 15485 0 0 0 0 0 0 0 0
+ 23492 13882 14065 13950 13635 13018 12208 23784 13870 13650 13229 12816 0 0 0 0 0 0 0 0
+ 25794 14494 13306 14606 24694 13506 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22794 14094 12906 11606 23894 12706 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 25696 14490 13853 12750 13746 13310 14304 23509 13945 13746 24691 14054 13853 0 0 0 0 0 0 0
+ 23096 14090 13453 14450 13346 12910 11804 22709 13145 13346 23890 13254 13453 0 0 0 0 0 0 0
+ 25866 11548 15330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21866 15548 11330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 20600 17000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21648 15648 23668 13628 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21648 15648 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22265 14031 22231 14065 21248 15048 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21656 15656 21640 15640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 20608 16696 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21634 15634 21648 15648 21662 15662 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21636 15636 21653 12059 12862 13459 13854 14452 15255 15661 0 0 0 0 0 0 0 0 0 0
diff --git a/plotlib/sym/symb.fnt b/plotlib/sym/symb.fnt
new file mode 100644
index 0000000..cfd8ec3
--- /dev/null
+++ b/plotlib/sym/symb.fnt
@@ -0,0 +1,15 @@
+0123456789ABCD
+ 24848 14880 18080 18016 11616 11680 14880 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24848 14880 16480 18064 18032 16416 13216 11632 11664 13280 14880 0 0 0 0 0 0 0 0 0
+ 24848 14886 18128 11528 14886 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24885 14811 21148 18548 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 22175 17521 22121 17575 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24848 14882 18248 14814 11448 14882 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24848 14868 18168 14810 11568 14868 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21669 14848 14810 24848 18069 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24886 14848 11627 24848 18027 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 23078 16618 23018 16678 21448 18248 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21866 17830 21830 17866 24882 14814 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21680 18016 11616 18080 11680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 21616 18080 18016 11680 11616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 24848 14859 11559 16917 14884 12717 18159 14859 0 0 0 0 0 0 0 0 0 0 0 0
diff --git a/plotlib/sym/symgen.f b/plotlib/sym/symgen.f
new file mode 100644
index 0000000..4b8f054
--- /dev/null
+++ b/plotlib/sym/symgen.f
@@ -0,0 +1,1179 @@
+C***********************************************************************
+C Module: symgen.f (part of font generation tools in Xplot/sym)
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ PROGRAM SYMGEN
+C------------------------------------------------------------------------
+C
+C Interactive program for creating and modifying vector fonts.
+C
+C
+C A font set is kept stored in a database file XXXX.FNT, which
+C is read in when the program is invoked with
+C
+C % symgen XXXX
+C
+C The first line of XXXX.FNT is a list of the defined characters.
+C Each subsequent line then defines one character in the list:
+C
+C ABCD...
+C 21616 12168 13280 ... <- definition for "A"
+C 21616 12280 14880 ... <- definition for "B"
+C .
+C .
+C
+C Each 5-digit number defines a vector node x,y location on a 96x96
+C grid, with 16,16 being the lower-left "origin" of the character.
+C See SUBR. SYMPLT header below for the encoding format.
+C If the numbers are zero or missing, then the font character
+C is not plotted (blank).
+C
+C Once the database has been edited, command "W" will generate
+C a Fortran INCLUDE file XXXX.INC, with the vector font information
+C placed in DATA statements. This is for use in a SYMBOL-type
+C routine to allow plotting of the font. Four sample databases,
+C include files, and routines already exist:
+C
+C CHAR.FNT CHAR.INC SUBR. PLCHAR (Upper,lower case letters)
+C SLAN.FNT SLAN.INC SUBR. PLSLAN (Slanted version of CHAR )
+C MATH.FNT MATH.INC SUBR. PLMATH (Latex-like Greek symbols)
+C SYMB.FNT SYMB.INC SUBR. PLSYMB (Versatec plotting symbols)
+C
+C also available: SUBR. PLNUMB (Whole floating-point numbers)
+C
+C SUBR. PLCHAR, PLSLAN, and PLMATH (in ../plt_font.f) are identical
+C except for their INCLUDE statements. One can generate analogous
+C files and plot routines for any custom font, e.g.
+C
+C USER.FNT USER.INC SUBR. PLUSER
+C
+C
+C SUBR. PLSYMB is nearly the same, except that it takes an integer
+C argument ISYM = 0,1... to select the symbol defined on line ISYM+1:
+C
+C ABCD...
+C 21616 12168 13280 ... <- definition for ISYM = 0
+C 21616 12280 14880 ... <- definition for ISYM = 1
+C .
+C .
+C The ASCII characters on the first line are ignored in PLSYMB.
+C
+C PLSYMB also shifts the symbol down and left by 1/2 the symbol
+C size, so the symbol is centered on 0,0. This duplicates the
+C Versatec SYMBOL routine. Note that PLSYMB can only plot one
+C symbol at a time.
+C
+C
+C WARNING: The CHAR font implemented in PLCHAR is assumed to be
+C a "WYSIWIG" font, in which each font character closely
+C represents its ASCII index character. It is used by
+C other libPlt routines (and also this program!), and
+C hence should not be significantly modified.
+C
+C
+C------------------------------------------------------------------------
+C
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+ INTEGER NODET(20)
+C
+ LOGICAL SAVED
+C
+ CHARACTER*80 ARGP1, STRING, RANGE
+C
+ CHARACTER*1 COPT, ANS, ALPH, ALPHO, ALPHT, KCHAR
+ LOGICAL LABORT, LDONE
+C
+ SIZE = 6.0
+ IDEV = 1
+ IPSLU = 0
+C
+ CH = 0.7
+ X0 = 0.0
+ Y0 = 0.0
+C
+ NCHARS = 0
+C
+C---- get the XXXX working set name
+ CALL GETARG(1,ARGP1)
+ CALL LOAD(ARGP1)
+C
+C---- initial overlay character, plot-test string
+ ALPHO = ' '
+ STRING = ' '
+C
+C---- initial target character is first one in database
+ ALPH = CHARS(1:1)
+ SAVED = .TRUE.
+C
+ CALL PLINITIALIZE
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+C
+ CALL GETCOLOR(ICOL0)
+C
+ 1000 FORMAT(A)
+C
+ 900 CONTINUE
+ WRITE(*,1005)
+ 1005 FORMAT(/' C hange target character'
+ & /' I nput target character vectors'
+ & /' M odify target character vectors'
+ & /' T ranslate target character'
+ & /' O verlay other character'
+ & /' L ean character(s)'
+ & /' P lot specified character string'
+ & /' A dd a new character to database'
+ & /' D elete a character from database'
+ & /' S ave database'
+ & /' W rite include file from current database'
+ & /' Z oom'
+ & /' U nzoom'
+ & /' Q uit')
+C
+ 910 WRITE(*,1015) ALPH
+ 1015 FORMAT(/' Select option ( target character = ',A1,' ): ', $)
+ READ(*,1000) COPT
+C
+ IF(INDEX('Qq',COPT).NE.0) THEN
+ IF(.NOT.SAVED) THEN
+ WRITE(*,*)
+ WRITE(*,*) 'Database not saved. Really quit ? N'
+ READ(*,1000) ANS
+ IF(INDEX('Yy',ANS) .EQ. 0) GO TO 900
+ ENDIF
+ CALL PLCLOSE
+ STOP
+ ENDIF
+C
+ NOPT = INDEX('CIMTOLPADSWZU',COPT) + INDEX('cimtolpadswzu',COPT)
+C
+ GOTO (10,20,30,40,50,60,70,80,90,100,110,120,130) NOPT
+ GOTO 900
+C
+C===========================================
+C---- select character
+ 10 CONTINUE
+ WRITE(*,1010) CHARS(1:NCHAR)
+ 1010 FORMAT(/1X,A,
+ & //1X,'Select new target character: ',$)
+ READ(*,1000) ALPH
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- input character
+ 20 CONTINUE
+C
+ KC = INDEX(CHARS,ALPH)
+ IF(KC.EQ.0) THEN
+ WRITE(*,*) 'Character is not in database.'
+ GO TO 900
+ ENDIF
+C
+C---- clear node-input buffer array
+ DO 201 K=1, 20
+ NODET(K) = 0
+ 201 CONTINUE
+C
+C
+C---- small node-select symbol size
+ CHS = 0.010*CH
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PABORT
+ CALL PDONE
+C
+ccc CALL PLCHAR(X0,Y0,CH,ALPH,0.0,1)
+C
+ CALL PLFLUSH
+C
+ WRITE(*,*)
+ WRITE(*,*) 'Input stroke points (double-click to end a stroke)...'
+C
+ ILAST = -999
+ JLAST = -999
+ ISTAT = 2
+C
+ DO 205 K=1, 20
+ 204 CALL GETCURSORXY(XC,YC,KCHAR)
+C
+C------ exit if clicked inside "ABORT" box
+ IF(LABORT(XC,YC)) THEN
+ WRITE(*,*) 'Database unchanged.'
+ GO TO 209
+ ENDIF
+C
+C------ finish up if clicked inside "DONE" box
+ IF(LDONE(XC,YC)) GO TO 206
+C
+C------ set integer coordinates and clip to within field
+ I = INT(64.0*(XC-X0)/CH + 16.5)
+ J = INT(64.0*(YC-Y0)/CH + 16.5)
+ I = MAX( 0 , MIN(I,96) )
+ J = MAX( 0 , MIN(J,96) )
+C
+ IF(ILAST.EQ.I .AND. JLAST.EQ.J) THEN
+ ISTAT = 2
+ ILAST = -999
+ JLAST = -999
+ WRITE(*,*) 'Will start new stroke...'
+ GO TO 204
+ ENDIF
+C
+ WRITE(*,1026) K, I, J
+ 1026 FORMAT(1X,' node',I3,': ', 2I5)
+C
+C------ set new node location in buffer array
+ NODET(K) = 10000*ISTAT + 100*I + J
+C
+C------ put small symbol over actual node location
+ XNODE = CH*FLOAT(I-16)/64.0
+ YNODE = CH*FLOAT(J-16)/64.0
+ IF(ILAST.EQ.-999 .OR. JLAST.EQ.-999) THEN
+ CALL PLOT(XNODE,YNODE,3)
+ ELSE
+ CALL PLOT(XNODE,YNODE,2)
+ ENDIF
+ CALL NEWCOLORNAME('orange')
+ CALL PLSYMB(XNODE,YNODE,CHS,1,0.0,0)
+ CALL NEWCOLOR(ICOL0)
+ CALL PLFLUSH
+C
+C------ set up for next input point
+ ILAST = I
+ JLAST = J
+ ISTAT = 1
+C
+ 205 CONTINUE
+ WRITE(*,*) '20-node array limit reached'
+ 206 CONTINUE
+C
+C---- put buffer array into database
+ KC = INDEX(CHARS,ALPH)
+ DO 207 K=1, 20
+ NODE(K,KC) = NODET(K)
+ 207 CONTINUE
+ WRITE(*,*)
+ WRITE(*,*) 'Database updated.'
+ SAVED = .FALSE.
+C
+C---- replot whole character
+ 209 CALL PLEND
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+C
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- modify character
+ 30 CONTINUE
+ WRITE(*,1030) ALPH
+ 1030 FORMAT(/1X, 'Modifying character: ', A)
+C
+ KC = INDEX(CHARS,ALPH)
+ IF(KC.EQ.0) THEN
+ WRITE(*,*) 'Character is not in database.'
+ GO TO 900
+ ENDIF
+C
+C---- save database node array for restoration after abort
+ DO 301 K=1, 20
+ NODET(K) = NODE(K,KC)
+ 301 CONTINUE
+C
+ CALL PLTINI
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+C
+ccc CALL PLSYMB(X0,Y0,CH,ALPH,0.0,1)
+c
+C
+C---- small node-select symbol size
+ CHS = 0.010*CH
+C
+ CALL PABORT
+ CALL PDONE
+ CALL PLFLUSH
+C
+ WRITE(*,*)
+ WRITE(*,*) 'Click on old/new point pairs...'
+ DO 305 IPASS=1, 12345
+C
+ CALL GETCURSORXY(XC,YC,KCHAR)
+C
+C------ restore and exit if clicked inside "ABORT" box
+ IF(LABORT(XC,YC)) THEN
+ DO 3052 K=1, 20
+ NODE(K,KC) = NODET(K)
+ 3052 CONTINUE
+ WRITE(*,*) 'Database unchanged.'
+ GO TO 309
+ ENDIF
+C
+C------ finish up if clicked inside "DONE" box
+ IF(LDONE(XC,YC)) GO TO 306
+C
+C------ set integer coordinates and clip to within field
+ I = INT(64.0*(XC-X0)/CH + 16.5)
+ J = INT(64.0*(YC-Y0)/CH + 16.5)
+ I = MAX( 0 , MIN(I,96) )
+ J = MAX( 0 , MIN(J,96) )
+C
+C------ find nearest vector node
+ IDMIN = 1000000
+ KMIN = 0
+ DO 3054 K=1, 20
+ ISTAT = NODE(K,KC) / 10000
+ IF(ISTAT.EQ.0) GO TO 3055
+C
+ NODEB = NODE(K,KC) - ISTAT*10000
+ IT = NODEB / 100
+ JT = NODEB - 100*IT
+C
+ IDIST = (I - IT)**2 + (J - JT)**2
+ IF(IDIST.LT.IDMIN) THEN
+ IDMIN = IDIST
+ KMIN = K
+ ENDIF
+ 3054 CONTINUE
+ 3055 CONTINUE
+C
+ KT = KMIN
+ IF(KT.EQ.0) THEN
+ WRITE(*,*) 'Nearest point not found.'
+ GO TO 900
+ ENDIF
+C
+C------ plot small symbol on nearest vector node to identify it
+ ISTAT = NODE(KT,KC) / 10000
+ NODEB = NODE(KT,KC) - ISTAT*10000
+ IT = NODEB / 100
+ JT = NODEB - 100*IT
+C
+ CALL NEWCOLORNAME('red')
+ XNODE = CH*FLOAT(IT-16)/64.0
+ YNODE = CH*FLOAT(JT-16)/64.0
+ CALL PLSYMB(XNODE,YNODE,CHS,1,0.0,0)
+ FK = FLOAT(KT)
+ CALL PLNUMB(XNODE+1.5*CHS,YNODE+1.5*CHS,3.0*CHS,FK,0.0,-1)
+ CALL NEWCOLOR(ICOL0)
+C
+C------ now get new location for vector node KT
+ CALL GETCURSORXY(XC,YC,KCHAR)
+C
+ IF(LABORT(XC,YC)) THEN
+ DO 3056 K=1, 20
+ NODE(K,KC) = NODET(K)
+ 3056 CONTINUE
+ WRITE(*,*) 'No changes made.'
+ GO TO 309
+ ENDIF
+C
+ IF(LDONE(XC,YC)) GO TO 306
+C
+C------ integer coordinates for new location
+ I = INT(64.0*(XC-X0)/CH + 16.5)
+ J = INT(64.0*(YC-Y0)/CH + 16.5)
+ I = MAX( 0 , MIN(I,96) )
+ J = MAX( 0 , MIN(J,96) )
+C
+C------ encode coordinates into database
+ NODE(KT,KC) = 10000*ISTAT + 100*I + J
+C
+C------ replot everything
+ CALL PLEND
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PABORT
+ CALL PDONE
+ CALL PLFLUSH
+C
+ 305 CONTINUE
+ 306 CONTINUE
+C
+ WRITE(*,*)
+ WRITE(*,*) 'Database updated.'
+ SAVED = .FALSE.
+C
+C---- replot final state
+ 309 CALL PLEND
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+C
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- translate current character
+ 40 CONTINUE
+C
+ DO K=1, 20
+ NODET(K) = 0
+ ENDDO
+C
+ 41 WRITE(*,1040)
+ 1040 FORMAT(/' Enter dX, dY (in points): ', $)
+ READ(*,*,ERR=41) ID, JD
+C
+ IC = INDEX(CHARS,ALPH)
+ DO 42 K=1, 20
+C
+C------ unpack node coordinates from database
+ ISTAT = NODE(K,IC) / 10000
+ IF(ISTAT.EQ.0) GO TO 43
+C
+ NODEB = NODE(K,IC) - ISTAT*10000
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+C------ shift coordinates
+ I = I + ID
+ J = J + JD
+C
+ IF(I.LT.0 .OR. I.GT.96) THEN
+ WRITE(*,*) 'X movement puts character outside field 0..96'
+ GO TO 40
+ ENDIF
+C
+ IF(J.LT.0 .OR. J.GT.96) THEN
+ WRITE(*,*) 'Y movement puts character outside field 0..96'
+ GO TO 40
+ ENDIF
+C
+C------ encode new coordinates in buffer array
+ NODET(K) = 10000*ISTAT + 100*I + J
+C
+ 42 CONTINUE
+ 43 CONTINUE
+C
+C---- store shifted nodes in database from buffer array
+ DO 46 K=1, 20
+ NODE(K,IC) = NODET(K)
+ 46 CONTINUE
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- select overlay character
+ 50 CONTINUE
+ ALPHO = ' '
+ WRITE(*,1050) CHARS(1:NCHAR)
+ 1050 FORMAT(/1X,A,
+ & //1X,'Select character to overlay (<return> if none: ',$)
+ READ(*,1000) ALPHO
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- lean character(s)
+ 60 CONTINUE
+ WRITE(*,1060)
+ 1060 FORMAT(/' Enter character range to lean (e.g. AZ): ',$)
+ READ(*,1000) RANGE
+ IF(INDEX(RANGE,' ').EQ.1) GO TO 900
+C
+ 62 WRITE(*,1062)
+ 1062 FORMAT(/1X,'Enter tan(lean_angle), + to right: ',$)
+ READ (*,*,ERR=62) TANA
+C
+ CALL LEAN(RANGE,TANA)
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- enter plot test string
+ 70 CONTINUE
+ WRITE(*,1070)
+ 1070 FORMAT(/' Enter string: ',$)
+ READ(*,1000) STRING
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- add character to database
+ 80 CONTINUE
+ IF(NCHAR+1.GE.100) THEN
+ WRITE(*,*)
+ WRITE(*,*) 'Array limit reached. Cannot add character.'
+ GO TO 900
+ ENDIF
+C
+ WRITE(*,1080)
+ 1080 FORMAT(/1X,'Enter character to be added: ',$)
+ READ(*,1000) ALPH
+ IC = INDEX(CHARS,ALPH)
+ IF(IC.NE.0) THEN
+ WRITE(*,*) 'That is already in database.'
+ GO TO 900
+ ENDIF
+C
+ 81 WRITE(*,1081) CHARS(1:NCHAR), ALPH
+ 1081 FORMAT(/1X,A,
+ & //1X,' ... insert ',A1,
+ & ' before which character ? (<return> to append) : ',$)
+ READ(*,1000) ALPHT
+ IC = INDEX(CHARS,ALPHT)
+ IF(IC.EQ.0) IC = NCHAR+1
+C
+C---- move up all characters above IC to make room for new character
+ IF(IC.LE.NCHAR) THEN
+ CHARS(IC+1:NCHAR+1) = CHARS(IC:NCHAR)
+ DO 802 KC=NCHAR, IC, -1
+ DO 8024 K=1, 20
+ NODE(K,KC+1) = NODE(K,KC)
+ 8024 CONTINUE
+ 802 CONTINUE
+ ENDIF
+C
+ NCHAR = NCHAR+1
+C
+C---- set new character and clear its vectors
+ CHARS(IC:IC) = ALPH
+ DO 804 K=1, 20
+ NODE(K,IC) = 0
+ 804 CONTINUE
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- delete character from database
+ 90 CONTINUE
+C
+ WRITE(*,1090)
+ 1090 FORMAT(/1X,'Select character to be deleted: ',$)
+ READ(*,1000) ALPH
+C
+ IF(INDEX(' ',ALPH).EQ.1) THEN
+ WRITE(*,*) 'No action taken'
+ GO TO 900
+ ENDIF
+C
+ IC = INDEX(CHARS,ALPH)
+C
+ IF(IC.EQ.0) THEN
+ WRITE(*,*) 'Character not in database.'
+ GO TO 900
+ ENDIF
+C
+C---- pull down all characters above the one to be deleted
+ CHARS(IC:NCHAR) = CHARS(IC+1:NCHAR+1)
+ DO 902 KC=IC, NCHAR-1
+ DO 9024 K=1, 20
+ NODE(K,KC) = NODE(K,KC+1)
+ 9024 CONTINUE
+ 902 CONTINUE
+ NCHAR = NCHAR-1
+ IC = MIN(IC,NCHAR)
+C
+C---- set new current character
+ ALPH = CHARS(IC:IC)
+C
+ CALL PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ CALL PLFLUSH
+ CALL PLEND
+ GO TO 900
+C
+C===========================================
+C---- write out database
+ 100 CONTINUE
+ CALL SAVE(ARGP1,SAVED)
+ GO TO 900
+C
+C===========================================
+C---- write out include file
+ 110 CONTINUE
+ CALL WRIT(ARGP1)
+ GO TO 910
+C
+C===========================================
+C---- set zoom
+ 120 CONTINUE
+ CALL USETZOOM(.FALSE.,.TRUE.)
+ CALL REPLOT(1)
+ GO TO 910
+C
+C===========================================
+C---- clear zoom
+ 130 CONTINUE
+ CALL CLRZOOM
+ CALL REPLOT(1)
+ GO TO 910
+C
+ END
+
+
+
+ SUBROUTINE LOAD(ARGP1)
+ CHARACTER*80 ARGP1,FNAME
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+ 1000 FORMAT(A)
+C
+ K = INDEX(ARGP1,' ') - 1
+ IF(K.LT.1) THEN
+ WRITE(*,*) 'SYMGEN argument error: ', ARGP1
+ STOP
+ ENDIF
+C
+ FNAME = ARGP1(1:K) // '.FNT'
+C
+ OPEN(3,FILE=FNAME,STATUS='OLD',ERR=90)
+ READ(3,1000) CHARS
+ NCHAR = INDEX(CHARS,' ') - 1
+C
+ DO IC=1, NCHAR
+ DO K=1, 20
+ NODE(K,IC) = 0
+ ENDDO
+ ENDDO
+C
+ DO IC=1, NCHAR
+ READ(3,*,END=80) (NODE(K,IC),K=1,20)
+C
+C------ clear any invalid points (should be zero anyway)
+ DO K=1, 20
+ ISTAT = NODE(K,IC) / 10000
+ IF(ISTAT.EQ.0) NODE(K,IC) = 0
+ ENDDO
+ ENDDO
+C
+ 80 CONTINUE
+ CLOSE(3)
+C
+ WRITE(*,1200) CHARS(1:NCHAR)
+ 1200 FORMAT(/1X,'Database read for the following character set...'
+ & //1X, A)
+C
+ RETURN
+C
+ 90 CONTINUE
+ WRITE(*,*) 'Database file not found: ',FNAME(1:60)
+ RETURN
+C
+ END
+
+
+
+ SUBROUTINE SAVE(ARGP1,SAVED)
+ CHARACTER*80 ARGP1,FNAME
+ CHARACTER*1 ANS
+ CHARACTER*4 CNUM
+ LOGICAL SAVED
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+C
+ 1000 FORMAT(A)
+ 1500 FORMAT(1X,20I6)
+ 2100 FORMAT(/' File ',A,' exits. Overwrite ? Y')
+C
+C
+ KARG = INDEX(ARGP1,' ') - 1
+C
+C---- write new database file for next SYMGEN call
+ FNAME = ARGP1(1:KARG) // '.FNT'
+ OPEN(3,FILE=FNAME,STATUS='OLD',ERR=10)
+C
+ WRITE(*,2100) FNAME(1:KARG+4)
+ READ(*,1000) ANS
+ IF(INDEX('Nn',ANS) .NE. 0) THEN
+ CLOSE(3)
+ RETURN
+ ENDIF
+C
+ 10 OPEN(3,FILE=FNAME,STATUS='UNKNOWN')
+C
+ WRITE(3,1000) CHARS(1:NCHAR)
+ DO IC=1, NCHAR
+ WRITE(3,1500) (NODE(K,IC),K=1,20)
+ ENDDO
+ CLOSE(3)
+ WRITE(*,*)
+ WRITE(*,*) 'New database file written: ', FNAME(1:KARG+4)
+ SAVED = .TRUE.
+C
+ RETURN
+ END
+
+
+
+ SUBROUTINE WRIT(ARGP1)
+ CHARACTER*80 ARGP1,FNAME,LINE
+ CHARACTER*1 ANS
+ CHARACTER*4 CNUM
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+C---- write new include file for SYMBOL-type routine
+C
+ 1000 FORMAT(A)
+ 1500 FORMAT(1X,20I6)
+ 2100 FORMAT(/' File ',A,' exits. Overwrite ? Y')
+C
+ KARG = INDEX(ARGP1,' ') - 1
+C
+ FNAME = ARGP1(1:KARG) // '.INC'
+ OPEN(4,FILE=FNAME,STATUS='OLD',ERR=20)
+C
+ WRITE(*,2100) FNAME(1:KARG+4)
+ READ(*,1000) ANS
+ IF(INDEX('Nn',ANS) .NE. 0) THEN
+ CLOSE(4)
+ GO TO 28
+ ENDIF
+C
+ 20 OPEN(4,FILE=FNAME,STATUS='UNKNOWN')
+ WRITE(4,*) ' '
+ WRITE(4,3010) NCHAR, NCHAR
+C
+ WRITE(4,*) ' '
+ NARR = (NCHAR-1)/10
+ DO N=0, NARR
+ NDIM = MIN( 10 , NCHAR-N*10)
+ WRITE(4,3201) N, NDIM
+ ENDDO
+ DO N=0, NARR
+ WRITE(4,3202) 10*N+1, N
+ ENDDO
+C
+C---Write character translation data statements
+ WRITE(4,3020) NCHAR
+ DO L=1, 8
+ K1 = 26*L - 25
+ K2 = 26*L
+ IF(K1 .GT. NCHAR) GO TO 21
+ K2 = MIN(K2,NCHAR)
+ WRITE(4,3021) K1,K2, CHARS(K1:K2)
+ ENDDO
+ 21 CONTINUE
+C
+C---Write out character node data
+ DO N=0, NARR
+ IC1 = 10*N + 1
+ IC2 = 10*N + 10
+ IC2 = MIN(IC2,NCHAR)
+C
+ IC = IC1
+ WRITE(4,3210) N
+ DO IC=IC1, IC2-1
+ WRITE(4,3220) (NODE(K,IC),K= 1,10)
+ WRITE(4,3220) (NODE(K,IC),K=11,20)
+ ENDDO
+ IC = IC2
+ WRITE(4,3220) (NODE(K,IC),K= 1,10)
+ WRITE(4,3230) (NODE(K,IC),K=11,20)
+ ENDDO
+C
+ CLOSE(4)
+C
+ 3010 FORMAT(' CHARACTER*',I3,' CHARS'
+ & /' INTEGER NODE(20,',I3,')')
+C
+ 3201 FORMAT(' DIMENSION NODE',I1,'(20,',I2,')')
+ 3202 FORMAT(' EQUIVALENCE ( NODE(1,',I3,') , NODE',I1,'(1,1) )')
+C
+ 3020 FORMAT(' DATA NCHARS / ',I3,' /')
+ 3021 FORMAT(' DATA CHARS(',I3,':',I3,') / ''',A,''' /')
+C
+ 3210 FORMAT( ' DATA NODE',I1,' /')
+ 3220 FORMAT( ' & ',10(I5,',') )
+ 3230 FORMAT( ' & ', 9(I5,','),I5,' /' )
+C
+ CLOSE(4)
+ WRITE(*,*)
+ WRITE(*,*) 'New include file written: ', FNAME(1:KARG+4)
+ WRITE(*,*) 'Put include file in Xplot directory,',
+ & ' make libPlt.a to implement new font.'
+C
+ 28 CONTINUE
+ RETURN
+C
+ END
+
+
+ SUBROUTINE LEAN(RANGE,TANA)
+ CHARACTER*(*) RANGE
+C
+ CHARACTER*1 ALPH
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+ KC1 = INDEX(CHARS,RANGE(1:1))
+ KC2 = INDEX(CHARS,RANGE(2:2))
+C
+ IF(KC1.EQ.0 .OR. KC2.EQ.0) THEN
+ WRITE(*,*) 'Specified range not in current character set.'
+ WRITE(*,*) 'No action taken.'
+ RETURN
+ ENDIF
+C
+C---- go over each character...
+ DO 12 KC=KC1, KC2
+C
+C------ go over each node
+ DO K=1, 20
+C
+C-------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+ IF(ISTAT.GT.0) THEN
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+C---------- perform tilt
+ I = I + INT( FLOAT(J-16)*TANA )
+C
+C---------- encode coordinates back into database
+ NODE(K,KC) = 10000*ISTAT + 100*I + J
+C
+ ENDIF
+C
+ ENDDO
+C
+ 12 CONTINUE
+C
+ RETURN
+ END
+
+
+
+ SUBROUTINE PLTINI
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+C
+ RELWSIZ = 0.8
+ CALL PLOPEN(RELWSIZ,IPSLU,IDEV)
+ CALL PLOTABS(0.125,0.125,-3)
+ CALL NEWFACTOR(SIZE)
+ CALL PLOT(0.25*CH,0.25*CH,-3)
+C
+ RETURN
+ END ! PLTINI
+
+
+
+ SUBROUTINE PLTALL(X0,Y0,ALPH,ALPHO,STRING)
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+ CHARACTER*1 ALPH, ALPHO
+ CHARACTER*80 STRING
+C
+ CHSEQ = 0.10*CH
+ CHSTR = 0.05*CH
+C
+ XSEQ = CH + CH/4.0 + 0.03*CH
+ YSEQ = CH + CH/4.0 - 1.10*CHSEQ
+C
+ XCHR = CH + CH/4.0 + 0.03*CH
+ YCHR = CH - 0.07*CH
+C
+ XSTR = XCHR
+ YSTR = YCHR - 0.65*CH
+C
+ CALL PLTINI
+ CALL PLTGRD(X0,Y0,CH)
+ CALL SYMPLT(X0,Y0,CH,ALPH,0.0,-1)
+ CALL SYMPLT(X0,Y0,CH,ALPHO,0.0,1)
+ CALL SYMPLT(XSTR,YSTR,CHSTR,STRING,0.0,80)
+ CALL PLTCHR(XCHR,YCHR)
+C
+ XQ = XSEQ
+ CHQ = CHSEQ
+c CALL PLOT(XQ,YSEQ,3)
+ DO ISCAL=0, 10
+ CALL SYMPLT(XQ,YSEQ,CHQ,ALPH,0.0,1)
+c CALL PLCHAR(999.,999.,CHQ,ALPH,0.0,1)
+ XQ = XQ + CHQ
+ CHQ = CHQ * 0.75
+ ENDDO
+C
+ RETURN
+ END
+
+
+
+ SUBROUTINE PLTCHR(XCHR,YCHR)
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+C
+ CHARACTER*1 ALPH
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+ CHP = 0.040*CH
+C
+ DO 10 ILIN=1, 5
+ YPLT = YCHR - CHP - 2.5*CHP*(ILIN-1)
+ DO 102 KC=1, 26
+ XPLT = XCHR + 0.5*CHP + 1.0*CHP*(KC-1)
+ XPLT = XCHR + 1.0*CHP*(KC-1)
+C
+ IC = KC + 26*(ILIN-1)
+ IF(IC.GT.NCHAR) GO TO 15
+C
+ ALPH = CHARS(IC:IC)
+ CALL SYMPLT(XPLT,YPLT,CHP,ALPH,0.0,1)
+ 102 CONTINUE
+ 10 CONTINUE
+C
+ 15 CONTINUE
+ RETURN
+ END
+
+
+
+ SUBROUTINE SYMPLT(XC,YC,CH,STRING,ANGLE,NC1)
+C----------------------------------------------------------------
+C Plots character string using vector font database NODE(..)
+C
+C Each NODE(..) value has the form sxxyy
+C
+C xx = location of polyline point 0 ... 96
+C yy
+C s = 2 if point is the start of a new polyline stroke
+C = 1 if point is inside or at the end of stroke
+C = 0 if point is not valid
+C----------------------------------------------------------------
+ CHARACTER*(*) STRING
+C
+ CHARACTER*1 ALPH
+C
+ CHARACTER*100 CHARS
+ COMMON /CDATA/ CHARS
+ COMMON /NDATA/ NCHAR, NODE(20,100)
+C
+ NC = ABS(NC1)
+ CHS = 0.010*CH
+C
+ CALL GETCOLOR(ICOL0)
+C
+C---- go over each character...
+ DO 12 IC=1, NC
+C
+C------ set plot location
+ X0 = XC + CH*FLOAT(IC-1)
+ Y0 = YC
+C
+ ALPH = STRING(IC:IC)
+ KC = INDEX(CHARS,ALPH)
+C
+ IF(KC.NE.0) THEN
+C
+C-------- decode and plot each node
+ DO K=1, 20
+C
+C---------- strip off leading point-status digit
+ ISTAT = NODE(K,KC) / 10000
+ NODEB = NODE(K,KC) - ISTAT*10000
+C
+C---------- decode x and y location coordinates
+ I = NODEB / 100
+ J = NODEB - 100*I
+C
+ X = X0 + CH*FLOAT(I-16)/64.0
+ Y = Y0 + CH*FLOAT(J-16)/64.0
+C
+ IF (ISTAT.EQ.0) THEN
+ GOTO 12
+ ELSEIF (ISTAT.EQ.1) THEN
+ CALL PLOT(X,Y,2)
+ ELSE
+ CALL PLOT(X,Y,3)
+ ENDIF
+C
+C---------- plot symbol at vector nodes
+ IF(NC1.LT.0) THEN
+ CALL NEWCOLORNAME('blue')
+ CALL PLSYMB(X,Y,CHS,1,0.0,0)
+ FK = FLOAT(K)
+ CALL PLNUMB(X+1.5*CHS,Y+1.5*CHS,3.0*CHS,FK,0.0,-1)
+ CALL NEWCOLOR(ICOL0)
+ CALL PLOT(X,Y,3)
+ ENDIF
+C
+ ENDDO
+ ENDIF
+C
+ 12 CONTINUE
+C
+ RETURN
+ END
+
+
+
+ SUBROUTINE PLTGRD(X0,Y0,CH)
+ DATA LMASK1, LMASK2, LMASK3 / -32640, -30584, -21846 /
+C
+ CALL NEWPEN(1)
+C
+ NX = 24
+ NY = 24
+ DX = CH/16.0
+ DY = CH/16.0
+ CALL PLGRID(X0-0.25*CH,Y0-0.25*CH, NX,DX, NY,DY, LMASK2 )
+C
+ NX = 2
+ NY = 2
+ DX = CH/2.0
+ DY = CH/2.0
+ CALL PLGRID(X0,Y0, NX,DX, NY,DY, LMASK3 )
+C
+ DO I=0,2
+ DO J=0,2
+ XPLT = X0 + DX*FLOAT(I)
+ YPLT = Y0 + DY*FLOAT(J)
+ CALL PLSYMB(XPLT,YPLT,CH/96.0,5,0.0,0)
+ ENDDO
+ ENDDO
+C
+ CALL PLFLUSH
+C
+ RETURN
+ END
+
+
+
+
+ SUBROUTINE PDONE
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+ COMMON /DONE/ XDONE(2), YDONE(2)
+C
+C---- set DONE window
+ XDONE(1) = CH + CH/4.0 + 0.125/SIZE
+ XDONE(2) = CH + CH/4.0 + 1.025/SIZE
+ YDONE(1) = - CH/4.0 + 0.525/SIZE
+ YDONE(2) = - CH/4.0 + 1.425/SIZE
+C
+C---- plot DONE window
+ CALL GETCOLOR(ICOL0)
+ CALL NEWCOLORNAME('green')
+ CALL PLOT(XDONE(1),YDONE(1),3)
+ CALL PLOT(XDONE(2),YDONE(1),2)
+ CALL PLOT(XDONE(2),YDONE(2),2)
+ CALL PLOT(XDONE(1),YDONE(2),2)
+ CALL PLOT(XDONE(1),YDONE(1),2)
+C
+ CHA = MIN( (XDONE(2)-XDONE(1))/8.0 , (YDONE(2)-YDONE(1))/1.5 )
+ XCA = 0.5*(XDONE(2)+XDONE(1)) - 2.0*CHA
+ YCA = 0.5*(YDONE(2)+YDONE(1)) - 0.5*CHA
+ CALL PLCHAR(XCA,YCA,CHA,'DONE',0.0,4)
+ CALL NEWCOLOR(ICOL0)
+C
+ RETURN
+ END
+
+
+ FUNCTION LDONE(XC,YC)
+ COMMON /DONE/ XDONE(2), YDONE(2)
+ LOGICAL LDONE
+C
+C---- return T if location XC,YC falls within DONE window
+C
+ LDONE = XC .GE. XDONE(1) .AND.
+ & XC .LE. XDONE(2) .AND.
+ & YC .GE. YDONE(1) .AND.
+ & YC .LE. YDONE(2)
+C
+ RETURN
+ END
+
+
+
+
+ SUBROUTINE PABORT
+ COMMON /PLTC/ IDEV, IPSLU, SIZE, CH
+ COMMON /ABRT/ XABORT(2), YABORT(2)
+C
+C---- set abort window
+ XABORT(1) = CH + CH/4.0 + 0.125/SIZE
+ XABORT(2) = CH + CH/4.0 + 1.025/SIZE
+ YABORT(1) = - CH/4.0
+ YABORT(2) = - CH/4.0 + 0.400/SIZE
+C
+C---- plot abort window
+ CALL GETCOLOR(ICOL0)
+ CALL NEWCOLORNAME('red')
+ CALL PLOT(XABORT(1),YABORT(1),3)
+ CALL PLOT(XABORT(2),YABORT(1),2)
+ CALL PLOT(XABORT(2),YABORT(2),2)
+ CALL PLOT(XABORT(1),YABORT(2),2)
+ CALL PLOT(XABORT(1),YABORT(1),2)
+C
+ CHA = MIN( (XABORT(2)-XABORT(1))/8.0 , (YABORT(2)-YABORT(1))/1.5 )
+ XCA = 0.5*(XABORT(2)+XABORT(1)) - 2.5*CHA
+ YCA = 0.5*(YABORT(2)+YABORT(1)) - 0.5*CHA
+ CALL PLCHAR(XCA,YCA,CHA,'ABORT',0.0,5)
+ CALL NEWCOLOR(ICOL0)
+C
+ RETURN
+ END
+
+
+ FUNCTION LABORT(XC,YC)
+ COMMON /ABRT/ XABORT(2), YABORT(2)
+ LOGICAL LABORT
+C
+C---- return T if location XC,YC falls within abort window
+C
+ LABORT = XC .GE. XABORT(1) .AND.
+ & XC .LE. XABORT(2) .AND.
+ & YC .GE. YABORT(1) .AND.
+ & YC .LE. YABORT(2)
+C
+ RETURN
+ END
+
+
diff --git a/plotlib/sym/test.f b/plotlib/sym/test.f
new file mode 100644
index 0000000..2dd5b7d
--- /dev/null
+++ b/plotlib/sym/test.f
@@ -0,0 +1,159 @@
+C***********************************************************************
+C Module: test.f (test routine for fonts in Xplot/sym)
+C
+C Copyright (C) 1996 Harold Youngren, Mark Drela
+C
+C This program is free software; you can redistribute it and/or modify
+C it under the terms of the GNU General Public License as published by
+C the Free Software Foundation; either version 2 of the License, or
+C (at your option) any later version.
+C
+C This program is distributed in the hope that it will be useful,
+C but WITHOUT ANY WARRANTY; without even the implied warranty of
+C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+C GNU General Public License for more details.
+C
+C You should have received a copy of the GNU General Public License
+C along with this program; if not, write to the Free Software
+C Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+C
+C Report problems to: guppy@maine.com
+C or drela@mit.edu
+C***********************************************************************
+
+
+ PROGRAM TEST
+C
+ IDEV = 3
+ IPSLU = 0
+ SIZE = 7.0
+ IPEN = 3
+ CH = 0.020
+C
+cc size = 5.0
+cc ipen = 2
+C
+ CALL PLINITIALIZE
+ CALL PLOPEN(-0.95,IPSLU,IDEV)
+ CALL NEWFACTOR(SIZE)
+ CALL NEWPEN(IPEN)
+C
+ CALL PLOTABS(0.60,1.20,-3)
+C
+ WRITE(*,*) 'Plotting PLCHAR set...'
+ CALL PLCHAR(0.0,1.25,CH,
+ & 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',0.0,52)
+ CALL PLCHAR(0.0,1.20,CH,
+ & '0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~ ',0.0,52)
+C
+ WRITE(*,*) 'Plotting PLSLAN set...'
+ CALL PLSLAN(0.0,1.10,CH,
+ & 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',0.0,52)
+ CALL PLSLAN(0.0,1.05,CH,
+ & '0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~ ',0.0,52)
+C
+ WRITE(*,*) 'Plotting PLMATH set...'
+ CALL PLMATH(0.0,0.95,CH,
+ & 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',0.0,52)
+ CALL PLMATH(0.0,0.90,CH,
+ & '0123456789,.;:`"!?@#$%&|()[]{}<>_+-*=/^~ ',0.0,52)
+C
+ WRITE(*,*) 'Plotting PLSYMB set...'
+ DO IS=0, 13
+ XX = 0.05*FLOAT(IS)
+ CALL PLSYMB(XX,0.80,CH,IS,0.0,0)
+ ENDDO
+C
+ WRITE(*,*) 'Plotting sample character strings...'
+C
+ CALL PLMATH(0.0 ,0.55,CH,' a2+b2=g2',0.0,9)
+C
+ CALL PLMATH(0.0 ,0.45,CH,' 2 2 2',0.0,9)
+ CALL PLCHAR(0.0 ,0.45,CH,' a +b =c ',0.0,9)
+C
+ CALL PLMATH(0.0 ,0.35+0.15*CH,
+ & CH,'R_____ ',0.0,9)
+ CALL PLMATH(0.0 ,0.35,CH,' 2 2 ',0.0,9)
+ CALL PLSLAN(0.0 ,0.35,CH,' a +b =c ',0.0,9)
+C
+ CALL PLMATH(0.30,0.55,CH,' 2',30.0,5)
+ CALL PLCHAR(0.30,0.55,CH,'E=mc ',30.0,5)
+C
+C
+ CALL PLMATH(0.30,0.45,CH,'F&= & & & ',-30.0,14)
+ CALL PLCHAR(0.30,0.45,CH,' u x+v y+w z',-30.0,14)
+C
+ CALL PLMATH(0.50,0.55,CH,'l- ',0.0,7)
+ CALL PLCHAR(0.50,0.55,CH,' shock',0.0,7)
+C
+ CALL PLMATH(0.50,0.45,CH,'>=Nf',0.0,4)
+ CALL PLCHAR(0.50,0.45,CH,'u ',0.0,4)
+C
+ CALL PLMATH(0.75,0.55,CH,'V= n H',0.0,7)
+ CALL PLCHAR(0.75,0.55,CH,' ( ) ',0.0,7)
+ CALL PLSLAN(0.75,0.55,CH,' t ',0.0,7)
+C
+ CALL PLMATH(0.75,0.45,CH,' __',0.0,5)
+ CALL PLMATH(0.75,0.45,CH,'V=Rn',0.0,4)
+ CALL PLSLAN(999.0,999.0,CH,'t',0.0,1)
+C
+ CALL PLMATH(0.75,0.35,CH,' = M ',0.0,7)
+ CALL PLCHAR(0.75,0.35,CH,'x [A] b',0.0,7)
+C
+ CALL PLMATH(0.0-CH,0.25-0.4*CH,2.0*CH,'I',0.0,1)
+ CALL PLMATH(0.0,0.25,CH,' ( ) ',0.0,7)
+ CALL PLCHAR(0.0,0.25,CH,' F x dx',0.0,7)
+C
+ CALL PLMATH(0.0,0.15,CH,'e{ ',0.0,3)
+ CALL PLCHAR(0.0,0.15,CH,' 1',0.0,3)
+C
+ CALL PLCHAR(0.25,0.25,CH,'273 K',0.0,5)
+ CALL PLMATH(0.25,0.25,CH,' " ',0.0,5)
+C
+ CALL PLSLAN(0.50,0.25,CH,' y',0.0,8)
+ CALL PLMATH(0.50,0.25,CH,'g=-$G/$ ',0.0,8)
+C
+ CALL PLCHAR(0.75,0.25,CH,' tan ',0.0,9)
+ CALL PLSLAN(0.75,0.25,CH,' y/x',0.0,9)
+ CALL PLMATH(0.75,0.25,CH,'q= M ',0.0,9)
+C
+ CALL PLCHAR(0.25,0.15,CH,'Underline',0.0,9)
+ CALL PLCHAR(0.25,0.15,CH,'_________',0.0,9)
+C
+ CALL PLSLAN(0.50,0.15,CH,'Overline',0.0,8)
+ CALL PLMATH(0.50,0.15,CH,'________',0.0,8)
+C
+ CALL PLSLAN(0.75,0.15,CH,' r=0',0.0,5)
+ CALL PLMATH(0.75,0.15,CH,'q# ',0.0,5)
+ CALL PLMATH(0.75,0.15,CH,' ^ ',0.0,5)
+ CALL PLMATH(0.75,0.15+0.4*CH,
+ & CH,'^ ',0.0,5)
+C
+ CALL PLMATH(0.00,0.05+1.2*CH,
+ & CH,' * ',0.0,10)
+ CALL PLMATH(0.00,0.05+0.4*CH,
+ & CH,' > > ',0.0,10)
+ CALL PLMATH(0.00,0.05,CH,'> > >',0.0,10)
+ CALL PLCHAR(0.00,0.05,CH,'a= r+2 v',0.0,10)
+ CALL PLMATH(0.00,0.05,CH,' W# W# ',0.0,10)
+C
+ CALL PLSLAN(0.30,0.05,CH,' ~ ',0.0,9)
+ CALL PLCHAR(0.30,0.05,CH,'ln(1+ ) ',0.0,9)
+ CALL PLMATH(0.30,0.05,CH,' v v',0.0,9)
+C
+ CALL PLSLAN(0.55,0.05,CH,' ~ ',0.0,14)
+ CALL PLCHAR(0.55,0.05,CH,' {g x } g x',0.0,14)
+ CALL PLMATH(0.55,0.05,CH,'O ( ) `O ',0.0,14)
+C
+ CALL PLFLUSH
+C
+ccc call usetzoom(.true.,.true.)
+ccc call replot(1)
+C
+ READ(*,1) DUMMY
+ 1 FORMAT(A)
+C
+ CALL PLOT(0.0,0.0,+999)
+C
+ END
+
diff --git a/plotlib/util-ops.f b/plotlib/util-ops.f
new file mode 100644
index 0000000..c16a49f
--- /dev/null
+++ b/plotlib/util-ops.f
@@ -0,0 +1,17 @@
+C--- Replacement functions for Fortran's that lack RSHIFT,LSHIFT,AND
+C Version 4.46 11/28/01
+
+ INTEGER FUNCTION RSHIFT(I1,N)
+ RSHIFT = ISHFT(I1,-N)
+ RETURN
+ END
+
+ INTEGER FUNCTION LSHIFT(I1,N)
+ LSHIFT = ISHFT(I1,N)
+ RETURN
+ END
+
+ INTEGER FUNCTION AND(I1,I2)
+ AND = IAND(I1,I2)
+ RETURN
+ END
diff --git a/plotlib/version.inc b/plotlib/version.inc
new file mode 100644
index 0000000..11945e4
--- /dev/null
+++ b/plotlib/version.inc
@@ -0,0 +1,2 @@
+C Version 4.47 12 Nov 07
+
diff --git a/plotlib/win32/Makefile.NT b/plotlib/win32/Makefile.NT
new file mode 100644
index 0000000..15f1941
--- /dev/null
+++ b/plotlib/win32/Makefile.NT
@@ -0,0 +1,169 @@
+#***********************************************************************
+# Module: Makefile
+#
+# Copyright (C) 1996 Harold Youngren, Mark Drela
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# Report problems to: guppy@maine.com
+# or drela@orville.mit.edu
+#***********************************************************************
+
+
+
+#################################
+# makefile for Xplot11 library #
+#################################
+
+#point to your install directory
+INSTALLDIR= .
+DIR= ..
+
+#Library tool
+AR = lib
+
+### Use these to set library name
+### (add DP to keep double precision version separate)
+PLTLIB = libPlt.lib
+#PLTLIB = libPltDP.lib
+
+###========================ggggg===========================
+### Basic plot library object files
+OBJ = plt_base.obj plt_font.obj plt_util.obj \
+ plt_color.obj set_subs.obj gw_subs.obj \
+ ps_subs.obj W32win.obj
+OBJMISC =
+OBJ3D =
+OBJOLD =
+###
+###--------------------------------------------------------
+### Uncomment to add the old plot compatibility routines
+OBJOLD = plt_old.obj
+###
+###--------------------------------------------------------
+### Uncomment to add the 3D-view routines
+OBJ3D = plt_3D.obj
+###
+###--------------------------------------------------------
+### Uncomment for f77 compiler w/o AND() and RSHIFT/LSHIFT functions.
+### This adds some functions to duplicate these using IAND and ISHFT
+### which often appear in these offending fortran's libraries.
+### The compilers that this has affected include:
+### HPUX f77
+### Absoft f77 on Linux
+###
+#OBJMISC = util-ops.obj
+
+
+###================================================
+### Compaq Visual Fortran compiler and flags, install commands
+#FC = f77
+#CC = cl
+### Defines for C interface
+#DEFINE = -DUNDERSCORE -D_CVF
+### Uncomment DP to make double-precision version
+#DP = /realsize:64
+#FFLAGS = /Oxp $(DP) /threads
+#FLGOPT = /Oxp $(DP) /threads
+#CFLAGS = $(DEFINE) -MT
+#LFLAGS = /libs:qwin /threads /link /NODEFAULTLIB:LIBC.LIB
+
+###================================================
+### Intel Fortran compiler and flags, install commands
+FC = ifl
+CC = cl
+### Defines for C interface
+#DEFINE = -DUNDERSCORE
+# Uncomment DP to make double-precision version
+#DP = /4R8
+### use flags for processor optimization G5 G6 G7 for PII,PIII,P4
+#FFLAGS = /Od /Zi $(DP) /W0 /MT
+FFLAGS = /I.. /O2 $(DP) /W0 /MT /4Yportlib
+FLGOPT = /I.. /O3 $(DP) /W0 /MT /4Yportlib
+CFLAGS = $(DEFINE) -MT
+LFLAGS = /4Yportlib /MT /link /NODEFAULTLIB:LIBC.LIB
+
+###================================================
+
+
+
+###-------------------------------------------------------------------------
+### Basic make targets - build library, test programs
+
+$(PLTLIB): $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ $(AR) /out:$(PLTLIB) $(OBJ) $(OBJOLD) $(OBJ3D) $(OBJMISC)
+ copy $(PLTLIB) ..
+
+test: $(PLTLIB)
+ (cd examples; make test)
+
+
+###-------------------------------------------------------------------------
+### Utility functions - install the library, clean the directory
+
+install: $(PLTLIB)
+ mv $(PLTLIB) $(INSTALLDIR)
+
+clean:
+ del *.obj
+ del $(PLTLIB)
+ del plot*.ps
+ (cd examples; make clean)
+
+
+
+###-------------------------------------------------------------------------
+### compile plot package routines
+
+plt_base.obj: $(DIR)\plt_base.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\plt_base.f
+
+plt_color.obj: $(DIR)\plt_color.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\plt_color.f
+
+plt_font.obj: $(DIR)\plt_font.f $(DIR)\CHAR.INC $(DIR)\SLAN.INC $(DIR)\MATH.INC $(DIR)\SYMB.INC
+ $(FC) /c $(FFLAGS) $(DIR)\plt_font.f
+
+plt_util.obj: $(DIR)\plt_util.f
+ $(FC) /c $(FFLAGS) $(DIR)\plt_util.f
+
+plt_3D.obj: $(DIR)\plt_3D.f
+ $(FC) /c $(FFLAGS) $(DIR)\plt_3D.f
+
+plt_old.obj: $(DIR)\plt_old.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\plt_old.f
+
+set_subs.obj: $(DIR)\set_subs.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\set_subs.f
+
+gw_subs.obj: $(DIR)\gw_subs.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\gw_subs.f
+
+ps_subs.obj: $(DIR)\ps_subs.f $(DIR)\pltlib.inc
+ $(FC) /c $(FFLAGS) $(DIR)\ps_subs.f
+
+util-ops.obj: $(DIR)\util-ops.f
+ $(FC) /c $(FFLAGS) $(DIR)\util-ops.f
+
+W32win.obj: W32win.c
+ $(CC) /c $(CFLAGS) W32win.c
+
+
+### May need to specify these on a brain-dead make system
+#.f.obj: $(FC) /c $(FFLAGS) $<
+#.c.obj: $(CC) /c $(CFLAGS) $<
+
+
+
diff --git a/plotlib/win32/Readme-win32 b/plotlib/win32/Readme-win32
new file mode 100644
index 0000000..c3fb339
--- /dev/null
+++ b/plotlib/win32/Readme-win32
@@ -0,0 +1,16 @@
+
+Make the plotlib under Windoze:
+
+ You need Visual C and either the Compaq Visual Fortran compiler or the Intel
+ Fortran compiler. You should check the options in Makefile.NT to ensure that
+ they match your system. The supplied files match the Intel Fortran compiler.
+
+ Compile and link with command in DOS window:
+ C:\Xfoil\plotlib: cd win32
+ C:\Xfoil\plotlib\win32: nmake /f Makefile.NT
+
+ This places all the .obj files in the win32 directory and copies libPltxx.lib
+ to the parent plotlib directory.
+
+ Alternatively you could load all the files into a Visual Studio project and
+ create the library that way.
diff --git a/plotlib/win32/W32win.c b/plotlib/win32/W32win.c
new file mode 100644
index 0000000..c3982d6
--- /dev/null
+++ b/plotlib/win32/W32win.c
@@ -0,0 +1,1709 @@
+/***********************************************************************
+ W32win.c - FORTRAN/C interface for Windows NT/95 Xplot11
+
+ Copyright (C) 1999 Harold Youngren, Mark Drela
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Report problems to: guppy@maine.rr.com
+ or drela@henry.mit.edu
+***********************************************************************/
+
+/***********************************************************************
+* Xplot11 C-level Win32 interface
+C Version 4.43 3/5/99
+*
+* Status: This code is still pretty rough, it works but there are some
+* rough edges (some of which result from problems with the Win32
+* API). This is the interface code to create, draw to, refresh,
+* destroy a graphics window on a Win32 machine running a Fortran
+* application (like XFOIL) making Pltlib calls.
+*
+* The refresh problem for Win32 (as the Xwindows option for a
+* automatic refresh using the server's backing store startup
+* option is not available under Win32) is dealt with by creating
+* a plot thread that monitors the Windoze events and does window
+* refresh. This is done by doing plotting to a memory bitmap and
+* writing the bitmap to the screen whenever the window needs
+* refresh.
+*
+* Note that several problems arise in supporting the Xwindows
+* plotting functionality under Win32. Colors are handled differently
+* than under Xwindows, for color name compatibility I have included
+* a color table lookup routine that maps Xwindows color names into
+* RGB values. A more serious problem is the inconsistency of the
+* Win32 API itself, specifically the functionality varies with the
+* version of the Microsoft OS you are running. The most serious
+* problem showed up in drawing lines with arbitrary patterns and
+* widths. The Win32 API apparently does not support drawing these
+* types of lines (used in Pltlib for background grids, among other
+* things) satisfactorily. There appears to be no way to draw a line
+* with an arbitrary pattern and width. Also it appears that drawing
+* patterned lines with transparent background color is not supported.
+*
+* Harold Youngren 10/01
+***********************************************************************/
+
+
+/***********************************************************************
+* Defines graphics primitives for window management and line drawing
+* Primitives include:
+* gwxrevflag - checks environment variables for background color
+* gwxopen - initializes X display and returns size and depth of display
+* gwxwinopen - opens X plotting window with specified x,y size and position
+* gwxclear - clears plotting window
+* gwxstatus - gets current window size and location
+* gwxresize - resizes current window to specified size
+
+* gwxreset - resets plotting defaults for window
+* gwxclose - closes plotting to X display
+* gwxflush - flushes out graphics primitives in buffers
+* gwxline - plots line segment
+
+* gwxdash - sets line pattern from integer mask
+* gwxcurs - gets graphics cursor position and key pressed
+* gwxpen - sets line width in pixels
+*
+* More advanced routines beyond the original PLOT-10 requirements
+* gwxdestroy - closes plot window
+* gwxlinez - plots polyline
+* gwxpoly - plots filled polygon
+* gwxstring - plots string
+*
+* Color routines
+* gwxsetcolor - sets foreground color from color map
+* gwxsetbgcolor - sets background color from color map
+* gwxcolorname2rgb - find color components of color specified by name string
+* gwxallocrgbcolor - allocate a color specified by r,g,b components
+* gwxfreecolor - frees an allocated color from colormap
+*
+* Utility routines
+* mskbits - converts integer mask into dot/dash array
+*
+* Double-buffer routines
+* gwxdisplaybuffer - switches background buffer with foreground window
+* gwxdrawtobuffer - sets drawing to background buffer
+* gwxdrawtowindow - sets drawing to foreground window
+************************************************************************/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <windows.h>
+#include <process.h>
+
+#include "rgbtbl.h"
+#include "Xdefs.h"
+
+typedef struct {
+ HWND window;
+ HPEN pen;
+ HBRUSH fgbrush;
+ HBRUSH bgbrush;
+ int fg;
+ int bg;
+ int font;
+ int fun;
+} GC;
+
+typedef struct {
+ int ic;
+ int rgb;
+ HPEN pen;
+ HBRUSH brush;
+} COLTBL;
+
+typedef struct Event {
+ HWND window;
+ int type;
+ int x;
+ int y;
+ int state;
+ struct Event *next;
+} Event;
+
+
+/* Calling convention, Intel Fortran is simple, call is same as Unix
+ CVF requires Microsoft call */
+#ifdef _CVF
+#define W32CALL __stdcall
+#else
+#define W32CALL
+#endif
+
+
+/* Maximum number of polyline points per polyline call,
+ increase if necessary */
+#define MAXPTS 1000
+
+/* Maximum number of colors */
+#define MAXCOLS 256
+
+static char *gwxClass = "PltLib";
+static char *gwxName = "PltLib";
+
+/*
+BYTE ANDMask[128], ORNMask[128], ORWMask[128];
+static BYTE ANDMsk16[] = { 0xfe, 0x00,
+ 0xfe, 0x00,
+ 0xfe, 0x00,
+ 0xff, 0x80,
+ 0xff, 0x80,
+ 0xff, 0x00,
+ 0xfe, 0x00,
+ 0xfc, 0x18,
+ 0xf8, 0x38,
+ 0xf0, 0x7f,
+ 0xe0, 0xff,
+ 0xc1, 0xff,
+ 0x83, 0xff,
+ 0x07, 0xff,
+ 0x0f, 0xff,
+ 0x1f, 0xff };
+ static BYTE ORNMsk16[] = { 0x00, 0x00,
+ 0x00, 0xfe,
+ 0x00, 0x7e,
+ 0x00, 0x3e,
+ 0x00, 0x3e,
+ 0x00, 0x7e,
+ 0x00, 0xe6,
+ 0x01, 0xc2,
+ 0x03, 0x80,
+ 0x07, 0x00,
+ 0x0e, 0x00,
+ 0x1c, 0x00,
+ 0x38, 0x00,
+ 0x70, 0x00,
+ 0x60, 0x00,
+ 0x00, 0x00 };
+ static BYTE ORWMsk16[] = { 0x01, 0xff,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x00, 0x41,
+ 0x00, 0x41,
+ 0x00, 0x81,
+ 0x01, 0x19,
+ 0x02, 0x25,
+ 0x04, 0x47,
+ 0x08, 0x80,
+ 0x11, 0x00,
+ 0x22, 0x00,
+ 0x44, 0x00,
+ 0x88, 0x00,
+ 0x90, 0x00,
+ 0xe0, 0x00 };
+*/
+
+/* Window and graphics global data */
+HWND gwxWin;
+HDC gwxHDC, gwxmemHDC;
+HBITMAP gwxBMAP;
+HCURSOR gwxNormalC, gwxWaitC, gwxCurrentC;
+
+GC *gwxGC;
+
+COLTBL RGBmap[MAXCOLS];
+int nRGBmap;
+
+/* int xcsize,ycsize; */
+int wxstart,wystart,wxsize,wysize;
+int xrootsize, yrootsize, rootdepth;
+int gwxSize[5];
+int gwxXmatte, gwxYmatte, gwxYbar;
+int reversevideo;
+int initthread;
+int penwidth, penpattern, ndash, pendash[16];
+
+HINSTANCE gwxInstance;
+ATOM gwxRegister;
+WNDCLASSEX gwxWndClass;
+MSG Message;
+
+Event *gwxEvents, *gwxLEvent, gwxLast;
+
+/*static PARAMS params;*/
+
+void MSKBITS(int*,int*,int*);
+int gwxlookupcolor (char*,int*);
+
+
+
+/**********************************************************************/
+/************************Internal Event Code***************************/
+
+/*These routines simulate the Xwindows XEvents to do user interaction.
+ This is done here by collecting a list of relevant events from Windoze
+ and managing these for the user who deals only with the simulated XEvents.
+ This is probably a grungy hack (it was copied from Bob Haimes Visual3 and
+ pV3 ports to Win32) but it works. It may be better to get rid of the
+ extra event layer and deal directly with Win32 events.
+ HHY */
+
+void
+gwxAddEvent(int type, int x, int y, int state)
+{
+ Event *event;
+
+ event = (Event *) malloc(sizeof(Event));
+ if (event == NULL) return;
+
+ event->window = gwxWin;
+ event->type = type;
+ event->x = x;
+ event->y = y;
+ event->state = state;
+ event->next = NULL;
+
+ if (gwxLEvent != NULL) gwxLEvent->next = event;
+ gwxLEvent = event;
+ if (gwxEvents == NULL) gwxEvents = event;
+ gwxLast = *event;
+}
+
+void
+gwxRemEvent(int *type, int *x, int *y, int *state)
+{
+ Event *event;
+
+ if (gwxEvents == NULL) {
+ printf("Warning: No Events to remove!\n");
+ return;
+ }
+
+ event = gwxEvents;
+ if (event == gwxLEvent) gwxLEvent = NULL;
+ gwxEvents = event->next;
+
+ *type = event->type;
+ *x = event->x;
+ *y = event->y;
+ *state = event->state;
+ free(event);
+}
+
+/**********************************************************************/
+/**********************************************************************/
+
+
+
+LRESULT CALLBACK
+gwxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ int i, ix, iy;
+ PAINTSTRUCT paint;
+ HDC hdc;
+ POINT point;
+ RECT rect;
+
+ switch (message) {
+
+ case WM_USER:
+ return 0;
+
+ case WM_SIZE:
+ if (hWnd == gwxWin) {
+ if (gwxSize[4]) {
+ ix = LOWORD(lParam);
+ iy = HIWORD(lParam);
+ if ((ix != gwxSize[0]) || (iy != gwxSize[1])) {
+ gwxSize[0] = ix;
+ gwxSize[1] = iy;
+ gwxAddEvent(XExpose, ix, iy, 1);
+ }
+ } else {
+ ix = gwxSize[0] + 2*gwxXmatte;
+ iy = gwxSize[1] + 2*gwxYmatte + gwxYbar;
+ SetWindowPos(hWnd, HWND_TOP, gwxSize[2], gwxSize[3],
+ ix, iy, SWP_NOMOVE|SWP_NOZORDER);
+ }
+ return 0;
+ }
+ return 0;
+
+ case WM_MOVE:
+ if (hWnd == gwxWin) {
+ gwxSize[2] = LOWORD(lParam);
+ gwxSize[3] = HIWORD(lParam);
+ return 0;
+ }
+ return 0;
+
+ case WM_PAINT:
+ /* printf("WM_PAINT\n"); */
+ /*
+ * Validate the region even if there are no DisplayFunc.
+ * Otherwise, USER will not stop sending WM_PAINT messages.
+ */
+ hdc = BeginPaint(hWnd, &paint);
+ BitBlt(hdc,0,0,xrootsize,yrootsize,gwxmemHDC,0,0,SRCCOPY);
+ EndPaint(hWnd, &paint);
+ if (hWnd == gwxWin) {
+ gwxAddEvent(XExpose, gwxSize[0], gwxSize[1], 1);
+ return 0;
+ }
+ return 0;
+
+ case WM_PALETTECHANGED:
+ printf("WM_PALETTECHANGED\n");
+ return 0;
+
+ case WM_ACTIVATE:
+ break;
+
+ case WM_MOUSEMOVE:
+/* printf("mousemove active %d focus %d\n",GetActiveWindow(),GetFocus()); */
+ if (GetActiveWindow() != hWnd) {
+ SetForegroundWindow(hWnd);
+ SetActiveWindow(hWnd);
+ }
+ if (GetFocus() != hWnd) SetFocus(hWnd);
+/* printf("mousemove %d %d\n",hWnd,gwxWin); */
+ return 0;
+
+ case WM_LBUTTONDOWN:
+ if (GetAsyncKeyState(VK_RBUTTON) < 0) {
+ gwxAddEvent(XButtonPress, LOWORD(lParam), HIWORD(lParam), 2);
+ } else {
+ gwxAddEvent(XButtonPress, LOWORD(lParam), HIWORD(lParam), 1);
+ }
+ return 0;
+
+ case WM_LBUTTONUP:
+ if (GetAsyncKeyState(VK_RBUTTON) < 0) {
+ gwxAddEvent(XButtonRelease, LOWORD(lParam), HIWORD(lParam), 2);
+ } else {
+ gwxAddEvent(XButtonRelease, LOWORD(lParam), HIWORD(lParam), 1);
+ }
+ return 0;
+
+ case WM_MBUTTONDOWN:
+ gwxAddEvent(XButtonPress, LOWORD(lParam), HIWORD(lParam), 2);
+ return 0;
+
+ case WM_MBUTTONUP:
+ gwxAddEvent(XButtonRelease, LOWORD(lParam), HIWORD(lParam), 2);
+ return 0;
+
+ case WM_RBUTTONDOWN:
+ if (GetAsyncKeyState(VK_LBUTTON) < 0) {
+ gwxAddEvent(XButtonPress, LOWORD(lParam), HIWORD(lParam), 2);
+ } else {
+ gwxAddEvent(XButtonPress, LOWORD(lParam), HIWORD(lParam), 3);
+ }
+ return 0;
+
+ case WM_RBUTTONUP:
+ if (GetAsyncKeyState(VK_LBUTTON) < 0) {
+ gwxAddEvent(XButtonRelease, LOWORD(lParam), HIWORD(lParam), 2);
+ } else {
+ gwxAddEvent(XButtonRelease, LOWORD(lParam), HIWORD(lParam), 3);
+ }
+ return 0;
+
+ case WM_KEYDOWN:
+ GetCursorPos(&point);
+ GetWindowRect(hWnd, &rect);
+ ix = point.x - rect.left - gwxXmatte;
+ iy = point.y - rect.top - gwxYmatte - gwxYbar;
+ /* gwxAddEvent(XKeyPress, ix, iy, wParam+256); */
+ return 0;
+
+ case WM_KEYUP:
+ GetCursorPos(&point);
+ GetWindowRect(hWnd, &rect);
+ ix = point.x - rect.left - gwxXmatte;
+ iy = point.y - rect.top - gwxYmatte - gwxYbar;
+ i = wParam+256;
+ /* if (i == 300) gwxAddEvent(XKeyPress, ix, iy, i);
+ gwxAddEvent(XKeyRelease, ix, iy, i); */
+ return 0;
+
+ case WM_CHAR:
+ if (wParam == 27) return 0;
+ if ((gwxLast.type != 2) || (gwxLast.state < 352) ||
+ (gwxLast.state > 361) || (gwxLast.state-wParam != 304)) {
+ GetCursorPos(&point);
+ GetWindowRect(hWnd, &rect);
+ ix = point.x - rect.left - gwxXmatte;
+ iy = point.y - rect.top - gwxYmatte - gwxYbar;
+ gwxAddEvent(XKeyPress, ix, iy, wParam);
+ } else {
+ printf("Double Hit: state = %d\n", wParam);
+ }
+ return 0;
+
+ case WM_SYSCOMMAND:
+ /* special code for F10 */
+ if ((lParam == 0) && (wParam == 61696)) {
+ GetCursorPos(&point);
+ GetWindowRect(hWnd, &rect);
+ ix = point.x - rect.left - gwxXmatte;
+ iy = point.y - rect.top - gwxYmatte - gwxYbar;
+ gwxAddEvent(XKeyPress, ix, iy, 377);
+ return 0;
+ }
+ break;
+
+ case WM_CLOSE:
+ gwxAddEvent(XKeyPress, 0, 0, 283);
+ exit;
+ return 0;
+
+ case WM_DESTROY:
+ PostQuitMessage (0) ;
+ return 0 ;
+ }
+ return DefWindowProc( hWnd, message, wParam, lParam);
+}
+
+
+int
+rgb2winrgb(int acol)
+{
+ int col, r, g, b;
+
+ col = acol & 0x00ffffff;
+ r = col >> 16;
+ g = (col >> 8) & 0xff;
+ b = col & 0xff;
+ col = b << 16 | g << 8 | r;
+ return col;
+}
+
+
+
+/* gwxrevflag
+ Get XPLOT11 background default from users environment
+ Parameters:
+ revflag (int*) reverse video flag (0 for white, 1 for black)
+*/
+void W32CALL
+GWXREVFLAG(revflag)
+ int *revflag;
+{
+ char *bufp, *tmp;
+/* check environment variable XPLOT11_BACKGROUND for background color
+ XPLOT11_BACKGROUND = white gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND != white gives white on black plotting (reverse video)
+*/
+ *revflag = 1;
+ bufp = getenv("XPLOT11_BACKGROUND");
+
+/* check lowercased environment for "black" to reverse video */
+ if(bufp) {
+ for(tmp = bufp; *tmp; tmp++)
+ *tmp = tolower(*tmp);
+ *revflag = (strcmp(bufp,"white")!=0);
+ }
+}
+
+
+
+/* gwxopen
+ Open X window display and get size and depth of root window
+ Parameters:
+ xsize,ysize (int*) root window size
+ depth (int*) screen color depth (pixel depth)
+*/
+void W32CALL
+GWXOPEN(int *xsize, int *ysize, int *depth)
+{
+ int i, j, k;
+
+/* set depth arbitrarily to 8 bits to work like Xwindows colormaps */
+ rootdepth = 8;
+ xrootsize = GetSystemMetrics(SM_CXSCREEN);
+ yrootsize = GetSystemMetrics(SM_CYSCREEN);
+
+ *depth = rootdepth;
+ *xsize = xrootsize;
+ *ysize = yrootsize;
+
+ gwxXmatte = GetSystemMetrics(SM_CXFRAME);
+ gwxYmatte = GetSystemMetrics(SM_CYFRAME);
+ gwxYbar = GetSystemMetrics(SM_CYCAPTION) -
+ GetSystemMetrics(SM_CYBORDER);
+ /*
+ printf("Screen is %d x %d\n", *xsize, *ysize);
+ if (gwxXmatte == gwxYmatte) {
+ printf("Window matte is %d\n",gwxXmatte);
+ } else {
+ printf("Window matte is %d x %d\n", gwxXmatte, gwxYmatte);
+ }
+ printf("Title bar height = %d\n", gwxYbar);
+ */
+
+/* check environment variables for default background color
+ XPLOT11_BACKGROUND != black gives black on white plotting (like paper)
+ XPLOT11_BACKGROUND = black gives white on black plotting (reverse video) */
+ GWXREVFLAG(&reversevideo);
+
+/* set up cursor bitmap arrays */
+ /* xcsize = GetSystemMetrics(SM_CXCURSOR);
+ ycsize = GetSystemMetrics(SM_CYCURSOR);
+ if ((xcsize != 16) && (xcsize != 32)) {
+ printf("Unkown Xcursor Size %d\n", xcsize);
+ exit(1);
+ }
+ if ((ycsize != 16) && (ycsize != 32)) {
+ printf("Unkown Ycursor Size %d\n", ycsize);
+ exit(1);
+ }
+ for (i = 0; i < 128; i++) {
+ ANDMask[i] = 0xff;
+ ORNMask[i] = 0;
+ ORWMask[i] = 0;
+ }
+ j = 3;
+ if (xcsize == 16) j = 1;
+ for (k = i = 0; i < 16; i++) {
+ ANDMask[k] = ANDMsk16[i*2];
+ ORNMask[k] = ORNMsk16[i*2];
+ ORWMask[k] = ORWMsk16[i*2];
+ k++;
+ ANDMask[k] = ANDMsk16[i*2+1];
+ ORNMask[k] = ORNMsk16[i*2+1];
+ ORWMask[k] = ORWMsk16[i*2+1];
+ k += j;
+ }
+ */
+
+/* set cursor */
+ gwxWaitC = LoadCursor(NULL, IDC_WAIT);
+ gwxNormalC = LoadCursor(NULL, IDC_CROSS);
+/* gwxNormalC = CreateCursor( gwxInstance, 14, 1, xcsize, ycsize,
+ ANDMask, ORNMask); */
+/* gwxInputC = CreateCursor( gwxInstance, 14, 1, xcsize, ycsize,
+ ANDMask, ORWMask); */
+ gwxCurrentC = gwxNormalC;
+
+
+/* Define window class */
+ gwxInstance = GetModuleHandle(NULL);
+
+ gwxWndClass.cbSize = sizeof(gwxWndClass);
+ gwxWndClass.style = CS_HREDRAW | CS_VREDRAW;
+ gwxWndClass.lpfnWndProc = (WNDPROC)gwxWndProc;
+ gwxWndClass.cbClsExtra = 0;
+ gwxWndClass.cbWndExtra = 0;
+ gwxWndClass.hInstance = gwxInstance;
+ gwxWndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ gwxWndClass.hCursor = gwxNormalC;
+ if(reversevideo) {
+ gwxWndClass.hbrBackground = GetStockObject(BLACK_BRUSH); }
+ else {
+ gwxWndClass.hbrBackground = GetStockObject(WHITE_BRUSH); }
+ gwxWndClass.lpszMenuName = NULL;
+ gwxWndClass.lpszClassName = (LPCSTR)gwxClass;
+
+ /* Register the window class */
+ gwxRegister = RegisterClassEx(&gwxWndClass);
+
+ /* Check for window register, bomb if no joy... */
+ if(gwxRegister == 0) {
+ printf("Failed to register window class\n");
+ exit(1);
+ }
+
+/* initialize private Xevents loop pointers */
+ gwxEvents = NULL;
+ gwxLEvent = NULL;
+
+}
+
+
+
+
+
+GC*
+gwxgc(HWND *window, int *fontsize)
+{
+ GC *gc;
+ int r, g, b, ic;
+
+ gc = (GC *) malloc(sizeof(GC));
+
+ gc->window = *window;
+ if(reversevideo) {
+ gc->fg = RGB(255,255,255);
+ gc->bg = RGB(0 ,0 ,0 );
+ }
+ else {
+ gc->fg = RGB(0 ,0 ,0 );
+ gc->bg = RGB(255,255,255);
+ }
+ gc->pen = CreatePen(PS_SOLID, penwidth, gc->fg);
+ gc->fgbrush = CreateSolidBrush(gc->fg);
+ gc->bgbrush = CreateSolidBrush(gc->bg);
+ gc->font = *fontsize;
+ gc->fun = GXcopy; /* copy */
+
+ return gc;
+}
+
+
+void
+gwxfreegc(GC **gc)
+{
+ GC *gcontext;
+
+ gcontext = *gc;
+ DeleteObject(gcontext->pen);
+ DeleteObject(gcontext->fgbrush);
+ DeleteObject(gcontext->bgbrush);
+ free(*gc);
+}
+
+
+void
+gwxgcfun(int *fun)
+{
+ GC *gcontext;
+
+ gcontext = gwxGC;
+ gcontext->fun = *fun;
+}
+
+
+
+void
+Thread1(PVOID pvoid)
+{
+ HWND winFocus, winFG, win;
+// HWND winF77;
+ RECT WinRect ,oldrect;
+ POINT point;
+ int fontsize;
+// int lunit;
+
+ /* printf("\nEntering display thread\n"); */
+ /*
+ * Make window large enough to hold a client area compensating for borders
+ */
+ WinRect.left = wxstart;
+ WinRect.right = wxstart + wxsize + 2*gwxXmatte;
+ WinRect.top = wystart;
+ WinRect.bottom = wystart + wysize + 2*gwxYmatte + gwxYbar;
+
+ /*
+ printf("\nwxstart %d wystart %d \n",wxstart,wystart);
+ printf("\nwxsize %d wysize %d \n",wxsize,wysize);
+
+ printf("\nsetting rectangle left %d right %d \n",WinRect.left,WinRect.right);
+ printf("\nsetting rectangle top %d bot %d \n",WinRect.top,WinRect.bottom);
+ */
+
+ winFG = GetForegroundWindow();
+ winFocus = GetActiveWindow();
+ GetWindowRect(winFG, &oldrect);
+ /*
+ printf("Entry conditions:\n foreground %d/n orig focus %d\n",winFG,winFocus);
+ printf("\nold rectangle left %d right %d \n",oldrect.left,oldrect.right);
+ printf("\nold rectangle top %d bot %d \n",oldrect.top,oldrect.bottom);
+ */
+
+ /* lunit = 5;
+ winF77 = fgethwndqq(&lunit);
+ printf("\nEntry conditions DVF window: %d/n",winF77);
+ */
+
+/* Must use WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles. */
+
+ gwxWin = CreateWindow( gwxClass, gwxClass,
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ WinRect.left, WinRect.top,
+ WinRect.right - WinRect.left, WinRect.bottom - WinRect.top,
+ NULL, NULL, gwxInstance, NULL );
+
+ if (gwxWin == NULL) {
+ fprintf(stderr, "Error: NULL window handle.\n");
+ exit(1);
+ }
+
+ ShowWindow(gwxWin, SW_SHOWDEFAULT);
+ UpdateWindow(gwxWin);
+
+ gwxHDC = GetDC(gwxWin);
+ if (gwxHDC == NULL) {
+ fprintf(stderr, "Error: NULL window DC.\n");
+ exit(1);
+ }
+
+ /* Create compatible window bitmap */
+ gwxmemHDC = CreateCompatibleDC(gwxHDC);
+ gwxBMAP = CreateCompatibleBitmap(gwxHDC,xrootsize,yrootsize);
+ SelectObject(gwxmemHDC, gwxBMAP);
+
+ SelectObject(gwxmemHDC, GetStockObject(ANSI_VAR_FONT));
+ SetTextAlign(gwxmemHDC, TA_LEFT | TA_BASELINE | TA_NOUPDATECP);
+ SetBkMode(gwxmemHDC, TRANSPARENT);
+
+ gwxSize[0] = wxsize;
+ gwxSize[1] = wysize;
+ gwxSize[2] = wxstart + 2*gwxXmatte;
+ gwxSize[3] = wystart + 2*gwxYmatte + gwxYbar;
+ gwxSize[4] = 1;
+ SetWindowPos(gwxWin, HWND_TOP, gwxSize[2], gwxSize[3],
+ wxsize, wysize, SWP_NOMOVE|SWP_NOZORDER);
+
+ /* SetWindowPos(gwxWin, HWND_TOP, 0,0, 0,0, SWP_NOMOVE | SWP_NOSIZE ); */
+ SetForegroundWindow(gwxWin);
+
+
+ nRGBmap = 0;
+ penwidth = 0;
+ penpattern = -1;
+ ndash = 0;
+ fontsize = 1;
+
+ gwxGC = gwxgc(&gwxWin, &fontsize);
+ SelectObject(gwxmemHDC, gwxGC->pen);
+
+ /* initially clear the background bitmap */
+ SelectObject(gwxmemHDC, gwxGC->bgbrush);
+ PatBlt(gwxmemHDC, 0, 0, xrootsize, yrootsize, PATCOPY);
+
+ SelectObject(gwxmemHDC, gwxGC->fgbrush);
+
+ /* allocate black and white colors */
+/* r = 0;
+ g = 0;
+ b = 0;
+ GWXALLOCRGBCOLOR(&r,&g,&b,&ic);
+ r = 0;
+ g = 0;
+ b = 0;
+ GWXALLOCRGBCOLOR(&r,&g,&b,&ic);
+*/
+
+ /* printf("entering message loop\n\n"); */
+
+ initthread = 1;
+
+ /* while (GetMessage(&Message, NULL, 0, 0)) { */
+
+ /* Custom message loop to check cursor window to do X-style focus */
+
+ while (1) {
+ if(PeekMessage(&Message, gwxWin, 0, 0, PM_REMOVE)) {
+
+ if(Message.message==WM_QUIT)
+ break;
+
+ TranslateMessage(&Message);
+ DispatchMessage(&Message);
+ Sleep(1);
+ }
+ else {
+ GetCursorPos(&point);
+ win = WindowFromPoint(point);
+ /* printf("pos x %d y %d win %d\n",point.x,point.y,win); */
+
+ /* if(win==winF77) {
+ SetActiveWindow(win);
+ SetFocus(win);
+ SetForegroundWindow(win);
+ } */
+ /* if(win == winFG) {
+ printf("pos x %d y %d win %d winFG %d\n",point.x,point.y,win,winFG);
+ SetActiveWindow(winFG);
+ SetFocus(winFG);
+ SetForegroundWindow(winFG);
+ } */
+ Sleep(1);
+ }
+ }
+
+ /* printf("window thread ending\n"); */
+/* return Message.wParam;
+ exit; */
+
+ _endthread();
+}
+
+
+/* gwxwinopen
+ Open window of specified size and position, return size and depth
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+
+void W32CALL
+GWXWINOPEN (int *xstart, int *ystart, int *xsize, int *ysize)
+{
+ /*
+ printf("GWXOPEN\nxstart %d\nystart %d\nxsize %d\nysize %d\n",*xstart,*ystart,*xsize,*ysize);
+ */
+ wxstart = *xstart;
+ wystart = *ystart;
+ wxsize = *xsize;
+ wysize = *ysize;
+
+ /* Start the window thread */
+ initthread = 0;
+ _beginthread(Thread1,0,NULL);
+ /* printf("beginthread called\n"); */
+
+ while(!initthread) {
+ Sleep(5);
+ }
+
+
+}
+
+
+
+
+void W32CALL
+GWXDESTROY()
+{
+ ReleaseDC( gwxWin, gwxHDC );
+ ReleaseDC( gwxWin, gwxmemHDC );
+}
+
+
+void W32CALL
+GWXCLOSE()
+{
+ PostQuitMessage (0) ;
+ /* DestroyCursor(gwxNormalC);
+ DestroyCursor(gwxInputC); */
+ UnregisterClass((LPCSTR)gwxClass, gwxInstance);
+}
+
+
+void W32CALL
+GWXFLUSH()
+{
+ BitBlt(gwxHDC,0,0,xrootsize,yrootsize,gwxmemHDC,0,0,SRCCOPY);
+ /* InvalidateRect(gwxWin,NULL,1); */
+}
+
+
+/* gwxreset
+ Reset graphics context to default
+ Parameters: None
+*/
+void W32CALL
+GWXRESET()
+{
+}
+
+
+/* getPEN
+ Creates pen using type, color, width, pattern
+*/
+HPEN
+makenewpen()
+{
+ HPEN newpen;
+ LOGBRUSH lb;
+ GC *gcontext;
+
+ gcontext = gwxGC;
+
+ /* printf("makenewpen\n ndash %d\n lmask %d\n fg %d\n width %d\n",ndash,penpattern,gcontext->fg,penwidth); */
+
+ if(ndash == 0) {
+ if(penpattern == 0) {
+ /* printf("making penpattern 0\n"); */
+ newpen = CreatePen(PS_SOLID, penwidth, gcontext->bg);
+ }
+ if (penpattern == -1) {
+ /* printf("making penpattern -1\n"); */
+ newpen = CreatePen(PS_SOLID, penwidth, gcontext->fg);
+ }
+ }
+ else {
+ /* printf("making dash pen\n"); */
+ newpen = CreatePen(PS_DOT, 0, gcontext->fg);
+/*
+ lb.lbStyle = BS_SOLID;
+ lb.lbColor = gcontext->fg;
+ lb.lbHatch = 0;
+ newpen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE,
+ penwidth, &lb, ndash, pendash);
+ */
+ }
+ return newpen;
+}
+
+int
+GWXNUMEVENTS()
+{
+ int stat;
+
+ stat = 1;
+ if (gwxEvents == NULL) stat = 0;
+ return stat;
+}
+
+
+void
+GWXEVENT(int *type, int *x, int *y, int *state)
+{
+ gwxRemEvent(type, x, y, state);
+}
+
+
+int
+GWXGETEVENT(int *type, int *x, int *y, int *state)
+{
+ int stat;
+ Event *event;
+
+ stat = -1;
+ event = gwxEvents;
+ gwxLEvent = NULL;
+ while (event != NULL) {
+ if ((*type == event->type) && (stat == -1)) {
+ *x = event->x;
+ *y = event->y;
+ *state = event->state;
+ stat = 0;
+ if (gwxLEvent == NULL) {
+ gwxEvents = event->next;
+ } else {
+ gwxLEvent->next = event->next;
+ }
+ free(event);
+ event = NULL;
+ if (gwxLEvent != NULL) event = gwxLEvent->next;
+ } else {
+ gwxLEvent = event;
+ event = event->next;
+ }
+ }
+ return stat;
+}
+
+
+
+
+
+
+/* gwxstatus
+ Return current window status (position, size)
+ Parameters:
+ xstart,ystart (int*) upper left corner coordinates in root
+ xsize,ysize (int*) desired window size
+*/
+void W32CALL
+GWXSTATUS(int *xstart, int *ystart, int *xsize, int *ysize)
+
+{
+ RECT rect;
+
+ /*
+ GetClientRect(gwxWin, &rect);
+ printf("\nstatus rectangle left %d right %d \n",rect.left,rect.right);
+ printf("\n top %d bot %d \n",rect.top,rect.bottom);
+ */
+ GetWindowRect(gwxWin, &rect);
+ *xstart = rect.left;
+ *ystart = rect.top;
+ *xsize = rect.right - rect.left - 2*gwxXmatte;
+ *ysize = rect.bottom - rect.top - 2*gwxYmatte - gwxYbar;
+
+ /*
+ printf("\nstatus xstart %d ystart %d \n",*xstart,*ystart);
+ printf("\n xsize %d ysize %d \n",*xsize,*ysize);
+ printf("\nstatus rectangle left %d right %d \n",rect.left,rect.right);
+ printf("\n top %d bot %d \n",rect.top,rect.bottom);
+ */
+}
+
+
+
+/* gwxresize
+ Resize screen window to x width, y height
+ Parameters:
+ x (int*) new width
+ y (int*) new height
+*/
+void W32CALL
+GWXRESIZE(x, y)
+ int *x, *y;
+{
+ int ix, iy;
+
+ gwxSize[0] = *x;
+ gwxSize[1] = *y;
+ ix = gwxSize[0] + 2*gwxXmatte;
+ iy = gwxSize[1] + 2*gwxYmatte + gwxYbar;
+ SetWindowPos(gwxWin, HWND_TOP, gwxSize[2], gwxSize[3],
+ ix, iy, SWP_NOMOVE|SWP_NOZORDER);
+}
+
+
+/* gwxclear
+ Clear current plot window
+ Parameters: None
+*/
+void W32CALL
+GWXCLEAR()
+{
+ int i;
+ RECT WinRect;
+
+ WinRect.left = 0;
+ WinRect.right = gwxSize[0] + 2*gwxXmatte;
+ WinRect.top = 0;
+ WinRect.bottom = gwxSize[1] + 2*gwxYmatte + gwxYbar;
+ FillRect(gwxmemHDC, &WinRect, gwxGC->bgbrush);
+ return;
+}
+
+
+/* gwxdisplaybuffer
+ Switches background buffer onto foreground window, displaying accumulated
+ graphics
+ Parameters: None
+*/
+void W32CALL
+GWXDISPLAYBUFFER()
+{
+}
+
+
+/* gwxdrawtobuffer
+ Switches graphics to draw to the background buffer
+ Parameters: None
+*/
+void W32CALL
+GWXDRAWTOBUFFER()
+{
+/* printf("called gwxdrawtobuffer\n"); */
+}
+
+/* gwxdrawtowindow
+ Switches graphics to draw to the foreground window
+ Parameters: None
+*/
+void W32CALL
+GWXDRAWTOWINDOW()
+{
+/* printf("called gwxdrawtowindow\n"); */
+}
+
+
+void W32CALL
+GWXSTRING(int *x, int *y, char *text, int *length)
+{
+ int i, xs, ys;
+ GC *gcontext;
+
+ xs = *x + gwxXmatte;
+ ys = *y + gwxYmatte;
+
+ gcontext = gwxGC;
+ if (gcontext->font != 3) {
+ SelectObject(gwxmemHDC, GetStockObject(ANSI_VAR_FONT));
+ } else {
+ SelectObject(gwxmemHDC, GetStockObject(SYSTEM_FONT));
+ }
+ SetTextColor(gwxmemHDC, gcontext->fg);
+ SetBkColor (gwxmemHDC, TRANSPARENT);
+ TextOut(gwxmemHDC, xs, ys, text, *length);
+}
+
+
+/* gwxline
+ Draw line from x1,y1 to x2,y2
+ Parameters:
+ x1,y1 (int*) starting position for line
+ x2,y2 (int*) ending position for line
+*/
+void W32CALL
+GWXLINE(int *x1, int *y1, int *x2, int *y2)
+{
+ int i, xs, ys;
+
+ xs = *x1;
+ ys = *y1;
+ MoveToEx(gwxmemHDC, xs, ys, NULL);
+ xs = *x2;
+ ys = *y2;
+ LineTo(gwxmemHDC, xs, ys);
+}
+
+
+/* gwxlinez
+ Draw polyline on window in current color and pen
+ Parameters:
+ ix (int*) array of x coordinates on polyline
+ iy (int*) array of y coordinates on polyline
+ n (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void W32CALL
+GWXLINEZ(int *ix, int *iy, int *n)
+{
+ int i, xs, ys;
+
+ POINT points[MAXPTS];
+
+ if (*n > MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxlinez: Too many points in polyline\n");
+ printf("Xplot11.gwxlinez: Too many points in polyline\n");
+ return;
+ }
+
+ for(i=0; i < *n; i++) {
+ points[i].x = ix[i];
+ points[i].y = iy[i];
+/* printf("gwxlinez x %d y %d \n",ix[i],iy[i]); */
+ }
+ Polyline(gwxmemHDC, points, *n);
+}
+
+
+/* gwxpoly
+ Draw filled polyline on window in current color and pen
+ Parameters:
+ x_coord (int*) array of x coordinates on polyline
+ y_coord (int*) array of y coordinates on polyline
+ n_coord (int*) number of coordinate points
+ (see define for MAXPTS at start of this file)
+*/
+void W32CALL
+GWXPOLY(x_coord, y_coord, n_coord)
+ int *x_coord, *y_coord, *n_coord;
+
+{ POINT points[MAXPTS];
+ int i,n;
+
+ if (*n_coord >= MAXPTS) {
+ fprintf(stderr,"Xplot11.gwxpoly: Too many points in polyline\n");
+ printf("Xplot11.gwxpoly: Too many points in polyline\n");
+ return;
+ }
+
+ for (i=0; i < *n_coord; i++) {
+ points[i].x = x_coord[i];
+ points[i].y = y_coord[i];
+
+ }
+ n = *n_coord;
+/* if the polyline is not closed, duplicate first point to ensure closed
+
+ perimeter (speeds up X graphics drastically) */
+ if ( (points[n-1].x != points[0].x) ||
+ (points[n-1].y != points[0].y) ) {
+ points[n].x = points[0].x;
+ points[n].y = points[0].y;
+ n++;
+ }
+ Polygon(gwxmemHDC, points, n);
+}
+
+
+void W32CALL
+GWXARC(int *xc, int *yc,
+ int *xr, int *yr, float *alpha, float *beta)
+{
+ int i, j, xs, ys;
+
+ /* only does circles! */
+
+ xs = *xc + *xr;
+ ys = *yc;
+ MoveToEx(gwxmemHDC, xs, ys, NULL);
+ for (j = 2; j <= 360; j += 2) {
+ xs = (int) ((double)*xc + (double)*xr*cos((double)j*0.017453292));
+ ys = (int) ((double)*yc + (double)*yr*sin((double)j*0.017453292));
+ LineTo(gwxmemHDC, xs, ys);
+ }
+}
+
+void W32CALL
+GWXCURS(int *x, int *y, int *state)
+{
+int type;
+
+/* Eat up all the current events first */
+
+ while(GWXNUMEVENTS()) {
+ GWXEVENT(&type, x, y, state);
+ /* printf("eat up event %d\n",type); */
+ }
+/* Now run an event loop until a buttonpress or keypress is found */
+
+ while(1) {
+ if(GWXNUMEVENTS()) {
+ GWXEVENT(&type, x, y, state);
+ /* printf("get event %d\n",type); */
+ switch (type) {
+ case XKeyPress:
+ return;
+
+ case XButtonPress:
+ return;
+ }
+ }
+ }
+}
+
+
+void W32CALL
+GWXCURS2(int *x, int *y, int *state)
+{
+ int i, key;
+ POINT point;
+
+ key = 0;
+ if (GetAsyncKeyState(VK_SHIFT) < 0) key += 1;
+ if (GetAsyncKeyState(VK_CONTROL) < 0) key += 4;
+ if (GetAsyncKeyState(VK_MENU) < 0) key += 8;
+ if (GetAsyncKeyState(VK_LBUTTON) < 0) key += 256;
+ if (GetAsyncKeyState(VK_MBUTTON) < 0) key += 512;
+ if (GetAsyncKeyState(VK_RBUTTON) < 0) key += 1024;
+ if ((GetAsyncKeyState(VK_LBUTTON) < 0) &&
+ (GetAsyncKeyState(VK_RBUTTON) < 0)) key -= 768;
+
+ GetCursorPos(&point);
+
+ *x = -1;
+ *y = -1;
+ *state = 0;
+ *x = point.x - gwxSize[2];
+ *y = point.y - gwxSize[3];
+ *state = key;
+}
+
+
+HWND W32CALL
+GWXCURRENTPOINTER(int *x, int *y)
+{
+ POINT point;
+ RECT rect;
+ HWND win;
+
+ GetCursorPos(&point);
+ win = WindowFromPoint(point);
+ GetWindowRect(win, &rect);
+ *x = point.x - rect.left;
+ *y = point.y - rect.top;
+ return win;
+}
+
+
+void W32CALL
+GWXSETPOINTER(HWND win, int *x, int *y)
+{
+ int ix, iy;
+ RECT rect;
+
+ if (GetActiveWindow() != win) SetActiveWindow(win);
+ if (GetFocus() != win) SetFocus(win);
+ if (GetForegroundWindow() != win) SetForegroundWindow(win);
+ GetWindowRect(win, &rect);
+ ix = *x + rect.left;
+ iy = *y + rect.top;
+ SetCursorPos(ix, iy);
+}
+
+
+
+
+/* gwxdash
+ Set line drawing pattern to mask pattern
+ Parameters:
+ mask (int*) integer mask value (bits set pen pattern for lines)
+*/
+void W32CALL
+GWXDASH(int* lmask)
+{
+GC *gcontext;
+int i, ndsh;
+HPEN oldpen;
+
+ penpattern = *lmask;
+ gcontext = gwxGC;
+
+ if(*lmask==0) {
+ ndash = 0;
+ }
+ else if(*lmask==-1) {
+ ndash = 0;
+ }
+ else {
+ (void) MSKBITS(lmask,pendash,&ndsh);
+ ndash = ndsh;
+/* for(i=1; i<=ndash; i++) printf("%d dashes %d\n",i,pendash[i-1]); */
+ }
+ oldpen = gcontext->pen;
+ gcontext->pen = makenewpen();
+ oldpen = SelectObject(gwxmemHDC, gcontext->pen);
+ DeleteObject(oldpen);
+}
+
+
+
+/* gwxpen
+ Set pen width for line drawing
+ Parameters:
+ ipen (int*) integer pen width
+*/
+void W32CALL
+GWXPEN(int* ipen)
+{
+GC *gcontext;
+HPEN oldpen;
+
+ penwidth = *ipen;
+ gcontext = gwxGC;
+ oldpen = gcontext->pen;
+ gcontext->pen = makenewpen();
+ oldpen = SelectObject(gwxmemHDC, gcontext->pen);
+ DeleteObject(oldpen);
+}
+
+
+/* mskbits
+ Utility routine to convert lower 16 bits of pattern mask
+ into pattern array of on/off bit lengths. The 16
+ bits of ipat can contain up to 16 on/off bit lengths.
+ i.e. 0XAAAAAAA produces ibits=(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
+ i.e. 0XCCCCCCC produces ibits=(2,2,2,2,2,2,2,2)
+ The output pattern stored in integer array ibits=(#on,#off,#on,#off,etc.)
+ Parameters:
+ mask (int*) input mask
+ ibits (int*) output pattern string (#on, #off...)
+ ndash (int*) number of entries in pattern array
+*/
+void
+MSKBITS(int* mask, int* ibits, int* ndash)
+{
+#define BITSINMASK 16 /* use only lower 16 bits of mask word */
+
+int i,ic,ibit,ibitold;
+int nbits, nshft;
+unsigned short lmask;
+
+/* shift mask until low bit is 1, filling high bits with 0's */
+ lmask = *mask;
+ nshft = 0;
+
+ if(lmask!=0) {
+ while (!(ibitold = (lmask & 0x01)))
+ lmask >>= 1;
+ nshft++;
+ }
+/* if no 1 bits just exit with no dashes set */
+ if(ibitold==0) {
+ *ndash = 0;
+ exit;
+ }
+
+/* cycle through the lower 'length-nshft' bits
+ checking for number of contiguous same bits,
+ store into ibits array */
+ nbits = ic = 0;
+
+ for (i=0; i<(BITSINMASK-nshft); ++i) {
+
+ ibit=(lmask & 0x01);
+
+ if(ibit != ibitold) {
+ ibits[ic++] = nbits;
+ nbits = 0;
+ }
+
+ ibitold = ibit;
+ nbits++;
+
+ lmask >>= 1;
+ }
+
+/* add bits at end of shifted bits including any initial shift
+ to find the first 1 in the low bit */
+ if(ibit==1) {
+
+ ibits[ic++] = nbits;
+ if(nshft>0)
+ ibits[ic++] = nshft;
+
+ }
+ else
+ ibits[ic++] = nbits + nshft;
+
+ *ndash = ic;
+}
+
+
+
+
+/* gwxsetcolor
+ Set foreground color to stored colormap pixel value
+ Parameters:
+ icol (int*) index of pixel value (mapped in colormap)
+*/
+void W32CALL
+GWXSETCOLOR(icol)
+ int *icol;
+{
+ int ic, n, fg;
+ GC *gcontext;
+ HPEN oldpen;
+
+/* is the color index in range for stored colormap data? */
+ ic = *icol;
+/* find the color in the table */
+ for (n=0; n < nRGBmap; n++) {
+ if(ic == RGBmap[n].ic) {
+ fg = RGBmap[n].rgb;
+ gcontext = gwxGC;
+ gcontext->fg = rgb2winrgb(fg);
+/* printf("gwxsetfgcolor fg %d wfg %d\n",*fg,gcontext->fg); */
+ gcontext->pen = makenewpen();
+ gcontext->fgbrush = RGBmap[n].brush;
+ oldpen = SelectObject(gwxmemHDC, gcontext->pen);
+ DeleteObject(oldpen);
+ SelectObject(gwxmemHDC, gcontext->fgbrush);
+ return;
+ }
+ }
+ fprintf(stderr,"Xplot11.gwxsetcolor: color index %d out of range\n",*icol);
+
+ printf("Xplot11.gwxsetcolor: color index %d out of range\n",*icol);
+}
+
+
+
+/* gwxsetbgcolor
+ Set background color to pixel value
+ Parameters:
+ pixel (int*) pixel value (mapped in colormap)
+*/
+void W32CALL
+GWXSETBGCOLOR(icol)
+ int *icol;
+{
+ int ic, n, bg;
+ GC *gcontext;
+/* is the color index in range for stored colormap data? */
+ ic = *icol;
+/* find the color in the table */
+ for (n=0; n < nRGBmap; n++) {
+ if(ic == RGBmap[n].ic) {
+ bg = RGBmap[n].rgb;
+ gcontext = gwxGC;
+ gcontext->bg = rgb2winrgb(bg);
+ gcontext->bgbrush = RGBmap[n].brush;
+ return;
+ }
+ }
+ fprintf(stderr,"Xplot11.gwxsetbgcolor: color index %d out of range\n",*icol);
+ printf("Xplot11.gwxsetbgcolor: color index %d out of range\n",*icol);
+}
+
+
+
+/* gwxcolorname2rgb
+ Find r,g,b components for color specified by name string
+ Parameters:
+ red,grn,blu (int*) output color components (0-255)
+ nc (int*) string length (# of chars)
+ colorname (char*) string containing name of valid color
+ Note: color names are not case sensitive
+ len (int) fortran appended string length (passed by value)
+
+ Valid color names are any color name that is known to X11 color database
+ Examples are "Black","White","Yellow","Orange","Red","Green",
+ "Cyan","Blue","Magenta", "ivory", etc.
+*/
+void W32CALL
+GWXCOLORNAME2RGB(int *red, int *grn, int *blu,
+ int *nc, char *colorname, int len)
+{
+ char cname[32];
+ int i,n;
+ int irgb;
+
+ n = *nc;
+ /* copy string to avoid overwriting possibly static input string
+ Note that string length is explicitly passed to avoid compatibility
+ problems with by fortran character arg length */
+ if(n>31) {
+ n = 31;
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' truncated\n",cname);
+ }
+ strncpy(cname,colorname,n);
+ cname[n] = '\0';
+
+ *red = -1;
+ *grn = -1;
+ *blu = -1;
+ if (!gwxlookupcolor(cname,&irgb)) {
+ fprintf(stderr,"Xplot11.gwxcolorname2rgb: color name '%s' not found\n",
+ cname);
+ printf("Xplot11.gwxcolorname2rgb: color name '%s' not found\n",cname);
+ return;
+ }
+ *red = 0x000000ff & (irgb >> 16);
+ *grn = 0x000000ff & (irgb >> 8);
+ *blu = 0x000000ff & (irgb);
+
+ /*
+ printf("gwxcolorname2rgb red = %d\ngrn = %d\nblu = %d\n",*red,*grn,*blu);
+ */
+}
+
+
+int
+gwxlookupcolor (char *colorname, int *irgb)
+{
+ int IC,ic,ncolors;
+ int i;
+ char cname[32], *ctmp;
+
+ IC = sizeof(Colordef);
+ ic = sizeof(colordef);
+ ncolors = ic/IC;
+
+ /*
+ printf("Colordef %d\n",IC);
+ printf("colordef %d\n",ic);
+ printf("#entries %d\n",ncolors);
+ */
+
+ if(ctmp=strcpy(cname,colorname)) {
+ for(ctmp = cname; *ctmp; ctmp++)
+ *ctmp = tolower(*ctmp);
+ }
+ /* printf("cname %s\n",cname); */
+
+ for (i=0; i < ncolors; i++) {
+ if(!strcmp(colordef[i].name,cname)) {
+ /* printf("found string %s code %d\n",colordef[i].name,colordef[i].rgb); */
+ *irgb = colordef[i].rgb;
+ return(1);
+ }
+ }
+ return(0);
+}
+
+
+/* gwxallocrgbcolor
+ Allocate a color in colormap specified by r,g,b components
+
+ Parameters:
+ red,grn,blu (int*) input color components (0-255)
+ ic (int*) returned color index or pixel value
+*/
+void W32CALL
+GWXALLOCRGBCOLOR(int *red, int *grn, int *blu, int *ic)
+{
+ int rgb,col;
+ int i;
+
+ rgb = ((0xff & *red) << 16) | ((0xff & *grn) << 8) | (0xff & *blu);
+ *ic = -1;
+
+ /* printf("red %d\ngrn %d\nblu %d\nrgb %d\n",*red,*grn,*blu,rgb); */
+
+/* check for rgb color already allocated in table */
+
+ if(nRGBmap > 0) {
+ for (i=0; i < nRGBmap; i++) {
+ if(rgb == RGBmap[i].rgb) {
+ *ic = RGBmap[i].ic;
+ /* printf("found color %d in table at %d index %d\n",rgb,i+1,*ic); */
+ return;
+ }
+ }
+ }
+/* this color's RGB was not in table, allocate it to table
+ if there is room allocate a new color */
+
+ if(nRGBmap < MAXCOLS) {
+ RGBmap[nRGBmap].rgb = rgb;
+ RGBmap[nRGBmap].ic = nRGBmap+1;
+ col = rgb2winrgb(rgb);
+ RGBmap[nRGBmap].pen = NULL;
+ RGBmap[nRGBmap].brush = CreateSolidBrush(col);
+ nRGBmap++;
+ *ic = nRGBmap;
+ /* printf("allocating color table entry %d at %d\n",*ic,nRGBmap-1); */
+ }
+ else {
+ fprintf (stderr,"Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ printf ("Xplot11.gwxallocrgbcolor: can't allocate color.\n");
+ }
+}
+
+
+/* gwxfreecolor
+ Free a color from color map
+ Parameters:
+ pix (int*) pixel in colormap
+*/
+void W32CALL
+GWXFREECOLOR(int *icol)
+{
+ int i,ic,n;
+
+/* is the color index in range for stored colormap data? */
+ ic = *icol;
+/* printf("color to delete %d\n",ic); */
+ if((ic > 0) && (ic <= MAXCOLS)) {
+
+/* find the color in the table */
+/* printf("checking colortable of size %d\n",nRGBmap); */
+ for (n=0; n < nRGBmap; n++) {
+/* printf("comparing RGBmap %d with %d to %d\n",n,RGBmap[n].ic,ic); */
+ if(ic == RGBmap[n].ic) {
+/* delete the table entry */
+/* printf("found color %d to delete at %d\n",ic,n); */
+
+ if(RGBmap[n].pen) DeleteObject(RGBmap[n].pen);
+ if(RGBmap[n].brush) DeleteObject(RGBmap[n].brush);
+
+ if(n < nRGBmap-1) {
+ for (i=n; i < nRGBmap; i++) {
+ RGBmap[i-1].rgb = RGBmap[i].rgb;
+ RGBmap[i-1].ic = RGBmap[i].ic;
+ RGBmap[i-1].pen = RGBmap[i].pen;
+ RGBmap[i-1].brush = RGBmap[i].brush;
+ }
+ }
+ nRGBmap--;
+/* printf("deleted color %d\n",*icol); */
+ return;
+ }
+ }
+ }
+ fprintf(stderr,"Xplot11.gwxfreecolor: color index %d out of range\n",*icol);
+ printf("Xplot11.gwxfreecolor: color index %d out of range\n",*icol);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plotlib/win32/Xdefs.h b/plotlib/win32/Xdefs.h
new file mode 100644
index 0000000..d742315
--- /dev/null
+++ b/plotlib/win32/Xdefs.h
@@ -0,0 +1,60 @@
+
+/* Event definitions from Xwindows */
+#define XKeyPress 2
+#define XKeyRelease 3
+#define XButtonPress 4
+#define XButtonRelease 5
+#define XMotionNotify 6
+#define XEnterNotify 7
+#define XLeaveNotify 8
+#define XFocusIn 9
+#define XFocusOut 10
+#define XKeymapNotify 11
+#define XExpose 12
+#define XGraphicsExpose 13
+#define XNoExpose 14
+#define XCreateNotify 16
+#define XDestroyNotify 17
+#define XUnmapNotify 18
+#define XMapNotify 19
+#define XMapRequest 20
+#define XReparentNotify 21
+#define XConfigureNotify 22
+#define XConfigureRequest 23
+#define XGravityNotify 24
+#define XResizeRequest 25
+#define XCirculateNotify 26
+#define XCirculateRequest 27
+#define XPropertyNotify 28
+#define XSelectionClear 29
+#define XSelectionRequest 30
+#define XSelectionNotify 31
+#define XColormapNotify 32
+#define XClientMessage 33
+#define XMappingNotify 34
+#define XLASTEvent 35
+
+/* Graphics functions (src to dest) from Xwindows */
+#define GXclear 0
+#define GXand 1
+#define GXandReverse 2
+#define GXcopy 3
+#define GXandInverted 4
+#define GXnoop 5
+#define GXxor 6
+#define GXor 7
+#define GXnor 8
+#define GXequiv 9
+#define GXinvert 10
+#define GXorReverse 11
+#define GXcopyInverted 12
+#define GXorInverted 13
+#define GXnand 14
+#define GXset 15
+
+/* Synchronization functions from Xwindows */
+#define XFDIOff 0
+#define XFDIOn 1
+#define XFDINotThere 2
+
+
diff --git a/plotlib/win32/rgbtbl.h b/plotlib/win32/rgbtbl.h
new file mode 100644
index 0000000..c09cc2f
--- /dev/null
+++ b/plotlib/win32/rgbtbl.h
@@ -0,0 +1,765 @@
+/* RGB lookup table
+ duplicates Xwindows rgb.txt as a color name to integer RGB table
+ H.Youngren 3/99
+*/
+
+typedef struct {
+ char *name;
+ unsigned int rgb;
+} Colordef;
+
+static Colordef colordef[] = {
+"snow", 16775930,
+"ghost white", 16316671,
+"ghostwhite", 16316671,
+"white smoke", 16119285,
+"whitesmoke", 16119285,
+"gainsboro", 14474460,
+"floral white", 16775920,
+"floralwhite", 16775920,
+"old lace", 16643558,
+"oldlace", 16643558,
+"linen", 16445670,
+"antique white", 16444375,
+"antiquewhite", 16444375,
+"papaya whip", 16773077,
+"papayawhip", 16773077,
+"blanched almond", 16772045,
+"blanchedalmond", 16772045,
+"bisque", 16770244,
+"peach puff", 16767673,
+"peachpuff", 16767673,
+"navajo white", 16768685,
+"navajowhite", 16768685,
+"moccasin", 16770229,
+"cornsilk", 16775388,
+"ivory", 16777200,
+"lemon chiffon", 16775885,
+"lemonchiffon", 16775885,
+"seashell", 16774638,
+"honeydew", 15794160,
+"mint cream", 16121850,
+"mintcream", 16121850,
+"azure", 15794175,
+"alice blue", 15792383,
+"aliceblue", 15792383,
+"lavender", 15132410,
+"lavender blush", 16773365,
+"lavenderblush", 16773365,
+"misty rose", 16770273,
+"mistyrose", 16770273,
+"white", 16777215,
+"black", 0,
+"dark slate gray", 3100495,
+"darkslategray", 3100495,
+"dark slate grey", 3100495,
+"darkslategrey", 3100495,
+"dim gray", 6908265,
+"dimgray", 6908265,
+"dim grey", 6908265,
+"dimgrey", 6908265,
+"slate gray", 7372944,
+"slategray", 7372944,
+"slate grey", 7372944,
+"slategrey", 7372944,
+"light slate gray", 7833753,
+"lightslategray", 7833753,
+"light slate grey", 7833753,
+"lightslategrey", 7833753,
+"gray", 12500670,
+"grey", 12500670,
+"light grey", 13882323,
+"lightgrey", 13882323,
+"light gray", 13882323,
+"lightgray", 13882323,
+"midnight blue", 1644912,
+"midnightblue", 1644912,
+"navy", 128,
+"navy blue", 128,
+"navyblue", 128,
+"cornflower blue", 6591981,
+"cornflowerblue", 6591981,
+"dark slate blue", 4734347,
+"darkslateblue", 4734347,
+"slate blue", 6970061,
+"slateblue", 6970061,
+"medium slate blue", 8087790,
+"mediumslateblue", 8087790,
+"light slate blue", 8679679,
+"lightslateblue", 8679679,
+"medium blue", 205,
+"mediumblue", 205,
+"royal blue", 4286945,
+"royalblue", 4286945,
+"blue", 255,
+"dodger blue", 2003199,
+"dodgerblue", 2003199,
+"deep sky blue", 49151,
+"deepskyblue", 49151,
+"sky blue", 8900331,
+"skyblue", 8900331,
+"light sky blue", 8900346,
+"lightskyblue", 8900346,
+"steel blue", 4620980,
+"steelblue", 4620980,
+"light steel blue", 11584734,
+"lightsteelblue", 11584734,
+"light blue", 11393254,
+"lightblue", 11393254,
+"powder blue", 11591910,
+"powderblue", 11591910,
+"pale turquoise", 11529966,
+"paleturquoise", 11529966,
+"dark turquoise", 52945,
+"darkturquoise", 52945,
+"medium turquoise", 4772300,
+"mediumturquoise", 4772300,
+"turquoise", 4251856,
+"cyan", 65535,
+"light cyan", 14745599,
+"lightcyan", 14745599,
+"cadet blue", 6266528,
+"cadetblue", 6266528,
+"medium aquamarine", 6737322,
+"mediumaquamarine", 6737322,
+"aquamarine", 8388564,
+"dark green", 25600,
+"darkgreen", 25600,
+"dark olive green", 5597999,
+"darkolivegreen", 5597999,
+"dark sea green", 9419919,
+"darkseagreen", 9419919,
+"sea green", 3050327,
+"seagreen", 3050327,
+"medium sea green", 3978097,
+"mediumseagreen", 3978097,
+"light sea green", 2142890,
+"lightseagreen", 2142890,
+"pale green", 10025880,
+"palegreen", 10025880,
+"spring green", 65407,
+"springgreen", 65407,
+"lawn green", 8190976,
+"lawngreen", 8190976,
+"green", 65280,
+"chartreuse", 8388352,
+"medium spring green", 64154,
+"mediumspringgreen", 64154,
+"green yellow", 11403055,
+"greenyellow", 11403055,
+"lime green", 3329330,
+"limegreen", 3329330,
+"yellow green", 10145074,
+"yellowgreen", 10145074,
+"forest green", 2263842,
+"forestgreen", 2263842,
+"olive drab", 7048739,
+"olivedrab", 7048739,
+"dark khaki", 12433259,
+"darkkhaki", 12433259,
+"khaki", 15787660,
+"pale goldenrod", 15657130,
+"palegoldenrod", 15657130,
+"light goldenrod yellow", 16448210,
+"lightgoldenrodyellow", 16448210,
+"light yellow", 16777184,
+"lightyellow", 16777184,
+"yellow", 16776960,
+"gold", 16766720,
+"light goldenrod", 15654274,
+"lightgoldenrod", 15654274,
+"goldenrod", 14329120,
+"dark goldenrod", 12092939,
+"darkgoldenrod", 12092939,
+"rosy brown", 12357519,
+"rosybrown", 12357519,
+"indian red", 13458524,
+"indianred", 13458524,
+"saddle brown", 9127187,
+"saddlebrown", 9127187,
+"sienna", 10506797,
+"peru", 13468991,
+"burlywood", 14596231,
+"beige", 16119260,
+"wheat", 16113331,
+"sandy brown", 16032864,
+"sandybrown", 16032864,
+"tan", 13808780,
+"chocolate", 13789470,
+"firebrick", 11674146,
+"brown", 10824234,
+"dark salmon", 15308410,
+"darksalmon", 15308410,
+"salmon", 16416882,
+"light salmon", 16752762,
+"lightsalmon", 16752762,
+"orange", 16753920,
+"dark orange", 16747520,
+"darkorange", 16747520,
+"coral", 16744272,
+"light coral", 15761536,
+"lightcoral", 15761536,
+"tomato", 16737095,
+"orange red", 16729344,
+"orangered", 16729344,
+"red", 16711680,
+"hot pink", 16738740,
+"hotpink", 16738740,
+"deep pink", 16716947,
+"deeppink", 16716947,
+"pink", 16761035,
+"light pink", 16758465,
+"lightpink", 16758465,
+"pale violet red", 14381203,
+"palevioletred", 14381203,
+"maroon", 11546720,
+"medium violet red", 13047173,
+"mediumvioletred", 13047173,
+"violet red", 13639824,
+"violetred", 13639824,
+"magenta", 16711935,
+"violet", 15631086,
+"plum", 14524637,
+"orchid", 14315734,
+"medium orchid", 12211667,
+"mediumorchid", 12211667,
+"dark orchid", 10040012,
+"darkorchid", 10040012,
+"dark violet", 9699539,
+"darkviolet", 9699539,
+"blue violet", 9055202,
+"blueviolet", 9055202,
+"purple", 10494192,
+"medium purple", 9662683,
+"mediumpurple", 9662683,
+"thistle", 14204888,
+"snow1", 16775930,
+"snow2", 15657449,
+"snow3", 13486537,
+"snow4", 9144713,
+"seashell1", 16774638,
+"seashell2", 15656414,
+"seashell3", 13485503,
+"seashell4", 9143938,
+"antiquewhite1", 16773083,
+"antiquewhite2", 15654860,
+"antiquewhite3", 13484208,
+"antiquewhite4", 9143160,
+"bisque1", 16770244,
+"bisque2", 15652279,
+"bisque3", 13481886,
+"bisque4", 9141611,
+"peachpuff1", 16767673,
+"peachpuff2", 15649709,
+"peachpuff3", 13479829,
+"peachpuff4", 9140069,
+"navajowhite1", 16768685,
+"navajowhite2", 15650721,
+"navajowhite3", 13480843,
+"navajowhite4", 9140574,
+"lemonchiffon1", 16775885,
+"lemonchiffon2", 15657407,
+"lemonchiffon3", 13486501,
+"lemonchiffon4", 9144688,
+"cornsilk1", 16775388,
+"cornsilk2", 15657165,
+"cornsilk3", 13486257,
+"cornsilk4", 9144440,
+"ivory1", 16777200,
+"ivory2", 15658720,
+"ivory3", 13487553,
+"ivory4", 9145219,
+"honeydew1", 15794160,
+"honeydew2", 14741216,
+"honeydew3", 12701121,
+"honeydew4", 8620931,
+"lavenderblush1", 16773365,
+"lavenderblush2", 15655141,
+"lavenderblush3", 13484485,
+"lavenderblush4", 9143174,
+"mistyrose1", 16770273,
+"mistyrose2", 15652306,
+"mistyrose3", 13481909,
+"mistyrose4", 9141627,
+"azure1", 15794175,
+"azure2", 14741230,
+"azure3", 12701133,
+"azure4", 8620939,
+"slateblue1", 8613887,
+"slateblue2", 8021998,
+"slateblue3", 6904269,
+"slateblue4", 4668555,
+"royalblue1", 4749055,
+"royalblue2", 4419310,
+"royalblue3", 3825613,
+"royalblue4", 2572427,
+"blue1", 255,
+"blue2", 238,
+"blue3", 205,
+"blue4", 139,
+"dodgerblue1", 2003199,
+"dodgerblue2", 1869550,
+"dodgerblue3", 1602765,
+"dodgerblue4", 1068683,
+"steelblue1", 6535423,
+"steelblue2", 6073582,
+"steelblue3", 5215437,
+"steelblue4", 3564683,
+"deepskyblue1", 49151,
+"deepskyblue2", 45806,
+"deepskyblue3", 39629,
+"deepskyblue4", 26763,
+"skyblue1", 8900351,
+"skyblue2", 8306926,
+"skyblue3", 7120589,
+"skyblue4", 4878475,
+"lightskyblue1", 11592447,
+"lightskyblue2", 10802158,
+"lightskyblue3", 9287373,
+"lightskyblue4", 6323083,
+"slategray1", 13034239,
+"slategray2", 12178414,
+"slategray3", 10467021,
+"slategray4", 7109515,
+"lightsteelblue1", 13296127,
+"lightsteelblue2", 12374766,
+"lightsteelblue3", 10663373,
+"lightsteelblue4", 7240587,
+"lightblue1", 12578815,
+"lightblue2", 11722734,
+"lightblue3", 10141901,
+"lightblue4", 6849419,
+"lightcyan1", 14745599,
+"lightcyan2", 13758190,
+"lightcyan3", 11849165,
+"lightcyan4", 8031115,
+"paleturquoise1", 12320767,
+"paleturquoise2", 11464430,
+"paleturquoise3", 9883085,
+"paleturquoise4", 6720395,
+"cadetblue1", 10024447,
+"cadetblue2", 9364974,
+"cadetblue3", 8046029,
+"cadetblue4", 5473931,
+"turquoise1", 62975,
+"turquoise2", 58862,
+"turquoise3", 50637,
+"turquoise4", 34443,
+"cyan1", 65535,
+"cyan2", 61166,
+"cyan3", 52685,
+"cyan4", 35723,
+"darkslategray1", 9961471,
+"darkslategray2", 9301742,
+"darkslategray3", 7982541,
+"darkslategray4", 5409675,
+"aquamarine1", 8388564,
+"aquamarine2", 7794374,
+"aquamarine3", 6737322,
+"aquamarine4", 4557684,
+"darkseagreen1", 12713921,
+"darkseagreen2", 11857588,
+"darkseagreen3", 10210715,
+"darkseagreen4", 6916969,
+"seagreen1", 5570463,
+"seagreen2", 5172884,
+"seagreen3", 4443520,
+"seagreen4", 3050327,
+"palegreen1", 10157978,
+"palegreen2", 9498256,
+"palegreen3", 8179068,
+"palegreen4", 5540692,
+"springgreen1", 65407,
+"springgreen2", 61046,
+"springgreen3", 52582,
+"springgreen4", 35653,
+"green1", 65280,
+"green2", 60928,
+"green3", 52480,
+"green4", 35584,
+"chartreuse1", 8388352,
+"chartreuse2", 7794176,
+"chartreuse3", 6737152,
+"chartreuse4", 4557568,
+"olivedrab1", 12648254,
+"olivedrab2", 11791930,
+"olivedrab3", 10145074,
+"olivedrab4", 6916898,
+"darkolivegreen1", 13303664,
+"darkolivegreen2", 12381800,
+"darkolivegreen3", 10669402,
+"darkolivegreen4", 7244605,
+"khaki1", 16774799,
+"khaki2", 15656581,
+"khaki3", 13485683,
+"khaki4", 9143886,
+"lightgoldenrod1", 16772235,
+"lightgoldenrod2", 15654018,
+"lightgoldenrod3", 13483632,
+"lightgoldenrod4", 9142604,
+"lightyellow1", 16777184,
+"lightyellow2", 15658705,
+"lightyellow3", 13487540,
+"lightyellow4", 9145210,
+"yellow1", 16776960,
+"yellow2", 15658496,
+"yellow3", 13487360,
+"yellow4", 9145088,
+"gold1", 16766720,
+"gold2", 15649024,
+"gold3", 13479168,
+"gold4", 9139456,
+"goldenrod1", 16761125,
+"goldenrod2", 15643682,
+"goldenrod3", 13474589,
+"goldenrod4", 9136404,
+"darkgoldenrod1", 16759055,
+"darkgoldenrod2", 15641870,
+"darkgoldenrod3", 13473036,
+"darkgoldenrod4", 9135368,
+"rosybrown1", 16761281,
+"rosybrown2", 15643828,
+"rosybrown3", 13474715,
+"rosybrown4", 9136489,
+"indianred1", 16738922,
+"indianred2", 15623011,
+"indianred3", 13456725,
+"indianred4", 9124410,
+"sienna1", 16745031,
+"sienna2", 15628610,
+"sienna3", 13461561,
+"sienna4", 9127718,
+"burlywood1", 16765851,
+"burlywood2", 15648145,
+"burlywood3", 13478525,
+"burlywood4", 9139029,
+"wheat1", 16771002,
+"wheat2", 15653038,
+"wheat3", 13482646,
+"wheat4", 9141862,
+"tan1", 16753999,
+"tan2", 15637065,
+"tan3", 13468991,
+"tan4", 9132587,
+"chocolate1", 16744228,
+"chocolate2", 15627809,
+"chocolate3", 13461021,
+"chocolate4", 9127187,
+"firebrick1", 16724016,
+"firebrick2", 15608876,
+"firebrick3", 13444646,
+"firebrick4", 9116186,
+"brown1", 16728128,
+"brown2", 15612731,
+"brown3", 13447987,
+"brown4", 9118499,
+"salmon1", 16747625,
+"salmon2", 15630946,
+"salmon3", 13463636,
+"salmon4", 9129017,
+"lightsalmon1", 16752762,
+"lightsalmon2", 15635826,
+"lightsalmon3", 13468002,
+"lightsalmon4", 9131842,
+"orange1", 16753920,
+"orange2", 15636992,
+"orange3", 13468928,
+"orange4", 9132544,
+"darkorange1", 16744192,
+"darkorange2", 15627776,
+"darkorange3", 13460992,
+"darkorange4", 9127168,
+"coral1", 16740950,
+"coral2", 15624784,
+"coral3", 13458245,
+"coral4", 9125423,
+"tomato1", 16737095,
+"tomato2", 15621186,
+"tomato3", 13455161,
+"tomato4", 9123366,
+"orangered1", 16729344,
+"orangered2", 15613952,
+"orangered3", 13448960,
+"orangered4", 9118976,
+"red1", 16711680,
+"red2", 15597568,
+"red3", 13434880,
+"red4", 9109504,
+"deeppink1", 16716947,
+"deeppink2", 15602313,
+"deeppink3", 13439094,
+"deeppink4", 9112144,
+"hotpink1", 16740020,
+"hotpink2", 15624871,
+"hotpink3", 13459600,
+"hotpink4", 9124450,
+"pink1", 16758213,
+"pink2", 15641016,
+"pink3", 13472158,
+"pink4", 9134956,
+"lightpink1", 16756409,
+"lightpink2", 15639213,
+"lightpink3", 13470869,
+"lightpink4", 9133925,
+"palevioletred1", 16745131,
+"palevioletred2", 15628703,
+"palevioletred3", 13461641,
+"palevioletred4", 9127773,
+"maroon1", 16725171,
+"maroon2", 15610023,
+"maroon3", 13445520,
+"maroon4", 9116770,
+"violetred1", 16727702,
+"violetred2", 15612556,
+"violetred3", 13447800,
+"violetred4", 9118290,
+"magenta1", 16711935,
+"magenta2", 15597806,
+"magenta3", 13435085,
+"magenta4", 9109643,
+"orchid1", 16745466,
+"orchid2", 15629033,
+"orchid3", 13461961,
+"orchid4", 9127817,
+"plum1", 16759807,
+"plum2", 15642350,
+"plum3", 13473485,
+"plum4", 9135755,
+"mediumorchid1", 14706431,
+"mediumorchid2", 13721582,
+"mediumorchid3", 11817677,
+"mediumorchid4", 8009611,
+"darkorchid1", 12533503,
+"darkorchid2", 11680494,
+"darkorchid3", 10105549,
+"darkorchid4", 6824587,
+"purple1", 10170623,
+"purple2", 9514222,
+"purple3", 8201933,
+"purple4", 5577355,
+"mediumpurple1", 11240191,
+"mediumpurple2", 10451438,
+"mediumpurple3", 9005261,
+"mediumpurple4", 6113163,
+"thistle1", 16769535,
+"thistle2", 15651566,
+"thistle3", 13481421,
+"thistle4", 9141131,
+"gray0", 0,
+"grey0", 0,
+"gray1", 197379,
+"grey1", 197379,
+"gray2", 328965,
+"grey2", 328965,
+"gray3", 526344,
+"grey3", 526344,
+"gray4", 657930,
+"grey4", 657930,
+"gray5", 855309,
+"grey5", 855309,
+"gray6", 986895,
+"grey6", 986895,
+"gray7", 1184274,
+"grey7", 1184274,
+"gray8", 1315860,
+"grey8", 1315860,
+"gray9", 1513239,
+"grey9", 1513239,
+"gray10", 1710618,
+"grey10", 1710618,
+"gray11", 1842204,
+"grey11", 1842204,
+"gray12", 2039583,
+"grey12", 2039583,
+"gray13", 2171169,
+"grey13", 2171169,
+"gray14", 2368548,
+"grey14", 2368548,
+"gray15", 2500134,
+"grey15", 2500134,
+"gray16", 2697513,
+"grey16", 2697513,
+"gray17", 2829099,
+"grey17", 2829099,
+"gray18", 3026478,
+"grey18", 3026478,
+"gray19", 3158064,
+"grey19", 3158064,
+"gray20", 3355443,
+"grey20", 3355443,
+"gray21", 3552822,
+"grey21", 3552822,
+"gray22", 3684408,
+"grey22", 3684408,
+"gray23", 3881787,
+"grey23", 3881787,
+"gray24", 4013373,
+"grey24", 4013373,
+"gray25", 4210752,
+"grey25", 4210752,
+"gray26", 4342338,
+"grey26", 4342338,
+"gray27", 4539717,
+"grey27", 4539717,
+"gray28", 4671303,
+"grey28", 4671303,
+"gray29", 4868682,
+"grey29", 4868682,
+"gray30", 5066061,
+"grey30", 5066061,
+"gray31", 5197647,
+"grey31", 5197647,
+"gray32", 5395026,
+"grey32", 5395026,
+"gray33", 5526612,
+"grey33", 5526612,
+"gray34", 5723991,
+"grey34", 5723991,
+"gray35", 5855577,
+"grey35", 5855577,
+"gray36", 6052956,
+"grey36", 6052956,
+"gray37", 6184542,
+"grey37", 6184542,
+"gray38", 6381921,
+"grey38", 6381921,
+"gray39", 6513507,
+"grey39", 6513507,
+"gray40", 6710886,
+"grey40", 6710886,
+"gray41", 6908265,
+"grey41", 6908265,
+"gray42", 7039851,
+"grey42", 7039851,
+"gray43", 7237230,
+"grey43", 7237230,
+"gray44", 7368816,
+"grey44", 7368816,
+"gray45", 7566195,
+"grey45", 7566195,
+"gray46", 7697781,
+"grey46", 7697781,
+"gray47", 7895160,
+"grey47", 7895160,
+"gray48", 8026746,
+"grey48", 8026746,
+"gray49", 8224125,
+"grey49", 8224125,
+"gray50", 8355711,
+"grey50", 8355711,
+"gray51", 8553090,
+"grey51", 8553090,
+"gray52", 8750469,
+"grey52", 8750469,
+"gray53", 8882055,
+"grey53", 8882055,
+"gray54", 9079434,
+"grey54", 9079434,
+"gray55", 9211020,
+"grey55", 9211020,
+"gray56", 9408399,
+"grey56", 9408399,
+"gray57", 9539985,
+"grey57", 9539985,
+"gray58", 9737364,
+"grey58", 9737364,
+"gray59", 9868950,
+"grey59", 9868950,
+"gray60", 10066329,
+"grey60", 10066329,
+"gray61", 10263708,
+"grey61", 10263708,
+"gray62", 10395294,
+"grey62", 10395294,
+"gray63", 10592673,
+"grey63", 10592673,
+"gray64", 10724259,
+"grey64", 10724259,
+"gray65", 10921638,
+"grey65", 10921638,
+"gray66", 11053224,
+"grey66", 11053224,
+"gray67", 11250603,
+"grey67", 11250603,
+"gray68", 11382189,
+"grey68", 11382189,
+"gray69", 11579568,
+"grey69", 11579568,
+"gray70", 11776947,
+"grey70", 11776947,
+"gray71", 11908533,
+"grey71", 11908533,
+"gray72", 12105912,
+"grey72", 12105912,
+"gray73", 12237498,
+"grey73", 12237498,
+"gray74", 12434877,
+"grey74", 12434877,
+"gray75", 12566463,
+"grey75", 12566463,
+"gray76", 12763842,
+"grey76", 12763842,
+"gray77", 12895428,
+"grey77", 12895428,
+"gray78", 13092807,
+"grey78", 13092807,
+"gray79", 13224393,
+"grey79", 13224393,
+"gray80", 13421772,
+"grey80", 13421772,
+"gray81", 13619151,
+"grey81", 13619151,
+"gray82", 13750737,
+"grey82", 13750737,
+"gray83", 13948116,
+"grey83", 13948116,
+"gray84", 14079702,
+"grey84", 14079702,
+"gray85", 14277081,
+"grey85", 14277081,
+"gray86", 14408667,
+"grey86", 14408667,
+"gray87", 14606046,
+"grey87", 14606046,
+"gray88", 14737632,
+"grey88", 14737632,
+"gray89", 14935011,
+"grey89", 14935011,
+"gray90", 15066597,
+"grey90", 15066597,
+"gray91", 15263976,
+"grey91", 15263976,
+"gray92", 15461355,
+"grey92", 15461355,
+"gray93", 15592941,
+"grey93", 15592941,
+"gray94", 15790320,
+"grey94", 15790320,
+"gray95", 15921906,
+"grey95", 15921906,
+"gray96", 16119285,
+"grey96", 16119285,
+"gray97", 16250871,
+"grey97", 16250871,
+"gray98", 16448250,
+"grey98", 16448250,
+"gray99", 16579836,
+"grey99", 16579836,
+"gray100", 16777215,
+"grey100", 16777215,
+"dark grey", 11119017,
+"darkgrey", 11119017,
+"dark gray", 11119017,
+"darkgray", 11119017,
+"dark blue", 139,
+"darkblue", 139,
+"dark cyan", 35723,
+"darkcyan", 35723,
+"dark magenta", 9109643,
+"darkmagenta", 9109643,
+"dark red", 9109504,
+"darkred", 9109504,
+"light green", 9498256,
+"lightgreen", 9498256
+};
+