From my Tcl script, I would like to find the path to the tclsh executable which is running my script (like sys.executable in Python), or at least find how the tclsh was invoked from the command line (like $^X in Perl)?
Just found it by myself: It's
info nameofexecutable
Related
I am trying to write a tcl script to read and synthesize a design. I used the following commands at the top of the tcl file and executed it with yosys -c filename.tcl.
verilog_defaults -add -I<path_to_include_dir>
I got the following error:
ERROR: TCL interpreter returned an error: invalid command name "verilog_defaults"
I do not get any errors when I execute the same command in yosys shell. Are these commands valid in tcl script or are there different commands for tcl scripts?
My bad, I missed importing yosys commands to tcl shell. I will mention the solution just for the reference of others who might face the same issue.
The issue was solved by putting the below import command at the top of the tcl file.
yosys -import
This instruction is mentioned in the link:
http://www.clifford.at/yosys/cmd_tcl.html
I want to have tclsh binary in my root file system generated by Buildroot.
In buildroot, we can (from menuconfig) go to Interpreter languages and scripting -> then choose tcl
But this will install tcl8.6 packages (opt0.4, http1.0). The tcl shell itself is not implemented in the generated file system.
Does anyone know how to enable tclsh in Buildroot
Thanks in Advance
You will have to tell buildroot not to remove tclsh from your build. This can be achieved by setting BR2_PACKAGE_TCL_SHLIB_ONLY=n after having run make menuconfig.
See also https://git.busybox.net/buildroot/tree/package/tcl/tcl.mk#n51.
mcu8051ide on Linux mint 19 not working or opening, all dependencies are installed but when I check libraries, itcl is not present is the error.
I am confused what to do?
I installed Linux mint 19 in a virtual machine to check out what's going on.
The Itcl 3.4 pkgIndex.tcl file has the following contents:
# Tcl package index file, version 1.0
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded Itcl 3.4 [list load [file join /usr lib x86_64-linux-gnu "libitcl3.4.so.1"] Itcl]
This means that Itcl will only be available with Tcl 8.6. However, mcu8051ide specifically starts tclsh8.5. That's the reason it can't find Itcl.
The mcu8051ide command is a very short shell script that only starts tclsh8.5 and passes /usr/share/mcu8051ide/lib/main.tcl as the script to run. If instead you run that script with tclsh (which is a symbolic link that points to tclsh8.6), it seems to work at first glance.
So, you can either modify the original startup script, or put a modified copy in your own bin directory.
go to /usr/local/share/mcu8051ide/lib
(or to /usr/share/mcu8051ide/lib depending on config during cmake)
and then edit the main.tcl file
using sudo nano main.tcl
On the 51st line,
change the value for MIN_TCL_VER from 8.5 to 8.6.
I am trying to run algolia for the first time but it seems that there is something wrong with my environment. I followed the detailed explanation here https://community.algolia.com/jekyll-algolia/getting-started.html.
I installed and configured everything that is needed from the previous steps but when I run the command
ALGOLIA_API_KEY=xxxxxxxxxxxxxx bundle exec jekyll algolia
I get an error:
'ALGOLIA_API_KEY' is not recognized as an internal or external command,
operable program or batch file.
I have been rereading the documentation for both jekyll and angolia but couldn't find anything that could be helpful.
Since you're running on Windows, you cannot set an environment variable for your command like you can do on UNIX.
As advised in this question, Setting and using variable within same command line in Windows cmd.exe, I believe you could use
set ALGOLIA_API_KEY=xxxxxxxxxxxxxx && bundle exec jekyll algolia
I'm new to Lua and work around with some tutorials, try some basic stuff like coding common algorithms etc.
But I have some trouble while using the lua interpreter on my mac os machine.
For example let's say we have a file called 'sample.lua', holds the code line:
function fib(n) return n<2 and n or fib(n-1)+fib(n-2) end
How do I run that function from terminal?
If I don't use any function, I just call the script with 'lua script.lua' - works!
Next question points on the basic understanding between the usage of non-compiled and compiled lua-source. Why is lua code run without compiling, like I mentioned before (lua script.lua)? Or will this statement compile the code temporarily and run afterwards?
Thanks in advance
chris
You can run lua from the terminal with the -i flag:
lua -i luascript.lua
This will execute the script and then put the interpreter into interactive mode. Then you could call the function right from the interactive prompt:
fib(3)
To run that function from the terminal, you would have to do something like:
lua -e"dofile'sample.lua' print(fib(3))"
The -e there just tells it to execute the following string, which loads your file 'sample.lua' and then prints the result of fib(3) to stdout.
I don't know the answer to your second question though.
Lua scripts are always compiled into Lua VM instructions before running. Precompiled scripts just skip this step.