]> Repositorios git - scryer-prolog.git/commitdiff
Rename copy_file/2 to file_copy/2
authorAdrián Arroyo Calle <[email protected]>
Sat, 10 Dec 2022 23:08:41 +0000 (00:08 +0100)
committerAdrián Arroyo Calle <[email protected]>
Sat, 10 Dec 2022 23:08:41 +0000 (00:08 +0100)
build/instructions_template.rs
src/lib/files.pl
src/machine/dispatch.rs
src/machine/system_calls.rs

index f8cce3f43ca64b3a637e65d84efd5becbfdf8dfe..ade61a9cba809fbf6c5d386f62be776a2386b815 100644 (file)
@@ -262,8 +262,8 @@ enum SystemClauseType {
     DeleteFile,
     #[strum_discriminants(strum(props(Arity = "2", Name = "$rename_file")))]
     RenameFile,
-    #[strum_discriminants(strum(props(Arity = "2", Name = "$copy_file")))]
-    CopyFile,
+    #[strum_discriminants(strum(props(Arity = "2", Name = "$file_copy")))]
+    FileCopy,
     #[strum_discriminants(strum(props(Arity = "2", Name = "$working_directory")))]
     WorkingDirectory,
     #[strum_discriminants(strum(props(Arity = "1", Name = "$delete_directory")))]
@@ -1613,7 +1613,7 @@ fn generate_instruction_preface() -> TokenStream {
                     &Instruction::CallMakeDirectoryPath(_) |
                     &Instruction::CallDeleteFile(_) |
                     &Instruction::CallRenameFile(_) |
-                   &Instruction::CallCopyFile(_) |
+                   &Instruction::CallFileCopy(_) |
                     &Instruction::CallWorkingDirectory(_) |
                     &Instruction::CallDeleteDirectory(_) |
                     &Instruction::CallPathCanonical(_) |
@@ -1828,7 +1828,7 @@ fn generate_instruction_preface() -> TokenStream {
                     &Instruction::ExecuteMakeDirectoryPath(_) |
                     &Instruction::ExecuteDeleteFile(_) |
                     &Instruction::ExecuteRenameFile(_) |
-                   &Instruction::ExecuteCopyFile(_) |
+                   &Instruction::ExecuteFileCopy(_) |
                     &Instruction::ExecuteWorkingDirectory(_) |
                     &Instruction::ExecuteDeleteDirectory(_) |
                     &Instruction::ExecutePathCanonical(_) |
index 7d0afeda067b994a86c4c5cc7f91be793820f036..e920b5bd75c3e450a82d21a0a23b06303d62a4ee 100644 (file)
@@ -71,7 +71,7 @@ In this library, directories and files are represented as
                   directory_exists/1,
                   delete_file/1,
                  rename_file/2,
-                 copy_file/2,
+                 file_copy/2,
                  delete_directory/1,
                   make_directory/1,
                   make_directory_path/1,
@@ -151,10 +151,13 @@ rename_file(File, Renamed) :-
         must_be(chars, Renamed),
         '$rename_file'(File, Renamed).
 
-copy_file(File, Copied) :-
-       file_must_exist(File, copy_file/2),
+%% file_copy(+File, +Copied).
+%
+% Succeeds if File is copied to Copied
+file_copy(File, Copied) :-
+       file_must_exist(File, file_copy/2),
        must_be(chars, Copied),
-       '$copy_file'(File, Copied).
+       '$file_copy'(File, Copied).
 
 %% delete_directory(+Directory).
 %
index 1cc1d3657628168af73e3fc7294f341c55c82997..a93d9e2247686bd5f146b85c9e5c1f0b1893db50 100644 (file)
@@ -3533,12 +3533,12 @@ impl Machine {
                     self.rename_file();
                     step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
                 }
-               &Instruction::CallCopyFile(_) => {
-                   self.copy_file();
+               &Instruction::CallFileCopy(_) => {
+                   self.file_copy();
                    step_or_fail!(self, self.machine_st.p += 1);
                }
-               &Instruction::ExecuteCopyFile(_) => {
-                   self.copy_file();
+               &Instruction::ExecuteFileCopy(_) => {
+                   self.file_copy();
                    step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
                }
                 &Instruction::CallWorkingDirectory(_) => {
index 515baba62dcf074643e867ea507f0c7214d1ba9c..f72cbf8aadcdddf7ef5f812675bb526f82444131 100644 (file)
@@ -1654,7 +1654,7 @@ impl Machine {
     }
 
     #[inline(always)]
-    pub(crate) fn copy_file(&mut self) {
+    pub(crate) fn file_copy(&mut self) {
        if let Some(file) = self.machine_st.value_to_str_like(self.machine_st.registers[1]) {
            if let Some(copied) = self.machine_st.value_to_str_like(self.machine_st.registers[2]) {
                if fs::copy(file.as_str(), copied.as_str()).is_ok() {