From db5a59f735a52733eabfea3c67596ffe6804a2c3 Mon Sep 17 00:00:00 2001 From: Torsten Date: Mon, 2 Mar 2020 17:58:13 +0200 Subject: [PATCH] Unify instruction namings also dirs Was getting confused myself, where it was instruction or instructions, when if the base class was inside or out of dir. Now dirs are plural, and base class is inside. --- lib/risc.rb | 2 +- lib/risc/{ => instructions}/instruction.rb | 32 +++++++++---------- .../argument_transfer.rb | 0 .../block_yield.rb | 0 .../{instruction => instructions}/check.rb | 0 .../dynamic_call.rb | 0 .../{ => instructions}/instruction.rb | 31 +++++++++--------- .../{instruction => instructions}/jump.rb | 0 .../{instruction => instructions}/label.rb | 0 .../message_setup.rb | 0 .../not_same_check.rb | 0 .../resolve_method.rb | 0 .../return_jump.rb | 0 .../return_sequence.rb | 0 .../same_check.rb | 0 .../simple_call.rb | 0 .../slot_load.rb | 0 .../truth_check.rb | 0 lib/slot_machine/slot_machine.rb | 3 +- .../{ => instructions}/test_instructions.rb | 0 .../{instruction => instructions}/helper.rb | 0 .../test_argument_transfer.rb | 0 .../test_block_yield.rb | 0 .../test_dynamic_call.rb | 0 .../test_jump.rb | 0 .../test_message_setup.rb | 0 .../test_not_same_check.rb | 0 .../test_resolve_method.rb | 0 .../test_return_jump.rb | 0 .../test_return_sequence.rb | 0 .../test_simple_call.rb | 0 .../test_slot_load.rb | 0 .../test_slot_load1.rb | 0 .../test_slot_load2.rb | 0 .../test_slot_load3.rb | 0 .../test_truth_check.rb | 0 36 files changed, 34 insertions(+), 34 deletions(-) rename lib/risc/{ => instructions}/instruction.rb (73%) rename lib/slot_machine/{instruction => instructions}/argument_transfer.rb (100%) rename lib/slot_machine/{instruction => instructions}/block_yield.rb (100%) rename lib/slot_machine/{instruction => instructions}/check.rb (100%) rename lib/slot_machine/{instruction => instructions}/dynamic_call.rb (100%) rename lib/slot_machine/{ => instructions}/instruction.rb (67%) rename lib/slot_machine/{instruction => instructions}/jump.rb (100%) rename lib/slot_machine/{instruction => instructions}/label.rb (100%) rename lib/slot_machine/{instruction => instructions}/message_setup.rb (100%) rename lib/slot_machine/{instruction => instructions}/not_same_check.rb (100%) rename lib/slot_machine/{instruction => instructions}/resolve_method.rb (100%) rename lib/slot_machine/{instruction => instructions}/return_jump.rb (100%) rename lib/slot_machine/{instruction => instructions}/return_sequence.rb (100%) rename lib/slot_machine/{instruction => instructions}/same_check.rb (100%) rename lib/slot_machine/{instruction => instructions}/simple_call.rb (100%) rename lib/slot_machine/{instruction => instructions}/slot_load.rb (100%) rename lib/slot_machine/{instruction => instructions}/truth_check.rb (100%) rename test/risc/{ => instructions}/test_instructions.rb (100%) rename test/slot_machine/{instruction => instructions}/helper.rb (100%) rename test/slot_machine/{instruction => instructions}/test_argument_transfer.rb (100%) rename test/slot_machine/{instruction => instructions}/test_block_yield.rb (100%) rename test/slot_machine/{instruction => instructions}/test_dynamic_call.rb (100%) rename test/slot_machine/{instruction => instructions}/test_jump.rb (100%) rename test/slot_machine/{instruction => instructions}/test_message_setup.rb (100%) rename test/slot_machine/{instruction => instructions}/test_not_same_check.rb (100%) rename test/slot_machine/{instruction => instructions}/test_resolve_method.rb (100%) rename test/slot_machine/{instruction => instructions}/test_return_jump.rb (100%) rename test/slot_machine/{instruction => instructions}/test_return_sequence.rb (100%) rename test/slot_machine/{instruction => instructions}/test_simple_call.rb (100%) rename test/slot_machine/{instruction => instructions}/test_slot_load.rb (100%) rename test/slot_machine/{instruction => instructions}/test_slot_load1.rb (100%) rename test/slot_machine/{instruction => instructions}/test_slot_load2.rb (100%) rename test/slot_machine/{instruction => instructions}/test_slot_load3.rb (100%) rename test/slot_machine/{instruction => instructions}/test_truth_check.rb (100%) diff --git a/lib/risc.rb b/lib/risc.rb index 64e39b92..257a5532 100644 --- a/lib/risc.rb +++ b/lib/risc.rb @@ -39,7 +39,7 @@ class Integer end -require_relative "risc/instruction" +require_relative "risc/instructions/instruction" require_relative "risc/register_value" require_relative "risc/register_slot" require_relative "risc/text_writer" diff --git a/lib/risc/instruction.rb b/lib/risc/instructions/instruction.rb similarity index 73% rename from lib/risc/instruction.rb rename to lib/risc/instructions/instruction.rb index ce232ec1..6eb3e128 100644 --- a/lib/risc/instruction.rb +++ b/lib/risc/instructions/instruction.rb @@ -57,19 +57,19 @@ module Risc end -require_relative "instructions/setter" -require_relative "instructions/getter" -require_relative "instructions/reg_to_slot" -require_relative "instructions/slot_to_reg" -require_relative "instructions/reg_to_byte" -require_relative "instructions/byte_to_reg" -require_relative "instructions/load_constant" -require_relative "instructions/load_data" -require_relative "instructions/syscall" -require_relative "instructions/function_call" -require_relative "instructions/function_return" -require_relative "instructions/transfer" -require_relative "instructions/label" -require_relative "instructions/branch" -require_relative "instructions/dynamic_jump" -require_relative "instructions/operator_instruction" +require_relative "setter" +require_relative "getter" +require_relative "reg_to_slot" +require_relative "slot_to_reg" +require_relative "reg_to_byte" +require_relative "byte_to_reg" +require_relative "load_constant" +require_relative "load_data" +require_relative "syscall" +require_relative "function_call" +require_relative "function_return" +require_relative "transfer" +require_relative "label" +require_relative "branch" +require_relative "dynamic_jump" +require_relative "operator_instruction" diff --git a/lib/slot_machine/instruction/argument_transfer.rb b/lib/slot_machine/instructions/argument_transfer.rb similarity index 100% rename from lib/slot_machine/instruction/argument_transfer.rb rename to lib/slot_machine/instructions/argument_transfer.rb diff --git a/lib/slot_machine/instruction/block_yield.rb b/lib/slot_machine/instructions/block_yield.rb similarity index 100% rename from lib/slot_machine/instruction/block_yield.rb rename to lib/slot_machine/instructions/block_yield.rb diff --git a/lib/slot_machine/instruction/check.rb b/lib/slot_machine/instructions/check.rb similarity index 100% rename from lib/slot_machine/instruction/check.rb rename to lib/slot_machine/instructions/check.rb diff --git a/lib/slot_machine/instruction/dynamic_call.rb b/lib/slot_machine/instructions/dynamic_call.rb similarity index 100% rename from lib/slot_machine/instruction/dynamic_call.rb rename to lib/slot_machine/instructions/dynamic_call.rb diff --git a/lib/slot_machine/instruction.rb b/lib/slot_machine/instructions/instruction.rb similarity index 67% rename from lib/slot_machine/instruction.rb rename to lib/slot_machine/instructions/instruction.rb index eadfe5fd..48548313 100644 --- a/lib/slot_machine/instruction.rb +++ b/lib/slot_machine/instructions/instruction.rb @@ -38,19 +38,18 @@ module SlotMachine end -require_relative "basic_values" -require_relative "instruction/label" -require_relative "instruction/check" -require_relative "instruction/simple_call" -require_relative "instruction/dynamic_call" -require_relative "instruction/block_yield" -require_relative "instruction/resolve_method" -require_relative "instruction/truth_check" -require_relative "instruction/not_same_check" -require_relative "instruction/same_check" -require_relative "instruction/jump" -require_relative "instruction/return_jump" -require_relative "instruction/slot_load" -require_relative "instruction/return_sequence" -require_relative "instruction/message_setup" -require_relative "instruction/argument_transfer" +require_relative "label" +require_relative "check" +require_relative "simple_call" +require_relative "dynamic_call" +require_relative "block_yield" +require_relative "resolve_method" +require_relative "truth_check" +require_relative "not_same_check" +require_relative "same_check" +require_relative "jump" +require_relative "return_jump" +require_relative "slot_load" +require_relative "return_sequence" +require_relative "message_setup" +require_relative "argument_transfer" diff --git a/lib/slot_machine/instruction/jump.rb b/lib/slot_machine/instructions/jump.rb similarity index 100% rename from lib/slot_machine/instruction/jump.rb rename to lib/slot_machine/instructions/jump.rb diff --git a/lib/slot_machine/instruction/label.rb b/lib/slot_machine/instructions/label.rb similarity index 100% rename from lib/slot_machine/instruction/label.rb rename to lib/slot_machine/instructions/label.rb diff --git a/lib/slot_machine/instruction/message_setup.rb b/lib/slot_machine/instructions/message_setup.rb similarity index 100% rename from lib/slot_machine/instruction/message_setup.rb rename to lib/slot_machine/instructions/message_setup.rb diff --git a/lib/slot_machine/instruction/not_same_check.rb b/lib/slot_machine/instructions/not_same_check.rb similarity index 100% rename from lib/slot_machine/instruction/not_same_check.rb rename to lib/slot_machine/instructions/not_same_check.rb diff --git a/lib/slot_machine/instruction/resolve_method.rb b/lib/slot_machine/instructions/resolve_method.rb similarity index 100% rename from lib/slot_machine/instruction/resolve_method.rb rename to lib/slot_machine/instructions/resolve_method.rb diff --git a/lib/slot_machine/instruction/return_jump.rb b/lib/slot_machine/instructions/return_jump.rb similarity index 100% rename from lib/slot_machine/instruction/return_jump.rb rename to lib/slot_machine/instructions/return_jump.rb diff --git a/lib/slot_machine/instruction/return_sequence.rb b/lib/slot_machine/instructions/return_sequence.rb similarity index 100% rename from lib/slot_machine/instruction/return_sequence.rb rename to lib/slot_machine/instructions/return_sequence.rb diff --git a/lib/slot_machine/instruction/same_check.rb b/lib/slot_machine/instructions/same_check.rb similarity index 100% rename from lib/slot_machine/instruction/same_check.rb rename to lib/slot_machine/instructions/same_check.rb diff --git a/lib/slot_machine/instruction/simple_call.rb b/lib/slot_machine/instructions/simple_call.rb similarity index 100% rename from lib/slot_machine/instruction/simple_call.rb rename to lib/slot_machine/instructions/simple_call.rb diff --git a/lib/slot_machine/instruction/slot_load.rb b/lib/slot_machine/instructions/slot_load.rb similarity index 100% rename from lib/slot_machine/instruction/slot_load.rb rename to lib/slot_machine/instructions/slot_load.rb diff --git a/lib/slot_machine/instruction/truth_check.rb b/lib/slot_machine/instructions/truth_check.rb similarity index 100% rename from lib/slot_machine/instruction/truth_check.rb rename to lib/slot_machine/instructions/truth_check.rb diff --git a/lib/slot_machine/slot_machine.rb b/lib/slot_machine/slot_machine.rb index 46a23a8b..59bedd68 100644 --- a/lib/slot_machine/slot_machine.rb +++ b/lib/slot_machine/slot_machine.rb @@ -17,7 +17,8 @@ require_relative "slot" require_relative "slotted_message" require_relative "slotted_constant" require_relative "slotted_object" -require_relative "instruction" +require_relative "basic_values" +require_relative "instructions/instruction" require_relative "slot_collection" require_relative "callable_compiler" require_relative "method_compiler" diff --git a/test/risc/test_instructions.rb b/test/risc/instructions/test_instructions.rb similarity index 100% rename from test/risc/test_instructions.rb rename to test/risc/instructions/test_instructions.rb diff --git a/test/slot_machine/instruction/helper.rb b/test/slot_machine/instructions/helper.rb similarity index 100% rename from test/slot_machine/instruction/helper.rb rename to test/slot_machine/instructions/helper.rb diff --git a/test/slot_machine/instruction/test_argument_transfer.rb b/test/slot_machine/instructions/test_argument_transfer.rb similarity index 100% rename from test/slot_machine/instruction/test_argument_transfer.rb rename to test/slot_machine/instructions/test_argument_transfer.rb diff --git a/test/slot_machine/instruction/test_block_yield.rb b/test/slot_machine/instructions/test_block_yield.rb similarity index 100% rename from test/slot_machine/instruction/test_block_yield.rb rename to test/slot_machine/instructions/test_block_yield.rb diff --git a/test/slot_machine/instruction/test_dynamic_call.rb b/test/slot_machine/instructions/test_dynamic_call.rb similarity index 100% rename from test/slot_machine/instruction/test_dynamic_call.rb rename to test/slot_machine/instructions/test_dynamic_call.rb diff --git a/test/slot_machine/instruction/test_jump.rb b/test/slot_machine/instructions/test_jump.rb similarity index 100% rename from test/slot_machine/instruction/test_jump.rb rename to test/slot_machine/instructions/test_jump.rb diff --git a/test/slot_machine/instruction/test_message_setup.rb b/test/slot_machine/instructions/test_message_setup.rb similarity index 100% rename from test/slot_machine/instruction/test_message_setup.rb rename to test/slot_machine/instructions/test_message_setup.rb diff --git a/test/slot_machine/instruction/test_not_same_check.rb b/test/slot_machine/instructions/test_not_same_check.rb similarity index 100% rename from test/slot_machine/instruction/test_not_same_check.rb rename to test/slot_machine/instructions/test_not_same_check.rb diff --git a/test/slot_machine/instruction/test_resolve_method.rb b/test/slot_machine/instructions/test_resolve_method.rb similarity index 100% rename from test/slot_machine/instruction/test_resolve_method.rb rename to test/slot_machine/instructions/test_resolve_method.rb diff --git a/test/slot_machine/instruction/test_return_jump.rb b/test/slot_machine/instructions/test_return_jump.rb similarity index 100% rename from test/slot_machine/instruction/test_return_jump.rb rename to test/slot_machine/instructions/test_return_jump.rb diff --git a/test/slot_machine/instruction/test_return_sequence.rb b/test/slot_machine/instructions/test_return_sequence.rb similarity index 100% rename from test/slot_machine/instruction/test_return_sequence.rb rename to test/slot_machine/instructions/test_return_sequence.rb diff --git a/test/slot_machine/instruction/test_simple_call.rb b/test/slot_machine/instructions/test_simple_call.rb similarity index 100% rename from test/slot_machine/instruction/test_simple_call.rb rename to test/slot_machine/instructions/test_simple_call.rb diff --git a/test/slot_machine/instruction/test_slot_load.rb b/test/slot_machine/instructions/test_slot_load.rb similarity index 100% rename from test/slot_machine/instruction/test_slot_load.rb rename to test/slot_machine/instructions/test_slot_load.rb diff --git a/test/slot_machine/instruction/test_slot_load1.rb b/test/slot_machine/instructions/test_slot_load1.rb similarity index 100% rename from test/slot_machine/instruction/test_slot_load1.rb rename to test/slot_machine/instructions/test_slot_load1.rb diff --git a/test/slot_machine/instruction/test_slot_load2.rb b/test/slot_machine/instructions/test_slot_load2.rb similarity index 100% rename from test/slot_machine/instruction/test_slot_load2.rb rename to test/slot_machine/instructions/test_slot_load2.rb diff --git a/test/slot_machine/instruction/test_slot_load3.rb b/test/slot_machine/instructions/test_slot_load3.rb similarity index 100% rename from test/slot_machine/instruction/test_slot_load3.rb rename to test/slot_machine/instructions/test_slot_load3.rb diff --git a/test/slot_machine/instruction/test_truth_check.rb b/test/slot_machine/instructions/test_truth_check.rb similarity index 100% rename from test/slot_machine/instruction/test_truth_check.rb rename to test/slot_machine/instructions/test_truth_check.rb