cosmos 4.4.0 → 4.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +2 -0
  3. data/.gitignore +1 -0
  4. data/.travis.yml +6 -6
  5. data/Dockerfile +70 -0
  6. data/Manifest.txt +37 -2
  7. data/README.md +9 -0
  8. data/Rakefile +55 -5
  9. data/appveyor.yml +18 -8
  10. data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
  11. data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
  12. data/autohotkey/procedures/collect.rb +2 -2
  13. data/autohotkey/procedures/collect_util.rb +1 -1
  14. data/autohotkey/procedures/script_test.rb +1 -1
  15. data/autohotkey/tools/CmdSenderAHK2 +18 -0
  16. data/autohotkey/tools/cmd_extractor.ahk +11 -9
  17. data/autohotkey/tools/cmd_sender.ahk +35 -7
  18. data/autohotkey/tools/cmd_sender2.ahk +4 -0
  19. data/autohotkey/tools/cmd_sequence.ahk +22 -9
  20. data/autohotkey/tools/config_editor.ahk +4 -4
  21. data/autohotkey/tools/data_viewer.ahk +1 -1
  22. data/autohotkey/tools/limits_monitor.ahk +1 -1
  23. data/autohotkey/tools/packet_viewer.ahk +1 -1
  24. data/autohotkey/tools/script_runner.ahk +1 -1
  25. data/autohotkey/tools/test_runner2.ahk +1 -1
  26. data/autohotkey/tools/tlm_grapher.ahk +1 -1
  27. data/autohotkey/tools/tlm_grapher3.ahk +1 -1
  28. data/autohotkey/tools/tlm_viewer.ahk +1 -1
  29. data/autohotkey/tools/tlm_viewer2.ahk +1 -1
  30. data/autohotkey/tools/tlm_viewer5.ahk +1 -1
  31. data/bin/cstol_converter +1 -1
  32. data/bin/rubysloc +73 -28
  33. data/bin/xtce_converter +1 -1
  34. data/cosmos.gemspec +2 -2
  35. data/data/config/command_modifiers.yaml +16 -1
  36. data/data/config/interface_modifiers.yaml +3 -2
  37. data/data/config/param_item_modifiers.yaml +5 -0
  38. data/data/config/system.yaml +110 -23
  39. data/data/config/telemetry_modifiers.yaml +16 -1
  40. data/data/crc.txt +416 -411
  41. data/demo/Rakefile +4 -4
  42. data/demo/config/dart/Gemfile +1 -6
  43. data/demo/config/data/crc.txt +233 -232
  44. data/demo/config/system/system.txt +17 -6
  45. data/demo/config/system/system2.txt +17 -6
  46. data/demo/config/system/system_alt_ports.txt +17 -6
  47. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +4 -4
  48. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +4 -0
  49. data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
  50. data/demo/config/targets/INST/lib/sim_inst.rb +2 -2
  51. data/demo/config/targets/INST/target.txt +1 -0
  52. data/demo/config/tools/handbook_creator/default_toc.xsl +59 -59
  53. data/demo/procedures/cosmos_api_test.rb +8 -8
  54. data/ext/cosmos/ext/buffered_file/buffered_file.c +2 -2
  55. data/ext/cosmos/ext/config_parser/config_parser.c +1 -2
  56. data/ext/cosmos/ext/line_graph/line_graph.c +53 -94
  57. data/ext/cosmos/ext/platform/platform.c +56 -21
  58. data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +4 -8
  59. data/ext/cosmos/ext/structure/structure.c +12 -0
  60. data/extensions/vscode/.gitignore +4 -0
  61. data/extensions/vscode/.vscode/launch.json +32 -0
  62. data/extensions/vscode/.vscode/settings.json +13 -0
  63. data/extensions/vscode/.vscode/tasks.json +79 -0
  64. data/extensions/vscode/License.txt +879 -0
  65. data/extensions/vscode/README.md +9 -0
  66. data/extensions/vscode/client/License.txt +879 -0
  67. data/extensions/vscode/client/README.md +39 -0
  68. data/extensions/vscode/client/cosmos.configuration.json +23 -0
  69. data/extensions/vscode/client/images/icon.png +0 -0
  70. data/extensions/vscode/client/package-lock.json +414 -0
  71. data/extensions/vscode/client/package.json +105 -0
  72. data/extensions/vscode/client/src/extension.ts +132 -0
  73. data/extensions/vscode/client/src/screen_preview.rb +25 -0
  74. data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
  75. data/extensions/vscode/client/tsconfig.json +17 -0
  76. data/extensions/vscode/package-lock.json +26 -0
  77. data/extensions/vscode/package.json +35 -0
  78. data/extensions/vscode/server/License.txt +879 -0
  79. data/extensions/vscode/server/package-lock.json +236 -0
  80. data/extensions/vscode/server/package.json +29 -0
  81. data/extensions/vscode/server/src/server.ts +59 -0
  82. data/extensions/vscode/server/tsconfig.json +16 -0
  83. data/install/Rakefile +4 -4
  84. data/install/config/dart/Gemfile +2 -7
  85. data/install/config/data/crc.txt +137 -137
  86. data/install/config/system/system.txt +17 -6
  87. data/install/config/tools/handbook_creator/default_toc.xsl +59 -59
  88. data/lib/cosmos/config/config_parser.rb +2 -10
  89. data/lib/cosmos/core_ext/class.rb +10 -0
  90. data/lib/cosmos/core_ext/time.rb +5 -3
  91. data/lib/cosmos/dart/config/boot.rb +1 -1
  92. data/lib/cosmos/dart/config/database.yml +2 -0
  93. data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
  94. data/lib/cosmos/dart/lib/dart_common.rb +12 -5
  95. data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
  96. data/lib/cosmos/dart/lib/dart_decom_query.rb +5 -6
  97. data/lib/cosmos/dart/lib/dart_decommutator.rb +64 -54
  98. data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
  99. data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +165 -134
  100. data/lib/cosmos/dart/processes/dart.rb +4 -2
  101. data/lib/cosmos/dart/processes/dart_decom_server.rb +3 -3
  102. data/lib/cosmos/dart/processes/dart_ingester.rb +38 -1
  103. data/lib/cosmos/dart/processes/dart_master.rb +44 -0
  104. data/lib/cosmos/dart/processes/dart_util.rb +115 -0
  105. data/lib/cosmos/dart/spec/dart/dart_database_cleaner_spec.rb +2 -2
  106. data/lib/cosmos/gui/qt.rb +10 -10
  107. data/lib/cosmos/gui/qt_tool.rb +17 -12
  108. data/lib/cosmos/gui/text/completion_text_edit.rb +2 -0
  109. data/lib/cosmos/gui/widgets/dart_meta_frame.rb +22 -3
  110. data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
  111. data/lib/cosmos/interfaces/linc_interface.rb +3 -3
  112. data/lib/cosmos/interfaces/protocols/burst_protocol.rb +1 -1
  113. data/lib/cosmos/interfaces/protocols/crc_protocol.rb +1 -1
  114. data/lib/cosmos/interfaces/protocols/length_protocol.rb +5 -0
  115. data/lib/cosmos/interfaces/protocols/template_protocol.rb +3 -3
  116. data/lib/cosmos/interfaces/serial_interface.rb +7 -1
  117. data/lib/cosmos/interfaces/stream_interface.rb +1 -1
  118. data/lib/cosmos/interfaces/tcpip_server_interface.rb +16 -16
  119. data/lib/cosmos/io/io_multiplexer.rb +6 -2
  120. data/lib/cosmos/io/json_drb.rb +5 -5
  121. data/lib/cosmos/io/json_drb_object.rb +7 -2
  122. data/lib/cosmos/io/json_drb_rack.rb +25 -5
  123. data/lib/cosmos/io/json_rpc.rb +1 -1
  124. data/lib/cosmos/io/posix_serial_driver.rb +60 -22
  125. data/lib/cosmos/io/serial_driver.rb +11 -8
  126. data/lib/cosmos/io/win32_serial_driver.rb +31 -3
  127. data/lib/cosmos/packet_logs/packet_log_reader.rb +2 -2
  128. data/lib/cosmos/packets/packet.rb +9 -9
  129. data/lib/cosmos/packets/packet_config.rb +27 -9
  130. data/lib/cosmos/packets/parsers/xtce_converter.rb +10 -10
  131. data/lib/cosmos/packets/parsers/xtce_parser.rb +3 -0
  132. data/lib/cosmos/packets/structure.rb +35 -5
  133. data/lib/cosmos/packets/structure_item.rb +5 -1
  134. data/lib/cosmos/packets/telemetry.rb +7 -1
  135. data/lib/cosmos/script/api_shared.rb +18 -1
  136. data/lib/cosmos/script/extract.rb +1 -1
  137. data/lib/cosmos/script/script.rb +4 -11
  138. data/lib/cosmos/streams/serial_stream.rb +11 -6
  139. data/lib/cosmos/system/system.rb +155 -57
  140. data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
  141. data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
  142. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +29 -318
  143. data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +14 -17
  144. data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +38 -331
  145. data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +16 -11
  146. data/lib/cosmos/tools/cmd_tlm_server/api.rb +10 -8
  147. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +2 -2
  148. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1 -0
  149. data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +1 -1
  150. data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +29 -26
  151. data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +1 -1
  152. data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +5 -0
  153. data/lib/cosmos/tools/config_editor/config_editor.rb +34 -3
  154. data/lib/cosmos/tools/config_editor/config_editor_frame.rb +8 -9
  155. data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
  156. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +1 -1
  157. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
  158. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +7 -4
  159. data/lib/cosmos/tools/test_runner/test.rb +6 -3
  160. data/lib/cosmos/tools/test_runner/test_runner.rb +6 -6
  161. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
  162. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +1 -4
  163. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +20 -16
  164. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +21 -17
  165. data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +18 -11
  166. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +17 -6
  167. data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +2 -0
  168. data/lib/cosmos/top_level.rb +1 -1
  169. data/lib/cosmos/utilities/ruby_lex_utils.rb +34 -30
  170. data/lib/cosmos/utilities/simulated_target.rb +1 -1
  171. data/lib/cosmos/version.rb +5 -5
  172. data/lib/cosmos/win32/excel.rb +23 -17
  173. data/run_gui_tests.bat +1 -0
  174. data/spec/core_ext/class_spec.rb +54 -0
  175. data/spec/core_ext/socket_spec.rb +1 -1
  176. data/spec/core_ext/time_spec.rb +4 -0
  177. data/spec/install/yaml_docs_spec.rb +26 -6
  178. data/spec/interfaces/linc_interface_spec.rb +1 -1
  179. data/spec/interfaces/protocols/length_protocol_spec.rb +39 -0
  180. data/spec/interfaces/serial_interface_spec.rb +1 -5
  181. data/spec/io/json_drb_rack_spec.rb +166 -0
  182. data/spec/io/json_drb_spec.rb +14 -0
  183. data/spec/io/json_rpc_spec.rb +4 -5
  184. data/spec/io/posix_serial_driver_spec.rb +81 -0
  185. data/spec/io/win32_serial_driver_spec.rb +33 -3
  186. data/spec/packet_logs/packet_log_reader_spec.rb +36 -37
  187. data/spec/packets/structure_spec.rb +52 -2
  188. data/spec/packets/telemetry_spec.rb +29 -1
  189. data/spec/script/extract_spec.rb +4 -1
  190. data/spec/system/system_spec.rb +111 -3
  191. data/spec/tools/cmd_tlm_server/api_spec.rb +12 -12
  192. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +2 -2
  193. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +4 -3
  194. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
  195. data/spec/utilities/logger_spec.rb +3 -3
  196. data/spec/utilities/message_log_spec.rb +6 -3
  197. data/tasks/gemfile_stats.rake +22 -13
  198. data/test/performance/Rakefile +4 -4
  199. data/test/performance/config/data/crc.txt +67 -48
  200. metadata +52 -11
  201. data/demo/outputs/dart/logs/README.txt +0 -1
  202. data/lib/cosmos/dart/Gemfile +0 -69
