mathgl 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mathgl/libdoc_core_en.rb +144 -140
- data/lib/mathgl/libdoc_data_en.rb +1097 -698
- data/lib/mathgl/libdoc_other_en.rb +6 -9
- data/lib/mathgl/libdoc_parse_en.rb +6 -4
- data/lib/mathgl/version.rb +1 -1
- data/misc/conv_texi.rb +60 -60
- metadata +17 -17
@@ -1,7 +1,9 @@
|
|
1
1
|
# This document is converted from other_en.texi.
|
2
|
+
|
3
|
+
# MglColor class
|
2
4
|
class MglColor
|
3
5
|
|
4
|
-
# Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval
|
6
|
+
# Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval (0,1).
|
5
7
|
# @overload set(r,g,b,a=1)
|
6
8
|
# @param [Float] r
|
7
9
|
# @param [Float] g
|
@@ -78,6 +80,8 @@ end
|
|
78
80
|
|
79
81
|
end # MglColor
|
80
82
|
|
83
|
+
|
84
|
+
# MglPoint class
|
81
85
|
class MglPoint
|
82
86
|
|
83
87
|
# Returns true if point contain NAN values.
|
@@ -87,7 +91,7 @@ def is_nan
|
|
87
91
|
end
|
88
92
|
|
89
93
|
|
90
|
-
# Returns the norm
|
94
|
+
# Returns the norm \sqrt(x^2+y^2+z^2) of vector.
|
91
95
|
# @overload norm()
|
92
96
|
# @return [Float]
|
93
97
|
def norm
|
@@ -181,12 +185,5 @@ def |
|
|
181
185
|
end
|
182
186
|
|
183
187
|
|
184
|
-
# Return the norm sqrt(|a|^2) of vector a.
|
185
|
-
# @overload mgl_norm()
|
186
|
-
# @return [MglPoint]
|
187
|
-
def mgl_norm
|
188
|
-
end
|
189
|
-
|
190
|
-
|
191
188
|
end # MglPoint
|
192
189
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# This document is converted from parse_en.texi.
|
2
|
+
|
3
|
+
# MglParse class
|
2
4
|
class MglParse
|
3
5
|
|
4
|
-
# Main function in the class. Function parse and execute line-by-line MGL script in array text. Lines are separated by newline symbol
|
6
|
+
# Main function in the class. Function parse and execute line-by-line MGL script in array text. Lines are separated by newline symbol '\n' as usual.
|
5
7
|
# @overload execute(gr,text)
|
6
8
|
# @param [MglGraph] gr
|
7
9
|
# @param [String] text
|
@@ -38,7 +40,7 @@ def calc
|
|
38
40
|
end
|
39
41
|
|
40
42
|
|
41
|
-
# Function set the value of n-th parameter as string str (n=0, 1 ... 'z'-'a'+10). String str shouldn't contain
|
43
|
+
# Function set the value of n-th parameter as string str (n=0, 1 ... 'z'-'a'+10). String str shouldn't contain '$' symbol.
|
42
44
|
# @overload add_param(n,str)
|
43
45
|
# @param [Integer] n
|
44
46
|
# @param [String] str
|
@@ -47,7 +49,7 @@ def add_param
|
|
47
49
|
end
|
48
50
|
|
49
51
|
|
50
|
-
# Function returns the pointer to variable with name name or zero if variable is absent. Use this function to put external data array to the script or get the data from the script. You must
|
52
|
+
# Function returns the pointer to variable with name name or zero if variable is absent. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
|
51
53
|
# @overload find_var(name)
|
52
54
|
# @param [String] name
|
53
55
|
# @return [MglVar]
|
@@ -55,7 +57,7 @@ def find_var
|
|
55
57
|
end
|
56
58
|
|
57
59
|
|
58
|
-
# Function returns the pointer to variable with name name. If variable is absent then new variable is created with name name. Use this function to put external data array to the script or get the data from the script. You must
|
60
|
+
# Function returns the pointer to variable with name name. If variable is absent then new variable is created with name name. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
|
59
61
|
# @overload add_var(name)
|
60
62
|
# @param [String] name
|
61
63
|
# @return [MglVar]
|
data/lib/mathgl/version.rb
CHANGED
data/misc/conv_texi.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
class MethodType
|
2
3
|
|
3
4
|
class Args
|
@@ -30,7 +31,7 @@ class MethodType
|
|
30
31
|
s = s.gsub(/(\*|&)/,"")
|
31
32
|
s.strip!
|
32
33
|
case s
|
33
|
-
when /
|
34
|
+
when /mglDataA/
|
34
35
|
"MglData"
|
35
36
|
when /mgl(\w+)\b/
|
36
37
|
"Mgl"+$1
|
@@ -106,8 +107,6 @@ class MethodType
|
|
106
107
|
|
107
108
|
|
108
109
|
def parse(line)
|
109
|
-
#p line
|
110
|
-
#if line.nil?
|
111
110
|
if /(.*)\((.*)\)/ =~ line.strip
|
112
111
|
m,parms = $1,$2
|
113
112
|
if /(\S.*[\s*&])(\w+\S+)/ =~ m
|
@@ -153,14 +152,14 @@ class MethodType
|
|
153
152
|
end
|
154
153
|
|
155
154
|
def valid
|
155
|
+
re_ignore = /\b(HMGL|HCDT|HMPR|HMDT|HADT)\b/
|
156
156
|
@name !~ /=$/ and
|
157
|
+
@name !~ /^mgl_/ and
|
157
158
|
@name != "!" and
|
158
159
|
@name != "unknown_method" and
|
159
160
|
@clss =~ /^mgl/i and
|
160
|
-
@return_type !~
|
161
|
-
@args.all?
|
162
|
-
/\b(HMGL|HCDT|HMPR)\b/ !~ a.type
|
163
|
-
end
|
161
|
+
@return_type !~ re_ignore and
|
162
|
+
@args.all?{|a| re_ignore !~ a.type}
|
164
163
|
end
|
165
164
|
|
166
165
|
def ruby_def
|
@@ -174,10 +173,10 @@ class TexiParse
|
|
174
173
|
end
|
175
174
|
|
176
175
|
def parse(src_str)
|
177
|
-
@re_ignore_param = /\b(HMGL|HCDT|HMPR)\b/
|
178
176
|
@tags = {}
|
179
177
|
@defs = []
|
180
178
|
@docs = {}
|
179
|
+
@classes = {}
|
181
180
|
@block_nest = []
|
182
181
|
@s = src_str
|
183
182
|
@a = @s.scan(/^.*$/).map{|x| x}
|
@@ -187,7 +186,9 @@ class TexiParse
|
|
187
186
|
tags = tags.keys
|
188
187
|
@re_tag = /^@(#{tags.join('|')})\b\s*(.*)/
|
189
188
|
|
190
|
-
block_loop()
|
189
|
+
s=block_loop()
|
190
|
+
#s.each do |x| puts x if !x.empty? end
|
191
|
+
#print "\n\n"
|
191
192
|
end
|
192
193
|
|
193
194
|
def empty?
|
@@ -197,7 +198,7 @@ class TexiParse
|
|
197
198
|
def write(io)
|
198
199
|
@docs.each do |clss,docs|
|
199
200
|
if clss
|
200
|
-
io.print "class #{clss}\n\n"
|
201
|
+
io.print "\n# #{clss} class\nclass #{clss}\n\n"
|
201
202
|
docs.each do |x|
|
202
203
|
io.print x+"\n\n"
|
203
204
|
end
|
@@ -206,10 +207,6 @@ class TexiParse
|
|
206
207
|
end
|
207
208
|
end
|
208
209
|
|
209
|
-
def c(a)
|
210
|
-
""
|
211
|
-
end
|
212
|
-
|
213
210
|
def block_loop(tag="_top_",arg=nil)
|
214
211
|
b = []
|
215
212
|
@block_nest.push([])
|
@@ -236,23 +233,31 @@ class TexiParse
|
|
236
233
|
|
237
234
|
def default_tag(tag,arg)
|
238
235
|
tag = "section" if tag == "subsection"
|
236
|
+
arg = arg.gsub(/\{([^{}]+)\}/,'\1')
|
239
237
|
@tags[tag] = arg
|
240
|
-
|
241
|
-
nil
|
238
|
+
arg
|
242
239
|
end
|
243
240
|
|
244
241
|
def parse_tag(tag,arg)
|
245
242
|
if respond_to?(tag)
|
246
243
|
send(tag,arg)
|
247
244
|
else
|
245
|
+
#puts "unknown tag: #{tag} arg: #{arg}"
|
248
246
|
default_tag(tag,arg)
|
249
247
|
end
|
250
248
|
end
|
251
249
|
|
252
250
|
def parse_inline(a)
|
253
251
|
a = a.gsub(/@(\w+)\{([^}]*)\}/){|x| parse_tag($1,$2)}
|
254
|
-
a.gsub!(/@\{/,"
|
255
|
-
a.gsub!(/@\}/,"
|
252
|
+
#a.gsub!(/@\{/,"{")
|
253
|
+
#a.gsub!(/@\}/,"}")
|
254
|
+
#a.gsub!(/\[/,'[')
|
255
|
+
#a.gsub!(/\]/,']')
|
256
|
+
a.gsub!(/@\{/,'(')
|
257
|
+
a.gsub!(/@\}/,')')
|
258
|
+
a.gsub!(/\[/,'(')
|
259
|
+
a.gsub!(/\]/,')')
|
260
|
+
a.gsub!(/@@/,"@")
|
256
261
|
a
|
257
262
|
end
|
258
263
|
|
@@ -269,6 +274,10 @@ class TexiParse
|
|
269
274
|
end
|
270
275
|
end
|
271
276
|
|
277
|
+
def c(a)
|
278
|
+
""
|
279
|
+
end
|
280
|
+
|
272
281
|
def ifclear(arg)
|
273
282
|
if !@defs.include?(arg)
|
274
283
|
block_loop("ifclear",arg)
|
@@ -303,21 +312,24 @@ class TexiParse
|
|
303
312
|
s << "# #{x}\n"
|
304
313
|
end
|
305
314
|
mm = nil
|
315
|
+
h = {}
|
306
316
|
@method.each do |m|
|
307
317
|
if m and m.valid
|
308
|
-
|
309
|
-
|
318
|
+
clss = m.clss
|
319
|
+
a = h[clss]
|
320
|
+
h[clss] = a = [] if a.nil?
|
321
|
+
a << m
|
310
322
|
end
|
311
323
|
end
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
324
|
+
h.each do |clss,a|
|
325
|
+
d = s.dup
|
326
|
+
a.each do |m|
|
327
|
+
d << m.mkdoc
|
328
|
+
end
|
329
|
+
d << a[0].ruby_def
|
316
330
|
b = @docs[clss]
|
317
331
|
@docs[clss] = b = [] unless b
|
318
|
-
b
|
319
|
-
elsif mm
|
320
|
-
puts "undoc: "+mm.name
|
332
|
+
b << d
|
321
333
|
end
|
322
334
|
nil
|
323
335
|
end
|
@@ -327,53 +339,33 @@ class TexiParse
|
|
327
339
|
a = parse_inline(a)
|
328
340
|
a = a.strip
|
329
341
|
#puts "- deftypefnx #{a}"
|
330
|
-
|
342
|
+
case a
|
343
|
+
when /\{(\w+) on ([^}]+)\}(.*)/
|
331
344
|
type,clss,args = $1,$2,$3
|
332
345
|
case type
|
333
346
|
when "Method"
|
334
347
|
@method << MethodType.new(clss,args)
|
335
|
-
#a = [type,clss,*parse_param(args)]
|
336
|
-
#a[4].unshift "# @overload #{a[2]}(#{a[3].join(',')})"
|
337
|
-
#if a[4].all?{|x| @re_ignore_param !~ x}
|
338
|
-
# @method << a
|
339
|
-
#end
|
340
348
|
when "Constructor"
|
341
349
|
@method << MethodType.new(clss,args)
|
342
|
-
#a = [type,clss,*parse_param(args)]
|
343
|
-
#a[4].unshift "# @overload initialize(#{a[3].join(',')})"
|
344
|
-
#if a[4].all?{|x| @re_ignore_param !~ x}
|
345
|
-
# @method << a
|
346
|
-
#end
|
347
350
|
when "Destructor"
|
348
351
|
when "Slot"
|
349
352
|
when "Signal"
|
350
353
|
else
|
351
354
|
raise "unknown method type : #{type}"
|
352
355
|
end
|
353
|
-
|
356
|
+
when /\{Library Function\}(.*)/
|
354
357
|
clss,args = nil,$1
|
355
358
|
@method << MethodType.new(clss,args)
|
356
|
-
|
357
|
-
#if a and a[4].all?{|x| @re_ignore_param !~ x}
|
358
|
-
# @method << a
|
359
|
-
#end
|
360
|
-
elsif /^(mgl\w+) (.*)/ =~ a
|
359
|
+
when /^(mgl\w+) (.*)/
|
361
360
|
clss,args = $1,$2
|
362
|
-
#p [clss,args]
|
363
361
|
m = MethodType.new(clss,args)
|
364
|
-
#p m
|
365
|
-
#p m.mkdoc
|
366
362
|
@method << m
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
elsif /\{Global function\}/ =~ a
|
374
|
-
elsif /\{MGL suffix\}/ =~ a
|
375
|
-
elsif /QMathGL/ =~ a
|
376
|
-
elsif /Fl_MathGL/ =~ a
|
363
|
+
when /\{MGL command\}/
|
364
|
+
when /\{C function\}/
|
365
|
+
when /\{Global function\}/
|
366
|
+
when /\{MGL suffix\}/
|
367
|
+
when /QMathGL/
|
368
|
+
when /Fl_MathGL/
|
377
369
|
else
|
378
370
|
puts "undoc: "+a
|
379
371
|
end
|
@@ -385,12 +377,20 @@ class TexiParse
|
|
385
377
|
s
|
386
378
|
end
|
387
379
|
|
380
|
+
def samp(s)
|
381
|
+
"'"+s+"'"
|
382
|
+
end
|
383
|
+
|
388
384
|
def var(s)
|
389
385
|
s
|
390
386
|
end
|
391
387
|
|
392
388
|
def emph(x)
|
393
|
-
|
389
|
+
if /^\w+$/ =~ x
|
390
|
+
"*"+x+"*"
|
391
|
+
else
|
392
|
+
x
|
393
|
+
end
|
394
394
|
end
|
395
395
|
|
396
396
|
def code(x)
|
@@ -407,8 +407,8 @@ end
|
|
407
407
|
srcdir = ENV["HOME"]+"/2013/src/mathgl-2.1.3.1/texinfo/"
|
408
408
|
dstdir = ENV["HOME"]+"/2013/git/ruby-mathgl/lib/mathgl/"
|
409
409
|
|
410
|
-
|
411
|
-
|
410
|
+
%w[core data other parse].each do |b|
|
411
|
+
rf = srcdir+b+'_en.texi'
|
412
412
|
src = nil
|
413
413
|
open(rf,"r"){|io| src = io.read}
|
414
414
|
if /deftypefn/=~src
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mathgl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Ruby wrapper for MathGL - library for scientific data visualization
|
@@ -46,7 +46,7 @@ extensions:
|
|
46
46
|
- ext/mathgl/extconf.rb
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
50
|
- COPYING_LGPL
|
51
51
|
- Gemfile
|
52
52
|
- README.md
|
@@ -76,32 +76,32 @@ licenses:
|
|
76
76
|
metadata: {}
|
77
77
|
post_install_message:
|
78
78
|
rdoc_options:
|
79
|
-
- --exclude
|
79
|
+
- "--exclude"
|
80
80
|
- lib/mathgl.so
|
81
|
-
- --exclude
|
81
|
+
- "--exclude"
|
82
82
|
- doc/
|
83
|
-
- --exclude
|
83
|
+
- "--exclude"
|
84
84
|
- ext/
|
85
|
-
- --exclude
|
85
|
+
- "--exclude"
|
86
86
|
- sample/
|
87
|
-
- --exclude
|
87
|
+
- "--exclude"
|
88
88
|
- setup.rb
|
89
|
-
- --exclude
|
89
|
+
- "--exclude"
|
90
90
|
- mathgl.gemspec
|
91
|
-
- --exclude
|
91
|
+
- "--exclude"
|
92
92
|
- Gemfile
|
93
|
-
- --exclude
|
93
|
+
- "--exclude"
|
94
94
|
- Rakefile
|
95
95
|
require_paths:
|
96
96
|
- lib
|
97
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|