ctioga2 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +18 -0
- data/lib/ctioga2/commands/arguments.rb +17 -2
- data/lib/ctioga2/commands/commands.rb +13 -5
- data/lib/ctioga2/commands/context.rb +53 -0
- data/lib/ctioga2/commands/doc/doc.rb +1 -1
- data/lib/ctioga2/commands/doc/documentation-commands.rb +1 -1
- data/lib/ctioga2/commands/doc/help.rb +1 -1
- data/lib/ctioga2/commands/doc/html.rb +1 -1
- data/lib/ctioga2/commands/doc/introspection.rb +16 -1
- data/lib/ctioga2/commands/doc/man.rb +1 -1
- data/lib/ctioga2/commands/doc/markup.rb +1 -1
- data/lib/ctioga2/commands/doc/wordwrap.rb +1 -1
- data/lib/ctioga2/commands/general-commands.rb +1 -1
- data/lib/ctioga2/commands/general-types.rb +1 -1
- data/lib/ctioga2/commands/groups.rb +1 -1
- data/lib/ctioga2/commands/interpreter.rb +22 -1
- data/lib/ctioga2/commands/parsers/command-line.rb +8 -1
- data/lib/ctioga2/commands/parsers/file.rb +2 -1
- data/lib/ctioga2/commands/strings.rb +1 -1
- data/lib/ctioga2/commands/type.rb +1 -1
- data/lib/ctioga2/commands/variables.rb +1 -1
- data/lib/ctioga2/data/backends/backend.rb +1 -1
- data/lib/ctioga2/data/backends/backends/gnuplot.rb +1 -1
- data/lib/ctioga2/data/backends/backends/math.rb +1 -1
- data/lib/ctioga2/data/backends/backends/text.rb +12 -2
- data/lib/ctioga2/data/backends/description.rb +1 -1
- data/lib/ctioga2/data/backends/factory.rb +1 -1
- data/lib/ctioga2/data/backends/parameter.rb +1 -1
- data/lib/ctioga2/data/datacolumn.rb +1 -1
- data/lib/ctioga2/data/dataset.rb +1 -1
- data/lib/ctioga2/data/filters.rb +1 -1
- data/lib/ctioga2/data/indexed-dtable.rb +1 -1
- data/lib/ctioga2/data/point.rb +1 -1
- data/lib/ctioga2/data/stack.rb +6 -6
- data/lib/ctioga2/graphics/coordinates.rb +1 -1
- data/lib/ctioga2/graphics/elements.rb +1 -1
- data/lib/ctioga2/graphics/elements/containers.rb +1 -1
- data/lib/ctioga2/graphics/elements/contour.rb +1 -1
- data/lib/ctioga2/graphics/elements/curve2d.rb +1 -1
- data/lib/ctioga2/graphics/elements/element.rb +1 -1
- data/lib/ctioga2/graphics/elements/gradient-region.rb +1 -1
- data/lib/ctioga2/graphics/elements/parametric2d.rb +1 -1
- data/lib/ctioga2/graphics/elements/primitive.rb +115 -69
- data/lib/ctioga2/graphics/elements/region.rb +1 -1
- data/lib/ctioga2/graphics/elements/subplot.rb +9 -3
- data/lib/ctioga2/graphics/elements/tangent.rb +1 -1
- data/lib/ctioga2/graphics/elements/xyz-map.rb +1 -1
- data/lib/ctioga2/graphics/generator.rb +1 -1
- data/lib/ctioga2/graphics/legends.rb +5 -7
- data/lib/ctioga2/graphics/legends/area.rb +8 -8
- data/lib/ctioga2/graphics/legends/items.rb +2 -2
- data/lib/ctioga2/graphics/legends/provider.rb +1 -1
- data/lib/ctioga2/graphics/legends/storage.rb +1 -1
- data/lib/ctioga2/graphics/root.rb +1 -1
- data/lib/ctioga2/graphics/styles.rb +5 -0
- data/lib/ctioga2/graphics/styles/arrows.rb +53 -0
- data/lib/ctioga2/graphics/styles/axes.rb +29 -23
- data/lib/ctioga2/graphics/styles/background.rb +12 -10
- data/lib/ctioga2/graphics/styles/base.rb +99 -5
- data/lib/ctioga2/graphics/styles/box.rb +67 -0
- data/lib/ctioga2/graphics/styles/carrays.rb +1 -1
- data/lib/ctioga2/graphics/styles/colormap.rb +1 -1
- data/lib/ctioga2/graphics/styles/curve.rb +7 -1
- data/lib/ctioga2/graphics/styles/drawable.rb +24 -11
- data/lib/ctioga2/graphics/styles/errorbar.rb +1 -1
- data/lib/ctioga2/graphics/styles/factory.rb +1 -1
- data/lib/ctioga2/graphics/styles/gradients.rb +3 -3
- data/lib/ctioga2/graphics/styles/legend.rb +20 -5
- data/lib/ctioga2/graphics/styles/location.rb +3 -3
- data/lib/ctioga2/graphics/styles/map-axes.rb +6 -7
- data/lib/ctioga2/graphics/styles/plot.rb +51 -26
- data/lib/ctioga2/graphics/styles/sets.rb +1 -1
- data/lib/ctioga2/graphics/styles/sheet.rb +348 -0
- data/lib/ctioga2/graphics/styles/texts.rb +45 -64
- data/lib/ctioga2/graphics/subplot-commands.rb +1 -1
- data/lib/ctioga2/graphics/types.rb +1 -3
- data/lib/ctioga2/graphics/types/bijection.rb +1 -1
- data/lib/ctioga2/graphics/types/boundaries.rb +1 -1
- data/lib/ctioga2/graphics/types/boxes.rb +1 -1
- data/lib/ctioga2/graphics/types/dimensions.rb +2 -2
- data/lib/ctioga2/graphics/types/grid.rb +1 -1
- data/lib/ctioga2/graphics/types/location.rb +2 -2
- data/lib/ctioga2/graphics/types/point.rb +1 -1
- data/lib/ctioga2/log.rb +10 -6
- data/lib/ctioga2/metabuilder/type.rb +1 -1
- data/lib/ctioga2/metabuilder/types/coordinates.rb +1 -1
- data/lib/ctioga2/metabuilder/types/data.rb +1 -1
- data/lib/ctioga2/metabuilder/types/dates.rb +1 -1
- data/lib/ctioga2/metabuilder/types/lists.rb +1 -1
- data/lib/ctioga2/metabuilder/types/numbers.rb +1 -1
- data/lib/ctioga2/metabuilder/types/strings.rb +1 -1
- data/lib/ctioga2/metabuilder/types/styles.rb +30 -3
- data/lib/ctioga2/plotmaker.rb +1 -1
- data/lib/ctioga2/postprocess.rb +1 -1
- data/lib/ctioga2/utils.rb +78 -3
- metadata +6 -5
- data/lib/ctioga2/git-fools-svn.rb +0 -7
- data/lib/ctioga2/graphics/elements/redirecting-container.rb~ +0 -123
- data/lib/ctioga2/metabuilder/types/generic.rb~ +0 -225
data/Changelog
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
ctioga2 (0.4)
|
2
|
+
|
3
|
+
* Fixed a bug in /which (dataset) options
|
4
|
+
* Added some context to error reporting, that may help understand where
|
5
|
+
errors come from
|
6
|
+
* Improved error reporting on empty plots
|
7
|
+
* New command: --draw-box
|
8
|
+
* Improvements to the customization of legends, including the possiblity to
|
9
|
+
draw a (possibly filled) frame around it
|
10
|
+
* Improvements of axis customization
|
11
|
+
* xcolor-like color mixing capacities
|
12
|
+
* An emacs major mode for editing ctioga2 command files
|
13
|
+
* Added a fully-fledged styling system that make it much simpler now to
|
14
|
+
change the style of a whole graph with a minimum of effort
|
15
|
+
* Added tests for most of the new possibilities
|
16
|
+
|
17
|
+
-- Vincent Fourmond <vincent.fourmond@9online.fr> Fri Dec 28 17:49:07 CET 2012
|
18
|
+
|
1
19
|
ctioga2 (0.3)
|
2
20
|
|
3
21
|
* Implemented a compute-contour command to directly manipulate contours
|
@@ -16,14 +16,19 @@ require 'ctioga2/commands/type'
|
|
16
16
|
|
17
17
|
module CTioga2
|
18
18
|
|
19
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
19
|
+
Version::register_svn_info('$Revision: 355 $', '$Date: 2012-12-26 00:19:04 +0100 (Wed, 26 Dec 2012) $')
|
20
20
|
|
21
21
|
module Commands
|
22
22
|
|
23
23
|
# An argument to a Command
|
24
|
+
#
|
25
|
+
# @todo There should be real options mangling capacities, with:
|
26
|
+
# * (possibly deprecated) aliases for options
|
27
|
+
# * _ to - mangling
|
28
|
+
# * other things ?
|
24
29
|
class CommandArgument
|
25
30
|
|
26
|
-
# The type of the argument, a
|
31
|
+
# The type of the argument, a CommandType object.
|
27
32
|
attr_accessor :type
|
28
33
|
|
29
34
|
# The name of the argument. Uniquely for display in the help
|
@@ -33,11 +38,21 @@ module CTioga2
|
|
33
38
|
# A small description of the argument
|
34
39
|
attr_accessor :description
|
35
40
|
|
41
|
+
# The target for the option, in case it is different from its
|
42
|
+
# name
|
43
|
+
attr_accessor :option_target
|
44
|
+
|
45
|
+
# Whether or not the option is deprecated
|
46
|
+
attr_accessor :option_deprecated
|
47
|
+
|
36
48
|
# _type_ is a named CommandType
|
37
49
|
def initialize(type, name = nil, desc = nil)
|
38
50
|
@type = CommandType.get_type(type)
|
39
51
|
@name = name
|
40
52
|
@description = desc
|
53
|
+
|
54
|
+
@option_target = nil
|
55
|
+
@option_deprecated = false
|
41
56
|
end
|
42
57
|
|
43
58
|
# Returns a name suitable for display in a documentation, such
|
@@ -17,7 +17,7 @@ require 'ctioga2/commands/groups'
|
|
17
17
|
|
18
18
|
module CTioga2
|
19
19
|
|
20
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
20
|
+
Version::register_svn_info('$Revision: 355 $', '$Date: 2012-12-26 00:19:04 +0100 (Wed, 26 Dec 2012) $')
|
21
21
|
|
22
22
|
module Commands
|
23
23
|
|
@@ -214,12 +214,20 @@ module CTioga2
|
|
214
214
|
if ! @optional_arguments.key? k
|
215
215
|
raise CommandOptionUnkown, "Unkown option #{k} for command #{@name}"
|
216
216
|
end
|
217
|
+
opt = @optional_arguments[k]
|
217
218
|
if v.is_a? String
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
v = opt.type.string_to_type(v)
|
220
|
+
end
|
221
|
+
target = opt.option_target || k
|
222
|
+
if opt.option_deprecated
|
223
|
+
expl = ""
|
224
|
+
if opt.option_target
|
225
|
+
expl = " -- please use #{opt.option_target} instead"
|
226
|
+
end
|
227
|
+
Log::warn { "Deprecated option #{k}#{expl}" }
|
222
228
|
end
|
229
|
+
|
230
|
+
target_options[target] = v
|
223
231
|
end
|
224
232
|
return target_options
|
225
233
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# context.rb: parsing context (for error reports)
|
2
|
+
# copyright (c) 2012 by Vincent Fourmond
|
3
|
+
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details (in the COPYING file).
|
13
|
+
|
14
|
+
require 'ctioga2/utils'
|
15
|
+
require 'ctioga2/commands/type'
|
16
|
+
|
17
|
+
module CTioga2
|
18
|
+
|
19
|
+
Version::register_svn_info('$Revision$', '$Date$')
|
20
|
+
|
21
|
+
module Commands
|
22
|
+
|
23
|
+
# Context of parsing, mostly for error reporting
|
24
|
+
class ParsingContext
|
25
|
+
|
26
|
+
# Currently parsing an option
|
27
|
+
def parsing_option(opt, number)
|
28
|
+
@option = opt
|
29
|
+
@number = number
|
30
|
+
end
|
31
|
+
|
32
|
+
# Currently within a file
|
33
|
+
def parsing_file(command, file, line = -1)
|
34
|
+
@option = nil
|
35
|
+
@command = command
|
36
|
+
@file = file
|
37
|
+
@number = line
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_s
|
41
|
+
if @option
|
42
|
+
"option #{@option} (##{@number})"
|
43
|
+
else
|
44
|
+
"command #{@command} in file #{@file} line #{@number}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
@@ -16,7 +16,7 @@ require 'ctioga2/commands/commands'
|
|
16
16
|
|
17
17
|
module CTioga2
|
18
18
|
|
19
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
19
|
+
Version::register_svn_info('$Revision: 336 $', '$Date: 2012-12-23 00:29:48 +0100 (Sun, 23 Dec 2012) $')
|
20
20
|
|
21
21
|
module Commands
|
22
22
|
|
@@ -49,6 +49,20 @@ module CTioga2
|
|
49
49
|
commands[n] = command
|
50
50
|
end
|
51
51
|
puts YAML.dump(commands)
|
52
|
+
when :spec
|
53
|
+
for n in names
|
54
|
+
cmd = cmds[n]
|
55
|
+
puts "#{n}:"
|
56
|
+
for a in cmd.arguments
|
57
|
+
puts " - #{a.type.name}"
|
58
|
+
end
|
59
|
+
|
60
|
+
opts = cmd.optional_arguments.keys.sort
|
61
|
+
for on in opts
|
62
|
+
opt = cmd.optional_arguments[on]
|
63
|
+
puts " * /#{on}=#{opt.type.name}"
|
64
|
+
end
|
65
|
+
end
|
52
66
|
else
|
53
67
|
puts "Known commands:"
|
54
68
|
max = names.inject(0) {|m,x| [m,x.size].max}
|
@@ -132,6 +146,7 @@ module CTioga2
|
|
132
146
|
InternalFormatRE = {
|
133
147
|
/list|raw/i => :list,
|
134
148
|
/default|pretty/i => :pretty,
|
149
|
+
/spec/i => :spec,
|
135
150
|
/yaml/i => :yaml
|
136
151
|
}
|
137
152
|
|
@@ -13,6 +13,7 @@
|
|
13
13
|
|
14
14
|
require 'ctioga2/utils'
|
15
15
|
require 'ctioga2/commands/commands'
|
16
|
+
require 'ctioga2/commands/context'
|
16
17
|
require 'ctioga2/commands/variables'
|
17
18
|
require 'ctioga2/commands/strings'
|
18
19
|
require 'ctioga2/commands/parsers/command-line'
|
@@ -20,7 +21,7 @@ require 'ctioga2/commands/doc/doc'
|
|
20
21
|
|
21
22
|
module CTioga2
|
22
23
|
|
23
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
24
|
+
Version::register_svn_info('$Revision: 355 $', '$Date: 2012-12-26 00:19:04 +0100 (Wed, 26 Dec 2012) $')
|
24
25
|
|
25
26
|
# This module contains the real core of ctioga2: a set of classes
|
26
27
|
# that implement the concept of commands. Each command translates
|
@@ -162,6 +163,9 @@ module CTioga2
|
|
162
163
|
# The Parsers::FileParser object used to... parse files ?
|
163
164
|
attr_reader :file_parser
|
164
165
|
|
166
|
+
# The current context
|
167
|
+
attr_accessor :context
|
168
|
+
|
165
169
|
# Creates an Interpreter with _target_ as the PlotMaker target
|
166
170
|
# object.
|
167
171
|
#
|
@@ -187,6 +191,7 @@ module CTioga2
|
|
187
191
|
end
|
188
192
|
|
189
193
|
@file_parser = Parsers::FileParser.new
|
194
|
+
@context = ParsingContext.new
|
190
195
|
end
|
191
196
|
|
192
197
|
|
@@ -246,6 +251,22 @@ module CTioga2
|
|
246
251
|
converted_options)
|
247
252
|
end
|
248
253
|
end
|
254
|
+
|
255
|
+
def self.make_alias_for_option(cmd_name, option,
|
256
|
+
new_name, deprecated = false)
|
257
|
+
cmd = Interpreter.command(cmd_name)
|
258
|
+
if ! cmd
|
259
|
+
raise "Impossible to find command #{cmd_name}"
|
260
|
+
end
|
261
|
+
new_opt = cmd.optional_arguments[option]
|
262
|
+
if ! new_opt
|
263
|
+
raise "No #{option} option to command #{cmd_name}"
|
264
|
+
end
|
265
|
+
new_opt = new_opt.dup
|
266
|
+
new_opt.option_deprecated = deprecated
|
267
|
+
new_opt.option_target = option
|
268
|
+
cmd.optional_arguments[new_name] = new_opt
|
269
|
+
end
|
249
270
|
end
|
250
271
|
|
251
272
|
# An alias for Commands::Command
|
@@ -17,7 +17,7 @@ require 'ctioga2/commands/commands'
|
|
17
17
|
|
18
18
|
module CTioga2
|
19
19
|
|
20
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
20
|
+
Version::register_svn_info('$Revision: 327 $', '$Date: 2012-11-28 14:47:52 +0100 (Wed, 28 Nov 2012) $')
|
21
21
|
|
22
22
|
module Commands
|
23
23
|
|
@@ -71,6 +71,7 @@ module CTioga2
|
|
71
71
|
# We duplicate the original array
|
72
72
|
argv = argv.dup
|
73
73
|
options = nil # currently never used.
|
74
|
+
number = 0
|
74
75
|
while argv.size > 0
|
75
76
|
current = argv.shift
|
76
77
|
if current =~ /^--(.*)/ # a long option
|
@@ -78,6 +79,8 @@ module CTioga2
|
|
78
79
|
command, arguments, options =
|
79
80
|
extract_command_arguments(argv, @long_options[$1])
|
80
81
|
|
82
|
+
number += 1
|
83
|
+
interpreter.context.parsing_option(current, number)
|
81
84
|
interpreter.run_command(command, arguments, options)
|
82
85
|
else
|
83
86
|
raise OptionUnkown, "Long option #{current} is not known"
|
@@ -89,6 +92,8 @@ module CTioga2
|
|
89
92
|
if @short_options.key?(short)
|
90
93
|
command, arguments, options =
|
91
94
|
extract_command_arguments(argv, @short_options[short])
|
95
|
+
number += 1
|
96
|
+
interpreter.context.parsing_option("-#{short}", number)
|
92
97
|
interpreter.run_command(command, arguments, options)
|
93
98
|
else
|
94
99
|
raise OptionUnkown, "Short option -#{short} is not known"
|
@@ -99,6 +104,8 @@ module CTioga2
|
|
99
104
|
argv.unshift current
|
100
105
|
command, arguments, options =
|
101
106
|
extract_command_arguments(argv, @default_command)
|
107
|
+
number += 1
|
108
|
+
interpreter.context.parsing_option("(default)", number)
|
102
109
|
interpreter.run_command(command, arguments, options)
|
103
110
|
else
|
104
111
|
yield current
|
@@ -19,7 +19,7 @@ require 'ctioga2/commands/strings'
|
|
19
19
|
|
20
20
|
module CTioga2
|
21
21
|
|
22
|
-
Version::register_svn_info('$Revision$', '$Date$')
|
22
|
+
Version::register_svn_info('$Revision: 327 $', '$Date: 2012-11-28 14:47:52 +0100 (Wed, 28 Nov 2012) $')
|
23
23
|
|
24
24
|
module Commands
|
25
25
|
|
@@ -110,6 +110,7 @@ module CTioga2
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
interpreter.context.parsing_file(symbol, io) # Missing line number
|
113
114
|
interpreter.run_command(cmd, real_args, options)
|
114
115
|
io.getc # Slurp up the )
|
115
116
|
break
|