Dyalog / ride

Cross-platform IDE for Dyalog APL
https://dyalog.github.io/ride
MIT License
198 stars 29 forks source link

Pasting APL code into a function causes a problem on the PI #1007

Open aplteam opened 1 year ago

aplteam commented 1 year ago

Describe the issue you are having

I pasted this code:

 {r}←{force}Init_SHA256 dummy;⎕USING;filename;path;OS
⍝ Make the necessary preparations for hashing a password.\\
⍝ Once initiallized, the function does not run its code again, except when a 1 is passed as `⍺`.
 force←{0<⎕NC ⍵:⍎⍵ ⋄ 0}'force'
 '⍺ must be a Boolean'Assert(⊂force)∊0 1
 :If 9≠⎕NC'SHA256'
 :OrIf force
     OS←APLTreeUtils2.GetOperatingSystem ⍬
     :If 'Win'≡OS
         ⎕USING←',System.Security.Cryptography.Algorithms',('W'=⊃⊃'.'⎕WG'APLVersion')/'.dll'
         SHA256←⎕NEW System.Security.Cryptography.SHA256Managed
     :Else
         'SHA256'⎕NS''
         :If 0=≢path←PathToCongaDLLs
             path←(2 ⎕NQ #'GetEnvironment' 'Dyalog'),'/lib/'
         :EndIf
         filename←⊃FilesAndDirs.ListFiles path,'libconga??ssl',((1+Is64Bit)⊃'32' '64'),(1+'Mac'≡OS)⊃'so' 'dylib'
         'Conga DLL not found'Assert 0<≢filename
         'Init'SHA256.⎕NA filename,'|nettle_sha256_init >I1[112]'
         'Update'SHA256.⎕NA filename,'|nettle_sha256_update =I1[112] U8 <T1[]'
         'Digest'SHA256.⎕NA filename,'|nettle_sha256_digest =I1[112] U8 >U1[32]'
         SHA256.⎕FX'digest←ComputeHash data;ctx' 'data←⎕UCS⊃data' 'ctx←Init 112' 'ctx←Update ctx(⍴data)data' '(ctx digest)←Digest ctx 32 32'
     :EndIf
 :EndIf

First I thought that the :Else branch is not on display in the function editor: instead three very small red dots are shown. I have added a screenshot.

But it is more complex than that: the last line before the :Else branch is not shown, but the last line of the :Else branch is!

I am using Ride 4.4 in connection with a 32-bit Dyalog APL on a 64-bit PI 400.

IDE:
  Version: 4.4.3687
  Platform: Linux aarch64
  Date: 2022-02-23 13:44:34 +0100
  Git commit: a3d8123cfb690ead493e261ccced59407db04c64
  Preferences:{
    "autoPW":"1",
    "autocompletionDelay":"150",
    "kbdLocale":"en_US",
    "zoom":"3"
  }

Interpreter:
  Version: 18.2.47420
  Platform: Linux
  Edition: Unicode/32
  Date: Jul  4 2023 at 00:19:00

This is my <02102> Else

aplteam commented 1 year ago

It appears that this is related somehow to the fact that I was editing the function from the Tracer.

When I finished tracing and just edited the function and inserted the code it worked as expected.