plplot 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,101 @@
1
+ # This is the Ruby wrapper for PLplot.
2
+
3
+ # Symbols from the narray shared library must be available before the rbplplot
4
+ # shared library can be loaded. Normally this is done by linking the
5
+ # rbplplot shared library with the narray shared library. This does not always
6
+ # work on Macs because sometimes (always?) the narray shared library is a
7
+ # so-called "bundle" which cannot be links against statically. Therefore, we
8
+ # must ensure that the narray shared library (i.e. narray.bundle on Macs) is
9
+ # loaded *before* trying to load the rbplplot shared library.
10
+
11
+ require 'rbconfig'
12
+ require 'optparse'
13
+ require 'narray'
14
+
15
+ # Require the rbplplot shared library
16
+ rbplplot_shared_lib = 'rbplplot.' + Config::CONFIG['DLEXT']
17
+ require rbplplot_shared_lib
18
+ require 'plplot_gem' if false # Fake out RDoc
19
+
20
+ # The PLOptionParser is an OptionParser subclass for use with PLplot. It adds
21
+ # long and short options, <tt>--help</tt> and <tt>-h</tt>, for displaying the
22
+ # OptionParser help text and long and short options, <tt>--plopt</tt> and
23
+ # <tt>-P</tt> for setting PLplot options. The short option for setting PLplot
24
+ # options can be changed from the default (see #new for details).
25
+
26
+ class PLOptionParser < OptionParser
27
+ def separator_tail(s='') # :nodoc:
28
+ base.append(s, nil, nil)
29
+ end
30
+
31
+ # call-seq:
32
+ # new(banner = nil, width = 32, indent = ' ' * 4[, opts]) {|self if block_given?| ...}
33
+ #
34
+ # Initializes the instance and yields itself if called with a block. If last
35
+ # arument is a +Hash+, it provides options for this instance (see below).
36
+ # Remaining arguments are passed to <tt>OptionParser#new</tt>:
37
+ #
38
+ # +banner+:: Banner message.
39
+ # +width+:: Summary width.
40
+ # +indent+:: Summary indent.
41
+ #
42
+ # The following key is recognized in the +opts+ +Hash+ (if given):
43
+ #
44
+ # <tt>:short_plopt</tt>:: Short version of <tt>--plopt</tt>
45
+ # Defaults to <tt>-P</tt>
46
+ # Set to +nil+ or +false+ to have no short version
47
+ #
48
+ # If #new is invoked with a block, the help text for the <tt>--help</tt> and
49
+ # <tt>--plopt</tt> options will be at the end of the help text, otherwise
50
+ # they will be at the beginning.
51
+
52
+ def initialize(*args)
53
+ opts = {
54
+ :short_plopt => '-P',
55
+ }
56
+ opts.merge!(args.pop) if Hash === args[-1]
57
+
58
+ # Set banner if not given. This differs slightly from OptionParser's
59
+ # default banner in that any extension on $0 is preserved.
60
+ args[0] ||= "Usage: #{File.basename($0)} [options]"
61
+
62
+ super(*args) do |op|
63
+ program_name = File.basename($0)
64
+ separator = :separator
65
+ on = :on
66
+
67
+ if block_given?
68
+ yield op
69
+ separator = :separator_tail
70
+ on = :on_tail
71
+ end
72
+
73
+ op.send(separator, '')
74
+ op.send(separator, 'PLplot options:')
75
+ op.send(on, '-h', '--help', 'Print out this message') do
76
+ puts op.help
77
+ exit
78
+ end
79
+ op.send(on, opts[:short_plopt]||true, '--plopt OPT[=ARG][,...]',
80
+ 'Set PLplot options',
81
+ %Q{For short help use: "#{opts[:short_plopt]||'--plopt '}-"},
82
+ %Q{For long help use: "#{opts[:short_plopt]||'--plopt '}h"}
83
+ ) do |o|
84
+ o.gsub!('\,', "\e")
85
+ plopts = o.split(/,(?=\D)/).map! do |kv|
86
+ kv.gsub!("\e", ',')
87
+ kv.split('=', 2)
88
+ end
89
+ plopts.flatten!
90
+ plopts.compact!
91
+ PLplot.plsetopt(plopts, true)
92
+ end
93
+ end
94
+ end
95
+
96
+ # For scripts using PLplot, but no custom options, PLOptionParser.parse! will
97
+ # create an instance of PLOptionParser and call its #parse! method.
98
+ def self.parse!
99
+ PLOptionParser.new.parse!
100
+ end
101
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plplot
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - David MacMahon
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-16 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: narray
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 5
30
+ - 9
31
+ version: 0.5.9
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: |
35
+ Provides PLplot functions in a Ruby module. PLplot is a
36
+ cross-platform software package for creating scientific plots.
37
+
38
+ email: davidm@astro.berkeley.edu
39
+ executables: []
40
+
41
+ extensions:
42
+ - ext/extconf.rb
43
+ extra_rdoc_files:
44
+ - README
45
+ - ext/rbplplot.c
46
+ files:
47
+ - README
48
+ - lib/plplot.rb
49
+ - examples/x01.rb
50
+ - examples/x02.rb
51
+ - examples/x03.rb
52
+ - examples/x04.rb
53
+ - examples/x05.rb
54
+ - examples/x06.rb
55
+ - examples/x07.rb
56
+ - examples/x08.rb
57
+ - examples/x09.rb
58
+ - examples/x10.rb
59
+ - examples/x11.rb
60
+ - examples/x12.rb
61
+ - examples/x13.rb
62
+ - examples/x14.rb
63
+ - examples/x15.rb
64
+ - examples/x16.rb
65
+ - examples/x18.rb
66
+ - examples/x20.rb
67
+ - examples/x21.rb
68
+ - examples/x22.rb
69
+ - examples/x23.rb
70
+ - examples/x24.rb
71
+ - examples/x25.rb
72
+ - examples/x26.rb
73
+ - examples/x27.rb
74
+ - examples/x28.rb
75
+ - examples/x30.rb
76
+ - examples/x31.rb
77
+ - examples/x32.rb
78
+ - ext/depend
79
+ - ext/extconf.rb
80
+ - ext/rbplplot.c
81
+ has_rdoc: true
82
+ homepage: http://plplot.rubyforge.org/
83
+ licenses: []
84
+
85
+ post_install_message:
86
+ rdoc_options:
87
+ - -m
88
+ - README
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ segments:
96
+ - 1
97
+ - 8
98
+ - 1
99
+ version: 1.8.1
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ requirements:
108
+ - PLplot version 5.9.5 with plf2ops patch (http://plplot.sourceforge.net/)
109
+ rubyforge_project: plplot
110
+ rubygems_version: 1.3.6
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: Ruby interface to PLplot
114
+ test_files: []
115
+