@@ -10,15 +10,17 @@ DECLARE_TARGET DART
10
10
  DECLARE_TARGET SYSTEM
11
11
 
12
12
  # Listen Hosts - Ip addresses or hostnames to listen on when running the tools
13
+ # Set these to 0.0.0.0 if you need external connections from other computers
13
14
  LISTEN_HOST CTS_API 127.0.0.1
14
15
  LISTEN_HOST TLMVIEWER_API 127.0.0.1
15
- LISTEN_HOST CTS_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
16
- LISTEN_HOST CTS_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
16
+ LISTEN_HOST CTS_PREIDENTIFIED 127.0.0.1
17
+ LISTEN_HOST CTS_CMD_ROUTER 127.0.0.1
17
18
  LISTEN_HOST REPLAY_API 127.0.0.1
18
- LISTEN_HOST REPLAY_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
19
- LISTEN_HOST REPLAY_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
20
- LISTEN_HOST DART_STREAM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
21
- LISTEN_HOST DART_DECOM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
19
+ LISTEN_HOST REPLAY_PREIDENTIFIED 127.0.0.1
20
+ LISTEN_HOST REPLAY_CMD_ROUTER 127.0.0.1
21
+ LISTEN_HOST DART_STREAM 127.0.0.1
22
+ LISTEN_HOST DART_DECOM 127.0.0.1
23
+ LISTEN_HOST DART_MASTER 127.0.0.1
22
24
 
