diff --git a/.gitignore b/.gitignore index 48f68fb..3853ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ # Remove Cargo.lock from gitignore if creating an executable, # leave it for libraries. # More information here: http://doc.crates.io/guide.html#cargotoml-vs-cargolock -#Cargo.lock +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 3963a9b..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,27 +0,0 @@ -[root] -name = "mason" -version = "0.1.0" -dependencies = [ - "alchemy 0.1.0 (git+https://gitlab.com/CyberMages/alchemy.git)", - "scribe 0.1.0 (git+https://gitlab.com/CyberMages/scribe.git)", -] - -[[package]] -name = "alchemy" -version = "0.1.0" -source = "git+https://gitlab.com/CyberMages/alchemy.git#26080427c02c99b172cd34ed32b5a31684e59694" -dependencies = [ - "scribe 0.1.0 (git+https://gitlab.com/CyberMages/scribe.git)", - "sigils 0.1.0 (git+https://gitlab.com/CyberMages/sigils.git)", -] - -[[package]] -name = "scribe" -version = "0.1.0" -source = "git+https://gitlab.com/CyberMages/scribe.git#e52418d3bfc28cd1f03cc7f31af06fce2e03f844" - -[[package]] -name = "sigils" -version = "0.1.0" -source = "git+https://gitlab.com/CyberMages/sigils.git#e64c3b0fbecca351e0a078fefc4273a0f0b8e6ad" - diff --git a/Cargo.toml b/Cargo.toml index 6017749..b367e7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["mason", "build"] [dependencies.scribe] -git = "https://gitlab.com/CyberMages/scribe.git" +git = "ssh://git@gitlab.com/CyberMages/Core/scribe.git" [dependencies.alchemy] -git = "https://gitlab.com/CyberMages/alchemy.git" +git = "ssh://git@gitlab.com/CyberMages/Core/alchemy.git" diff --git a/src/loader.rs b/src/loader.rs index 0ff0300..2284a59 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -76,24 +76,7 @@ impl Entry impl Transmutable for Entry { - fn to_bytes(&self, endianess: Endianess) -> Vec - { - let mut buffer: Vec; - - // Create the new buffer to hold the data from this type. - buffer = Vec::new(); - - // Add the buffer data of the three paths to the data buffer. - buffer.append(&mut self.name.to_bytes(endianess)); - buffer.append(&mut self.type_hint.to_bytes(endianess)); - buffer.append(&mut self.path.to_bytes(endianess)); - - // Return the data buffer. - buffer.shrink_to_fit(); - buffer - } - - fn from_bytes(buffer: &[u8], endianess: Endianess) -> Entry + fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self { let buffer_size: usize; let name: String; @@ -104,18 +87,37 @@ impl Transmutable for Entry buffer_size = buffer.len() - 1; skip_size = 0; - name = String::from_bytes(&buffer[skip_size..buffer_size], endianess); + name = String::from_endian_bytes(&buffer[skip_size..buffer_size], + endianess); skip_size = skip_size + get_byte_size_of_string(&name); - type_hint = String::from_bytes(&buffer[skip_size..buffer_size], - endianess); + type_hint = String::from_endian_bytes(&buffer[skip_size..buffer_size], + endianess); skip_size = skip_size + get_byte_size_of_string(&type_hint); - path = String::from_bytes(&buffer[skip_size..buffer_size], endianess); + path = String::from_endian_bytes(&buffer[skip_size..buffer_size], + endianess); Entry::new(name, type_hint, path) } + fn as_endian_bytes(&self, endianess: Endianess) -> Vec + { + let mut buffer: Vec; + + // Create the new buffer to hold the data from this type. + buffer = Vec::new(); + + // Add the buffer data of the three paths to the data buffer. + buffer.append(&mut self.name.as_endian_bytes(endianess)); + buffer.append(&mut self.type_hint.as_endian_bytes(endianess)); + buffer.append(&mut self.path.as_endian_bytes(endianess)); + + // Return the data buffer. + buffer.shrink_to_fit(); + buffer + } + fn determine_byte_size(&self) -> usize { get_byte_size_of_string(&self.name) + @@ -193,13 +195,13 @@ impl Loader // Write the header of the file. data.extend_from_slice(MAGIC_NUMBER.as_bytes()); - data.append(&mut LOADER_MAJOR_VERSION.to_bytes(Endianess::Little)); - data.append(&mut LOADER_MINOR_VERSION.to_bytes(Endianess::Little)); + data.append(&mut LOADER_MAJOR_VERSION.as_endian_bytes(Endianess::Little)); + data.append(&mut LOADER_MINOR_VERSION.as_endian_bytes(Endianess::Little)); // Write all the entries of the file. for entry in self.entries.iter() { - data.append(&mut entry.to_bytes(Endianess::Little)); + data.append(&mut entry.as_endian_bytes(Endianess::Little)); } // Try to write all the data to the file. @@ -237,8 +239,8 @@ impl Loader while pos <= data_size { debug!("\tParsing entry."); - entry = Entry::from_bytes(&data_slice[pos..data_size], - Endianess::Little); + entry = Entry::from_endian_bytes(&data_slice[pos..data_size], + Endianess::Little); pos = pos + entry.determine_byte_size(); self.entries.push(entry); diff --git a/src/processor.rs b/src/processor.rs index ff46be8..b0fa99d 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -461,7 +461,7 @@ impl Processor // Create a new command to call the compiler to compile this // Section's resource. compiler = Command::new(section.compiler.clone()); - arg_compiler = compiler.args(&args); + arg_compiler = compiler.args(args.clone()); // Execute the compiler command. println!("Running command: {:?}", arg_compiler);