For the *execute-external-file* script*, *here is one of my test files,  a 
tiny Julia file (of course, install Julia first):

headline: @file julia-1.jl
# function to calculate the volume of a sphere
function sphere_vol(r)
    # julia allows Unicode names (in UTF-8 encoding)
    # so either "pi" or the symbol π can be used
    # return (4/3)*pi*r^3
    return (4/3)*π*r^3
end

vol = sphere_vol(3)

# @printf allows number formatting but does not automatically append the \n 
to statements
using Printf
@printf "volume = %0.3f\n" vol

For the command to find the Julia processor, you have to create an @data 
settings node named *@data run-external-processor-map, *like this one (.py 
scripts are hardcoded in, of course, and don't need to be included here):

EXTENSIONS
.jl: julia  # Trailing comments are allowed
.lua: lua
.rb: ruby
.nim: nim

PROCESSORS
julia: julia
lua: lua
nim: nim
# Originally, ruby was not on the PATH, so we needed its full path:
# ruby: C:\Ruby27-x64\bin\ruby.exe

# After ruby was added to the PATH, we could use its bare name:
ruby: ruby

This command is supposed to open a new terminal window and run the command 
in it.  The terminal *must* stay open after the external program ends so 
that the user can read any output (especially error messages!).  The 
trickiest part of the command is figuring out the terminal launch command 
for Linux that will launch and stay open at the end, since there is no one 
standard method good on all Linux distros.  My script uses some heuristics 
to try to get it right.  These can include scanning the --help output of 
the candidate terminal, IIRC.
On Sunday, June 9, 2024 at 3:56:45 PM UTC-4 Félix wrote:

> Hello Leonistas! :)
>
> I'm currently implementing and testing the *execute-external-file *& 
> *execute-general-script 
> *commands in LeoJS.
>
> *execute-external-file was made by Thomas around February 2023 while 
> execute-general-script was made by Edward around june 2021.*
>
> I was just wondering if anyone could send me 'minimal/proof-of-concept' 
> stripped down leo file(s) to test any of those two commands. (with simple 
> 'toy'/'hello-world' scripts to run with them) If you have a few minutes to 
> spare to prepare such a thing... :)
>
> Thanks! 
>
> Félix
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b9b0294e-eab1-467e-9827-d9049fc5141fn%40googlegroups.com.

Reply via email to