23
25
  # Connect Hosts - Ip addresses or hostnames to connect to when running the tools
24
26
  CONNECT_HOST CTS_API 127.0.0.1
@@ -30,6 +32,7 @@ CONNECT_HOST REPLAY_PREIDENTIFIED 127.0.0.1
30
32
  CONNECT_HOST REPLAY_CMD_ROUTER 127.0.0.1
31
33
  CONNECT_HOST DART_STREAM 127.0.0.1
32
34
  CONNECT_HOST DART_DECOM 127.0.0.1
35
+ CONNECT_HOST DART_MASTER 127.0.0.1
33
36
 
34
37
  # Ethernet Ports
35
38
  PORT CTS_API 7777
@@ -41,6 +44,7 @@ PORT REPLAY_PREIDENTIFIED 7879
41
44
  PORT REPLAY_CMD_ROUTER 7880
42
45
  PORT DART_STREAM 8777
43
46
  PORT DART_DECOM 8779
47
+ PORT DART_MASTER 8780
44
48
 
45
49
  # Default Packet Log Writer and Reader
46
50
  DEFAULT_PACKET_LOG_WRITER packet_log_writer.rb
@@ -77,3 +81,10 @@ ADD_HASH_FILE lib/user_version.rb
77
81
 
78
82
  # Create a banner using a RGB color values
79
83
  # CLASSIFICATION Secret 255 114 0
84
+
85
+ # ALLOW_ROUTER_COMMANDING # Enable this to chain servers with commanding
86
+ # ALLOW_HOST localhost:7777 # This is provided by default. Add with HostIP:7777 for chaining
87
+ # ALLOW_ORIGIN 1.2.3.4:8080 # Add this if you have a webserver that should be able to access the COSMOS API
88
+
89
+ # *** IMPORTANT *** Change this value to a unique value for each project
90
+ X_CSRF_TOKEN SuperSecret # Secret used to secure requests - Change for each project
@@ -8,15 +8,17 @@ DECLARE_TARGET EXAMPLE
8
8
  DECLARE_TARGET SYSTEM
9
9
 
10
10
  # Listen Hosts - Ip addresses or hostnames to listen on when running the tools
11
+ # Set these to 0.0.0.0 if you need external connections from other computers
11
12
  LISTEN_HOST CTS_API 127.0.0.1
12
13
  LISTEN_HOST TLMVIEWER_API 127.0.0.1
13
- LISTEN_HOST CTS_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
14
- LISTEN_HOST CTS_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
14
+ LISTEN_HOST CTS_PREIDENTIFIED 127.0.0.1
15
+ LISTEN_HOST CTS_CMD_ROUTER 127.0.0.1
15
16
  LISTEN_HOST REPLAY_API 127.0.0.1
16
- LISTEN_HOST REPLAY_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
17
- LISTEN_HOST REPLAY_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
18
- LISTEN_HOST DART_STREAM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
19
- LISTEN_HOST DART_DECOM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
17
+ LISTEN_HOST REPLAY_PREIDENTIFIED 127.0.0.1
18
+ LISTEN_HOST REPLAY_CMD_ROUTER 127.0.0.1
19
+ LISTEN_HOST DART_STREAM 127.0.0.1
20
+ LISTEN_HOST DART_DECOM 127.0.0.1
21
+ LISTEN_HOST DART_MASTER 127.0.0.1
20
22
 
21
23
  # Connect Hosts - Ip addresses or hostnames to connect to when running the tools
22
24
  CONNECT_HOST CTS_API 127.0.0.1
@@ -28,6 +30,7 @@ CONNECT_HOST REPLAY_PREIDENTIFIED 127.0.0.1
28
30
  CONNECT_HOST REPLAY_CMD_ROUTER 127.0.0.1
29
31
  CONNECT_HOST DART_STREAM 127.0.0.1
30
32
  CONNECT_HOST DART_DECOM 127.0.0.1
33
+ CONNECT_HOST DART_MASTER 127.0.0.1
31
34
 
32
35
  # Ethernet Ports
33
36
  PORT CTS_API 7777
@@ -39,6 +42,7 @@ PORT REPLAY_PREIDENTIFIED 7879
39
42
  PORT REPLAY_CMD_ROUTER 7880
40
43
  PORT DART_STREAM 8777
41
44
  PORT DART_DECOM 8779
45
+ PORT DART_DECOM 8780
42
46
 
43
47
  # Default Packet Log Writer and Reader
44
48
  DEFAULT_PACKET_LOG_WRITER packet_log_writer.rb
@@ -62,3 +66,10 @@ ALLOW_ACCESS ALL
62
66
 
63
67
  # Initialize the metadata dialog using values from the following file:
64
68
  # META_INIT config/data/meta_init.txt
