bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] How to change current directory in the interpreter?


From: Alexey Veretennikov
Subject: Re: [Bug-apl] How to change current directory in the interpreter?
Date: Sat, 18 Feb 2017 19:36:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin)

Hi,

Here is the patch to add this functionality to ⎕FIO (as well as to
FILE_IO) as ⎕FIO[54].

Index: src/Quad_FIO.cc
===================================================================
--- src/Quad_FIO.cc     (revision 889)
+++ src/Quad_FIO.cc     (working copy)
@@ -606,6 +606,7 @@
 "   Zy4←    ⎕FIO[51] By67  mktime(By67)  Note: Jan 2, 2017 is: 2017 1 2 ...\n"
 "   Zy9←    ⎕FIO[52] Bi    localtime(Bi) Note: Jan 2, 2017 is: 2017 1 2 ...\n"
 "   Zy9←    ⎕FIO[53] Bi    gmtime(Bi)    Note: Jan 2, 2017 is: 2017 1 2 ...\n"
+"   Zi ←    ⎕FIO[54] Bs    chdir(Bs)\n"
 "\n"
 "Benchmarking functions:\n"
 "\n"
@@ -1518,7 +1519,12 @@
                 Z->check_value(LOC);
                 return Token(TOK_APL_VALUE1, Z);
               }
-
+         case 54:    // chdir
+              {
+                UTF8_string path(*B.get());
+                errno = chdir(path.c_str());
+                goto out_errno;
+              }
          case 202:   // get monadic parallel threshold
          case 203:   // get dyadic  parallel threshold
               {
Index: wslib5/FILE_IO.apl
===================================================================
--- wslib5/FILE_IO.apl  (revision 889)
+++ wslib5/FILE_IO.apl  (working copy)
@@ -337,6 +337,12 @@
  ⍝⍝ return broken down calender time Zy9 for Bi seconds since Jan 1, 1970
  Zy9←⎕FIO[53] Bi
 ∇
+
+∇Z ← FIO∆chdir Bs
+ ⍝⍝ chdir to string from Bs
+ Z← ⎕FIO[54] Bs
+∇
+
  
 ∇FIO∆clear_statistics Bi
  ⍝⍝ clear performance statistics with ID Bi

Juergen Sauermann <address@hidden> writes:

> Hi Alexey,
>
> I am afraid that chdir is not yet in ⎕FIO.
>
> BTW: I am about to travel for a few days, so my responses may take until next 
> week.
>
> /// Jürgen
>
> On 02/16/2017 09:48 PM, Alexey Veretennikov wrote:
>
>  Hi,
>
> In order to get the current directory I can use FIO∆getcwd. But how can
> I change current directory?
>
>

-- 
Br,
/Alexey

reply via email to

[Prev in Thread] Current Thread [Next in Thread]