tp_plus 0.0.75 → 0.0.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -11
- data/bin/tpp +29 -10
- data/lib/tp_plus/interpreter.rb +1 -1
- data/lib/tp_plus/nodes/position_data_node.rb +2 -0
- data/lib/tp_plus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7347bb879e0d8008d909ad4888596f07697bd0f4
|
4
|
+
data.tar.gz: bb148385881540ada26d78565576dc8ce8df7acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 786218479e3e4bdee08f867f8d97d04dc73052bdbec3c686088d1dc2d384a3a302d57a479e55facf754b745073f5b75bcd0b09397cc327aa23631d449cb46067
|
7
|
+
data.tar.gz: ad566ce1eab3649796fb06b1e2963a7749c7ee28548e476086941f40b540883c7117e876418648d8b5beec83b129b5a59ef74a4c9f70790f2275687060edfc5a
|
data/README.md
CHANGED
@@ -46,16 +46,16 @@ example_1.ls
|
|
46
46
|
|
47
47
|
/PROG example_1
|
48
48
|
/MN
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
: R[1:foo] = 1 ;
|
50
|
+
: ;
|
51
|
+
: LBL[100:loop] ;
|
52
|
+
: R[1:foo]=R[1:foo]+1 ;
|
53
|
+
: IF R[1:foo]<10,JMP LBL[100] ;
|
54
|
+
: ;
|
55
|
+
: IF (R[1:foo]=5),DO[1:bar]=(ON) ;
|
56
|
+
: DO[2:baz]=(!DO[2:baz]) ;
|
57
|
+
: ;
|
58
|
+
: L PR[1:home] 2000mm/sec CNT0 ;
|
59
59
|
/END
|
60
60
|
|
61
61
|
For a more extensive example and test environment, visit http://tp-plus.herokuapp.com/.
|
@@ -64,7 +64,7 @@ Usage
|
|
64
64
|
-----
|
65
65
|
|
66
66
|
1. `gem install tp_plus`
|
67
|
-
2. `tpp filename.tpp
|
67
|
+
2. `tpp filename.tpp -o filename.ls`
|
68
68
|
|
69
69
|
See `tpp --help` for options.
|
70
70
|
|
data/bin/tpp
CHANGED
@@ -1,24 +1,44 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
require_relative '../lib/tp_plus'
|
3
3
|
require 'optparse'
|
4
4
|
|
5
5
|
options = {}
|
6
6
|
OptionParser.new do |opts|
|
7
7
|
opts.banner = "Usage: tpp [options] filename"
|
8
8
|
|
9
|
-
opts.on("-e", "--environment
|
9
|
+
opts.on("-e", "--environment <file>", "Require an environment file <file> before parsing") do |e|
|
10
10
|
options[:environment] = e
|
11
11
|
end
|
12
12
|
|
13
|
+
opts.on("-o", "--output <file>", "Write output to <file>") do |o|
|
14
|
+
options[:output] = o
|
15
|
+
end
|
16
|
+
|
13
17
|
opts.on_tail("-h", "--help", "Show this message") do
|
14
18
|
puts opts
|
15
19
|
exit
|
16
20
|
end
|
17
21
|
end.parse!
|
18
22
|
|
23
|
+
if ARGV.length != 1
|
24
|
+
puts "Must provide filename argument. See tpp --help for details"
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
tpp_filename = File.basename(ARGV[0],".*")
|
29
|
+
|
30
|
+
if options[:output]
|
31
|
+
# ensure filename matches (FANUC parser will complain otherwise)
|
32
|
+
output_filename = File.basename(options[:output], ".*")
|
33
|
+
if output_filename != tpp_filename
|
34
|
+
puts "Output filename <#{output_filename}> does not match input filename <#{tpp_filename}>"
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
19
39
|
def contents(filename)
|
20
40
|
if !File.exist?(filename)
|
21
|
-
puts "File
|
41
|
+
puts "File <#{filename}> does not exist"
|
22
42
|
exit
|
23
43
|
end
|
24
44
|
f = File.open(filename,'rb')
|
@@ -34,11 +54,6 @@ if options[:environment]
|
|
34
54
|
interpreter.load_environment(contents(options[:environment]))
|
35
55
|
end
|
36
56
|
|
37
|
-
if ARGV.length != 1
|
38
|
-
puts "Must provide filename argument. See tpp --help for details"
|
39
|
-
exit
|
40
|
-
end
|
41
|
-
|
42
57
|
src = contents(ARGV[0])
|
43
58
|
|
44
59
|
scanner.scan_setup(src)
|
@@ -46,7 +61,6 @@ parser.parse
|
|
46
61
|
|
47
62
|
lines = interpreter.eval
|
48
63
|
|
49
|
-
tpp_filename = File.basename(ARGV[0],".*")
|
50
64
|
output = %(/PROG #{tpp_filename.upcase}
|
51
65
|
/ATTR
|
52
66
|
COMMENT = "#{interpreter.header_data[:comment] || tpp_filename.upcase}";
|
@@ -70,4 +84,9 @@ end
|
|
70
84
|
|
71
85
|
output += %(/END\n)
|
72
86
|
|
73
|
-
|
87
|
+
if options[:output]
|
88
|
+
# write to file
|
89
|
+
File.write(options[:output], output)
|
90
|
+
else
|
91
|
+
print output
|
92
|
+
end
|
data/lib/tp_plus/interpreter.rb
CHANGED
data/lib/tp_plus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tp_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.76
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Strybis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|