69
+
70
+ # ALLOW_ROUTER_COMMANDING # Enable this to chain servers with commanding
71
+ # ALLOW_HOST localhost:7777 # This is provided by default. Add with HostIP:7777 for chaining
72
+ # ALLOW_ORIGIN 1.2.3.4:8080 # Add this if you have a webserver that should be able to access the COSMOS API
73
+
74
+ # *** IMPORTANT *** Change this value to a unique value for each project
75
+ X_CSRF_TOKEN SuperSecret # Secret used to secure requests - Change for each project
@@ -10,15 +10,17 @@ DECLARE_TARGET DART
10
10
  DECLARE_TARGET SYSTEM
11
11
 
12
12
  # Listen Hosts - Ip addresses or hostnames to listen on when running the tools
13
+ # Set these to 0.0.0.0 if you need external connections from other computers
13
14
  LISTEN_HOST CTS_API 127.0.0.1
14
15
  LISTEN_HOST TLMVIEWER_API 127.0.0.1
15
- LISTEN_HOST CTS_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
16
- LISTEN_HOST CTS_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
16
+ LISTEN_HOST CTS_PREIDENTIFIED 127.0.0.1
17
+ LISTEN_HOST CTS_CMD_ROUTER 127.0.0.1
17
18
  LISTEN_HOST REPLAY_API 127.0.0.1
18
- LISTEN_HOST REPLAY_PREIDENTIFIED 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
19
- LISTEN_HOST REPLAY_CMD_ROUTER 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
20
- LISTEN_HOST DART_STREAM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
21
- LISTEN_HOST DART_DECOM 0.0.0.0 # 127.0.0.1 is more secure if you don't need external connections
19
+ LISTEN_HOST REPLAY_PREIDENTIFIED 127.0.0.1
20
+ LISTEN_HOST REPLAY_CMD_ROUTER 127.0.0.1
21
+ LISTEN_HOST DART_STREAM 127.0.0.1
22
+ LISTEN_HOST DART_DECOM 127.0.0.1
23
+ LISTEN_HOST DART_MASTER 127.0.0.1
22
24
 
23
25
  # Connect Hosts - Ip addresses or hostnames to connect to when running the tools
24
26
  CONNECT_HOST CTS_API 127.0.0.1
@@ -30,6 +32,7 @@ CONNECT_HOST REPLAY_PREIDENTIFIED 127.0.0.1
30
32
  CONNECT_HOST REPLAY_CMD_ROUTER 127.0.0.1
31
33
  CONNECT_HOST DART_STREAM 127.0.0.1
32
34
  CONNECT_HOST DART_DECOM 127.0.0.1
35
+ CONNECT_HOST DART_MASTER 127.0.0.1
33
36
 
34
37
  # Ethernet Ports
35
38
  PORT CTS_API 9777
@@ -41,6 +44,7 @@ PORT REPLAY_PREIDENTIFIED 9879
41
44
  PORT REPLAY_CMD_ROUTER 9880
42
45
  PORT DART_STREAM 10777
43
46
  PORT DART_DECOM 10779
47
+ PORT DART_MASTER 10780
44
48
 
45
49
  # Default Packet Log Writer and Reader
46
50
  DEFAULT_PACKET_LOG_WRITER packet_log_writer.rb
@@ -67,3 +71,10 @@ ENABLE_SOUND
67
71
  META_INIT config/data/meta_init.txt
68
72
 
69
73
  ADD_HASH_FILE lib/user_version.rb
74
+
75
+ # ALLOW_ROUTER_COMMANDING # Enable this to chain servers with commanding
76
+ # ALLOW_HOST localhost:7777 # This is provided by default. Add with HostIP:7777 for chaining
77
+ # ALLOW_ORIGIN 1.2.3.4:8080 # Add this if you have a webserver that should be able to access the COSMOS API
78
+
79
+ # *** IMPORTANT *** Change this value to a unique value for each project
80
+ X_CSRF_TOKEN SuperSecret # Secret used to secure requests - Change for each project
@@ -26,7 +26,7 @@ COMMAND INST SETPARAMS BIG_ENDIAN "Sets numbered parameters"
26
26
 
27
27
  # New more flexible ERB syntax:
28
28
  <% (1..5).each do |i| %>
29
- APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 0 "Value <%= i %> setting"
29
+ APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting"
30
30
  <% end %>
31
31
 
32
32
  SELECT_PARAMETER VALUE5
@@ -34,12 +34,12 @@ COMMAND INST SETPARAMS BIG_ENDIAN "Sets numbered parameters"
34
34
 
35
35
  COMMAND INST ASCIICMD BIG_ENDIAN "Enumerated ASCII command"
36
36
  <%= render "_ccsds_cmd.txt", locals: {id: 5} %>
37
- PARAMETER STRING 64 2048 STRING "NOOP" "Enumerated string parameter"
37
+ APPEND_PARAMETER STRING 2048 STRING "NOOP" "Enumerated string parameter"
38
38
  STATE "NOOP" "NOOP"
39
- STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard."
39
+ STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard so anyone without laser safety training needs to leave."
40
40
  STATE "FIRE LASER" "FIRE LASER" HAZARDOUS "WARNING Laser will be fired!"
41
41
  APPEND_PARAMETER BINARY 32 STRING 0xDEADBEEF "Binary string"
42
- APPEND_PARAMETER STRING 80 STRING "0xDEADBEEF" "ASCII string"
42
+ APPEND_PARAMETER ASCII 80 STRING "0xDEADBEEF" "ASCII string"
43
43
 
44
44
  COMMAND INST FLTCMD BIG_ENDIAN "Command with float parameters"
45
45
  <%= render "_ccsds_cmd.txt", locals: {id: 6} %>
@@ -139,7 +139,10 @@ TELEMETRY INST PARAMS BIG_ENDIAN "Params set by SETPARAMS command"
139
139
 
140
140
  TELEMETRY INST IMAGE BIG_ENDIAN "Packet with image data"
141
141
  <%= render "_ccsds_tlm.txt", locals: {apid: 4} %>
142
+ ITEM BYTES 128 32 UINT "First bytes"
143
+ FORMAT_STRING '0x%08x'
142
144
  ITEM IMAGE 128 131072 BLOCK "10x10 Image Data"
145
+ OVERLAP # Notify COSMOS that this is intentionally overlapping the BYTES field
143
146
  ITEM TIMESECONDS 0 0 DERIVED "Derived floating-point time since epoch in seconds"
144
147
  READ_CONVERSION unix_time_seconds_conversion.rb TIMESEC TIMEUS
145
148
  FORMAT_STRING '%0.6f'
@@ -148,6 +151,7 @@ TELEMETRY INST IMAGE BIG_ENDIAN "Packet with image data"
148
151
 
149
152
  TELEMETRY INST MECH BIG_ENDIAN "Mechanism status"
150
153
  <%= render "_ccsds_tlm.txt", locals: {apid: 5} %>
154
+ APPEND_ITEM EXTRA 32 FLOAT "Extra item to be deleted"
151
155
  APPEND_ITEM SLRPNL1 32 FLOAT "Solar panel 1 angle"
152
156
  UNITS DEGREES DEG
153
157
  APPEND_ITEM SLRPNL2 32 FLOAT "Solar panel 2 angle"
@@ -0,0 +1,12 @@
1
+ # NOTE: Telemetry definitions are processed in alphabetical order by default.
2
+ # However, this can be overridden by explicitly calling them out in target.txt.
3
+ # Thus it's recommended to create a file like this with an extension
4
+ # such as inst_tlm_override.txt which will be processed AFTER inst_tlm.txt.
5
+
6
+ # Existing telemetry packets can be selected and items modified
7
+ SELECT_TELEMETRY INST MECH
8
+ # Existing items can be selected and modified by adding conversions, limits, etc
9
+ SELECT_ITEM SLRPNL1
10
+ LIMITS DEFAULT 1 ENABLED -180.0 -170.0 170.0 180.0
11
+ # Delete an item so it doesn't appear in the packet
12
+ DELETE_ITEM EXTRA
@@ -304,8 +304,8 @@ module Cosmos
304
304
  # Create an Array the size of the packet and then initialize
305
305
  # using a sample of all possible hex values (0..15)
306
306
  # finally pack it into binary using the Character 'C' specifier
307
- data = Array.new(packet.length) { Array(0..15).sample }.pack("C*")
308
- packet.buffer = data
307
+ data = Array.new(packet.image.length) { Array(0..15).sample }.pack("C*")
308
+ packet.image = data
309
309
  packet.ccsdsseqcnt += 1
310
310
 
311
311
  when 'MECH'
@@ -32,6 +32,7 @@ IGNORE_ITEM RECEIVED_TIMEFORMATTED
32
32
  # alphabetical order
33
33
  COMMANDS inst_cmds.txt
34
34
  TELEMETRY inst_tlm.txt
35
+ TELEMETRY inst_tlm_override.txt
35
36
 
36
37
  # Automatically substitute the target name in screen definitions
37
38
  AUTO_SCREEN_SUBSTITUTE
@@ -1,59 +1,59 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xsl:stylesheet version="1.0"
3
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
- xmlns:outline="http://code.google.com/p/wkhtmltopdf/outline"
5
- xmlns="http://www.w3.org/1999/xhtml">
6
- <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
7
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
8
- indent="yes" />
9
- <xsl:template match="outline:outline">
10
- <html>
11
- <head>
12
- <title>Table of Contents</title>
13
- <style>
14
- h1 {
15
- text-align: center;
16
- font-size: 20px;
17
- font-family: arial;
18
- }
19
- div {border-bottom: 1px dashed rgb(200,200,200);}
20
- span {float: right;}
21
- li {list-style: none;}
22
- ul {
23
- font-size: 20px;
24
- font-family: arial;
25
- }
26
- ul ul {font-size: 80%; }
27
- ul {padding-left: 0em;}
28
- ul ul {padding-left: 1em;}
29
- a {text-decoration:none; color: black;}
30
- </style>
31
- </head>
32
- <body>
33
- <h1>Table of Contents</h1>
34
- <ul><xsl:apply-templates select="outline:item/outline:item"/></ul>
35
- </body>
36
- </html>
37
- </xsl:template>
38
- <xsl:template match="outline:item">
39
- <li>
40
- <xsl:if test="@title!=''">
41
- <div>
42
- <a>
43
- <xsl:if test="@link">
44
- <xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute>
45
- </xsl:if>
46
- <xsl:if test="@backLink">
47
- <xsl:attribute name="name"><xsl:value-of select="@backLink"/></xsl:attribute>
48
- </xsl:if>
49
- <xsl:value-of select="@title" />
50
- </a>
51
- <span> <xsl:value-of select="@page" /> </span>
52
- </div>
53
- </xsl:if>
54
- <ul>
55
- <xsl:apply-templates select="outline:item"/>
56
- </ul>
57
- </li>
58
- </xsl:template>
59
- </xsl:stylesheet>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version="2.0"
3
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
+ xmlns:outline="http://code.google.com/p/wkhtmltopdf/outline"
5
+ xmlns="http://www.w3.org/1999/xhtml">
6
+ <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
7
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
8
+ indent="yes" />
9
+ <xsl:template match="outline:outline">
10
+ <html>
11
+ <head>
12
+ <title>Table of Contents</title>
13
+ <style>
14
+ h1 {
15
+ text-align: center;
16
+ font-size: 20px;
17
+ font-family: arial;
18
+ }
19
+ div {border-bottom: 1px dashed rgb(200,200,200);}
20
+ span {float: right;}
21
+ li {list-style: none;}
22
+ ul {
23
+ font-size: 20px;
24
+ font-family: arial;
25
+ }
26
+ ul ul {font-size: 80%; }
27
+ ul {padding-left: 0em;}
28
+ ul ul {padding-left: 1em;}
29
+ a {text-decoration:none; color: black;}
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <h1>Table of Contents</h1>
34
+ <ul><xsl:apply-templates select="outline:item/outline:item"/></ul>
35
+ </body>
36
+ </html>
37
+ </xsl:template>
38
+ <xsl:template match="outline:item">
39
+ <li>
40
+ <xsl:if test="@title!=''">
41
+ <div>
42
+ <a>
43
+ <xsl:if test="@link">
44
+ <xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute>
45
+ </xsl:if>
46
+ <xsl:if test="@backLink">
47
+ <xsl:attribute name="name"><xsl:value-of select="@backLink"/></xsl:attribute>
48
+ </xsl:if>
49
+ <xsl:value-of select="@title" />
50
+ </a>
51
+ <span> <xsl:value-of select="@page" /> </span>
52
+ </div>
53
+ </xsl:if>
54
+ <ul>
55
+ <xsl:apply-templates select="outline:item"/>
56
+ </ul>
57
+ </li>
58
+ </xsl:template>
59
+ </xsl:stylesheet>
@@ -184,14 +184,14 @@ get_cmd_param_list("INST", "BOB")
184
184
  get_cmd_param_list("INST", "COLLECT", "DURATION")
185
185
 
186
186
  # get_cmd_hazardous
187
- hazardous, hazardous_description = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "SPECIAL")
188
- puts "#{hazardous}:#{hazardous_description}"
189
- hazardous, hazardous_description = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "NORMAL")
190
- puts "#{hazardous}:#{hazardous_description}"
191
- hazardous, hazardous_description = get_cmd_hazardous("INST", "ABORT")
192
- puts "#{hazardous}:#{hazardous_description}"
193
- hazardous, hazardous_description = get_cmd_hazardous("INST", "CLEAR")
194
- puts "#{hazardous}:#{hazardous_description}"
187
+ hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "SPECIAL")
188
+ puts hazardous
189
+ hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "NORMAL")
190
+ puts hazardous
191
+ hazardous = get_cmd_hazardous("INST", "ABORT")
192
+ puts hazardous
193
+ hazardous = get_cmd_hazardous("INST", "CLEAR")
194
+ puts hazardous
195
195
 
196
196
  # get_cmd_hazardous should fail
197
197
  get_cmd_hazardous()
@@ -56,7 +56,7 @@ static VALUE buffered_file_read(VALUE self, VALUE arg_length) {
56
56
  rb_funcall(buffer, id_method_slice_bang, 1, rb_range_new(INT2FIX(0), INT2FIX(buffer_index - 1), Qfalse));
57
57
  buffer_length = RSTRING_LEN(buffer);
58
58
  buffer_index = 0;
59
- rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(0));
59
+ rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(buffer_index));
60
60
  }
61
61
  super_arg = INT2FIX(length - buffer_length);
62
62
  rb_str_append(buffer, rb_funcall(rb_call_super(1, (VALUE*) &super_arg), id_method_to_s, 0));
@@ -70,7 +70,7 @@ static VALUE buffered_file_read(VALUE self, VALUE arg_length) {
70
70
  rb_funcall(buffer, id_method_slice_bang, 1, rb_range_new(INT2FIX(0), INT2FIX(buffer_index - 1), Qfalse));
71
71
  buffer_length = RSTRING_LEN(buffer);
72
72
  buffer_index = 0;
73
- rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(0));
73
+ rb_ivar_set(self, id_ivar_buffer_index, INT2FIX(buffer_index));
74
74
  }
75
75
  super_arg = INT2FIX(BUFFER_SIZE - buffer_length);
76
76
  rb_str_append(buffer, rb_funcall(rb_call_super(1, (VALUE*) &super_arg), id_method_to_s, 0));
@@ -74,7 +74,6 @@ static VALUE parse_loop(VALUE self, VALUE io, VALUE yield_non_keyword_lines, VAL
74
74
  int result = 0;
75
75
  long length = 0;
76
76
  int index = 0;
77
- double float_pos = 0.0;
78
77
  double float_size = NUM2DBL(size);
79
78
  volatile VALUE progress_callback = rb_cvar_get(cConfigParser, id_cvar_progress_callback);
80
79
  volatile VALUE line = Qnil;
@@ -98,7 +97,7 @@ static VALUE parse_loop(VALUE self, VALUE io, VALUE yield_non_keyword_lines, VAL
98
97
 
99
98
  if (RTEST(progress_callback) && ((line_number % 10) == 0)) {
100
99
  if (float_size > 0.0) {
101
- float_pos = NUM2DBL(rb_funcall(io, id_method_pos, 0));
100
+ double float_pos = NUM2DBL(rb_funcall(io, id_method_pos, 0));
102
101
  rb_funcall(progress_callback, id_method_call, 1, rb_float_new(float_pos / float_size));
103
102
  }
104
103
  }
@@ -95,8 +95,6 @@ static VALUE line_clip_internal(double x0, double y0, double x1, double y1, doub
95
95
  volatile VALUE done = Qfalse;
96
96
  volatile VALUE clipped0 = Qfalse;
97
97
  volatile VALUE clipped1 = Qfalse;
98
- double x = 0.0;
99
- double y = 0.0;
100
98
 
101
99
  code0 = cal_code(x0, y0, xmin, ymin, xmax, ymax);
102
100
  code1 = cal_code(x1, y1, xmin, ymin, xmax, ymax);
@@ -117,8 +115,8 @@ static VALUE line_clip_internal(double x0, double y0, double x1, double y1, doub
117
115
  } else {
118
116
  /* Part of the line is inside the viewable area. Figure out which part
119
117
  * of the line can be drawn. */
120
- x = 0.0;
121
- y = 0.0;
118
+ double x;
119
+ double y;
122
120
 
123
121
  if (code0 != 0) {
124
122
  codeout = code0;
@@ -178,28 +176,19 @@ static VALUE line_clip(VALUE self, VALUE x0, VALUE y0, VALUE x1, VALUE y1, VALUE
178
176
  volatile VALUE result_clipped0 = Qnil;
179
177
  volatile VALUE result_clipped1 = Qnil;
180
178
  volatile VALUE return_value = Qnil;
181
- double double_x0 = 0.0;
182
- double double_y0 = 0.0;
183
- double double_x1 = 0.0;
184
- double double_y1 = 0.0;
185
- double double_xmin = 0.0;
186
- double double_ymin = 0.0;
187
- double double_xmax = 0.0;
188
- double double_ymax = 0.0;
179
+ double double_x0 = RFLOAT_VALUE(rb_funcall(x0, id_method_to_f, 0));
180
+ double double_y0 = RFLOAT_VALUE(rb_funcall(y0, id_method_to_f, 0));
181
+ double double_x1 = RFLOAT_VALUE(rb_funcall(x1, id_method_to_f, 0));
182
+ double double_y1 = RFLOAT_VALUE(rb_funcall(y1, id_method_to_f, 0));
183
+ double double_xmin = RFLOAT_VALUE(rb_funcall(xmin, id_method_to_f, 0));
184
+ double double_ymin = RFLOAT_VALUE(rb_funcall(ymin, id_method_to_f, 0));
185
+ double double_xmax = RFLOAT_VALUE(rb_funcall(xmax, id_method_to_f, 0));
186
+ double double_ymax = RFLOAT_VALUE(rb_funcall(ymax, id_method_to_f, 0));
189
187
  double result_x0 = 0.0;
190
188
  double result_y0 = 0.0;
191
189
  double result_x1 = 0.0;
192
190
  double result_y1 = 0.0;
193
191
 
194
- double_x0 = RFLOAT_VALUE(rb_funcall(x0, id_method_to_f, 0));
195
- double_y0 = RFLOAT_VALUE(rb_funcall(y0, id_method_to_f, 0));
196
- double_x1 = RFLOAT_VALUE(rb_funcall(x1, id_method_to_f, 0));
197
- double_y1 = RFLOAT_VALUE(rb_funcall(y1, id_method_to_f, 0));
198
- double_xmin = RFLOAT_VALUE(rb_funcall(xmin, id_method_to_f, 0));
199
- double_ymin = RFLOAT_VALUE(rb_funcall(ymin, id_method_to_f, 0));
200
- double_xmax = RFLOAT_VALUE(rb_funcall(xmax, id_method_to_f, 0));
201
- double_ymax = RFLOAT_VALUE(rb_funcall(ymax, id_method_to_f, 0));
202
-
203
192
  result = line_clip_internal(double_x0, double_y0, double_x1, double_y1, double_xmin, double_ymin, double_xmax, double_ymax, &result_x0, &result_y0, &result_x1, &result_y1, &result_clipped0, &result_clipped1);
204
193
 
205
194
  if (result == Qtrue)
@@ -236,10 +225,8 @@ static long scale_value_to_graph_y_internal (double y, double y_max, double y_sc
236
225
  static VALUE scale_value_to_graph_y(int argc, VALUE* argv, VALUE self) {
237
226
  volatile VALUE y = Qnil;
238
227
  ID id_axis = 0;
239
- long long_graph_top_y = 0;
240
- double double_y = 0.0;
241
- double double_y_max = 0.0;
242
- double double_y_scale = 0.0;
228
+ double double_y_max;
229
+ double double_y_scale;
243
230
 
244
231
  switch (argc) {
245
232
  case 1:
@@ -256,8 +243,8 @@ static VALUE scale_value_to_graph_y(int argc, VALUE* argv, VALUE self) {
256
243
  break;
257
244
  };
258
245
 
259
- long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
260
- double_y = RFLOAT_VALUE(rb_funcall(y, id_method_to_f, 0));
246
+ long long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
247
+ double double_y = RFLOAT_VALUE(rb_funcall(y, id_method_to_f, 0));
261
248
 
262
249
  if (id_axis == id_LEFT) {
263
250
  double_y_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_left_y_max), id_method_to_f, 0));
@@ -281,15 +268,10 @@ static long scale_value_to_graph_x_internal (double x, double x_min, double x_sc
281
268
  * This function converts an x value to an x coordinate on the graph
282
269
  */
283
270
  static VALUE scale_value_to_graph_x(VALUE self, VALUE x) {
284
- long long_graph_left_x = 0;
285
- double double_x = 0.0;
286
- double double_x_min = 0.0;
287
- double double_x_scale = 0.0;
288
-
289
- long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
290
- double_x = RFLOAT_VALUE(rb_funcall(x, id_method_to_f, 0));
291
- double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
292
- double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
271
+ long long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
272
+ double double_x = RFLOAT_VALUE(rb_funcall(x, id_method_to_f, 0));
273
+ double double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
274
+ double double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
293
275
 
294
276
  return INT2FIX(scale_value_to_graph_x_internal(double_x, double_x_min, double_x_scale, long_graph_left_x));
295
277
  }
@@ -301,10 +283,6 @@ static void draw_line_internal(VALUE dc, double x1, double y1, double x2, double
301
283
  volatile VALUE result = Qnil;
302
284
  volatile VALUE clipped1 = Qnil;
303
285
  volatile VALUE clipped2 = Qnil;
304
- long x1_scaled = 0;
305
- long y1_scaled = 0;
306
- long x2_scaled = 0;
307
- long y2_scaled = 0;
308
286
  double clipped_x1 = 0.0;
309
287
  double clipped_y1 = 0.0;
310
288
  double clipped_x2 = 0.0;
@@ -315,10 +293,10 @@ static void draw_line_internal(VALUE dc, double x1, double y1, double x2, double
315
293
 
316
294
  if (result == Qtrue) /* Line is visible so draw it */ {
317
295
  /* Scale to graph coordinates */
318
- x1_scaled = scale_value_to_graph_x_internal(clipped_x1, x_min, x_scale, graph_left_x);
319
- y1_scaled = scale_value_to_graph_y_internal(clipped_y1, y_max, y_scale, graph_top_y);
320
- x2_scaled = scale_value_to_graph_x_internal(clipped_x2, x_min, x_scale, graph_left_x);
321
- y2_scaled = scale_value_to_graph_y_internal(clipped_y2, y_max, y_scale, graph_top_y);
296
+ double x1_scaled = scale_value_to_graph_x_internal(clipped_x1, x_min, x_scale, graph_left_x);
297
+ double y1_scaled = scale_value_to_graph_y_internal(clipped_y1, y_max, y_scale, graph_top_y);
298
+ double x2_scaled = scale_value_to_graph_x_internal(clipped_x2, x_min, x_scale, graph_left_x);
299
+ double y2_scaled = scale_value_to_graph_y_internal(clipped_y2, y_max, y_scale, graph_top_y);
322
300
 
323
301
  /* Draw the line */
324
302
  if (RTEST(show_line)) {
@@ -339,30 +317,20 @@ static void draw_line_internal(VALUE dc, double x1, double y1, double x2, double
339
317
  * Draws a line between two points that is clipped to fit the visible graph if necessary
340
318
  */
341
319
  static VALUE draw_line(VALUE self, VALUE dc, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE show_line, VALUE point_size, VALUE axis, VALUE color) {
342
- long long_graph_left_x = 0;
343
- long long_graph_top_y = 0;
344
- ID id_axis = 0;
345
- double double_x1 = 0.0;
346
- double double_y1 = 0.0;
347
- double double_x2 = 0.0;
348
- double double_y2 = 0.0;
349
- double double_x_min = 0.0;
350
- double double_y_min = 0.0;
351
- double double_x_max = 0.0;
352
- double double_y_max = 0.0;
353
- double double_x_scale = 0.0;
354
- double double_y_scale = 0.0;
355
-
356
- id_axis = SYM2ID(axis);
357
- double_x_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_max), id_method_to_f, 0));
358
- double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
359
- double_x1 = RFLOAT_VALUE(rb_funcall(x1, id_method_to_f, 0));
360
- double_y1 = RFLOAT_VALUE(rb_funcall(y1, id_method_to_f, 0));
361
- double_x2 = RFLOAT_VALUE(rb_funcall(x2, id_method_to_f, 0));
362
- double_y2 = RFLOAT_VALUE(rb_funcall(y2, id_method_to_f, 0));
363
- double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
364
- long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
365
- long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
320
+ double double_y_min;
321
+ double double_y_max;
322
+ double double_y_scale;
323
+
324
+ ID id_axis = SYM2ID(axis);
325
+ double double_x_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_max), id_method_to_f, 0));
326
+ double double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
327
+ double double_x1 = RFLOAT_VALUE(rb_funcall(x1, id_method_to_f, 0));
328
+ double double_y1 = RFLOAT_VALUE(rb_funcall(y1, id_method_to_f, 0));
329
+ double double_x2 = RFLOAT_VALUE(rb_funcall(x2, id_method_to_f, 0));
330
+ double double_y2 = RFLOAT_VALUE(rb_funcall(y2, id_method_to_f, 0));
331
+ double double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
332
+ long long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
333
+ long long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
366
334
 
367
335
  if (id_axis == id_LEFT) {
368
336
  double_y_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_left_y_max), id_method_to_f, 0));
@@ -383,37 +351,28 @@ static VALUE draw_line(VALUE self, VALUE dc, VALUE x1, VALUE y1, VALUE x2, VALUE
383
351
  * Draws all lines for the given axis
384
352
  */
385
353
  static VALUE draw_lines (VALUE self, VALUE dc, VALUE axis) {
386
- long long_graph_left_x = 0;
387
- long long_graph_top_y = 0;
388
- long num_lines = 0;
389
354
  long line_index = 0;
390
355
  long line_length = 0;
391
356
  long point_index = 0;
392
- ID id_axis = 0;
393
357
  volatile VALUE lines = Qnil;
394
358
  volatile VALUE line = Qnil;
395
359
  volatile VALUE x_values = Qnil;
396
360
  volatile VALUE y_values = Qnil;
397
361
  volatile VALUE color = Qnil;
398
- volatile VALUE show_lines = Qnil;
399
- volatile VALUE point_size = Qnil;
400
- double double_x1 = 0.0;
401
- double double_y1 = 0.0;
402
- double double_x2 = 0.0;
403
- double double_y2 = 0.0;
404
- double double_x_min = 0.0;
405
- double double_y_min = 0.0;
406
- double double_x_max = 0.0;
407
- double double_y_max = 0.0;
408
- double double_x_scale = 0.0;
409
- double double_y_scale = 0.0;
410
-
411
- id_axis = SYM2ID(axis);
412
- double_x_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_max), id_method_to_f, 0));
413
- double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
414
- double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
415
- long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
416
- long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
362
+ double double_x1;
363
+ double double_y1;
364
+ double double_x2;
365
+ double double_y2;
366
+ double double_y_min;
367
+ double double_y_max;
368
+ double double_y_scale;
369
+
370
+ ID id_axis = SYM2ID(axis);
371
+ double double_x_max = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_max), id_method_to_f, 0));
372
+ double double_x_min = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_min), id_method_to_f, 0));
373
+ double double_x_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_x_scale), id_method_to_f, 0));
374
+ long long_graph_left_x = FIX2INT(rb_ivar_get(self, id_ivar_graph_left_x));
375
+ long long_graph_top_y = FIX2INT(rb_ivar_get(self, id_ivar_graph_top_y));
417
376
 
418
377
  if (id_axis == id_LEFT) {
419
378
  lines = rb_funcall(rb_ivar_get(self, id_ivar_lines), id_method_left, 0);
@@ -427,10 +386,10 @@ static VALUE draw_lines (VALUE self, VALUE dc, VALUE axis) {
427
386
  double_y_scale = RFLOAT_VALUE(rb_funcall(rb_ivar_get(self, id_ivar_right_y_scale), id_method_to_f, 0));
428
387
  }
429
388
 
430
- show_lines = rb_ivar_get(self, id_ivar_show_lines);
431
- point_size = rb_ivar_get(self, id_ivar_point_size);
389
+ volatile VALUE show_lines = rb_ivar_get(self, id_ivar_show_lines);
390
+ volatile VALUE point_size = rb_ivar_get(self, id_ivar_point_size);
432
391
 
433
- num_lines = RARRAY_LEN(lines);
392
+ long num_lines = RARRAY_LEN(lines);
434
393
  for (line_index = 0; line_index < num_lines; line_index++) {
435
394
  line = rb_ary_entry(lines, line_index);
436
395
  x_values = rb_ary_entry(line, 0);