Commit Graph

7 Commits

Author SHA1 Message Date
Xavier Delaruelle
a5d0c0e3c5 lib: bump copyright year mention 2019-08-09 21:15:10 +02:00
Xavier Delaruelle
40477f8a3b lib: Tcl_GetBooleanFromObj already set err msg
No need to craft an error message when a non-boolean value is passed to
procedures as the Tcl_GetBooleanFromObj function already set the
accurate message when it returns non-OK.
2019-08-08 21:16:43 +02:00
Xavier Delaruelle
31eafcf860 lib: directly return res of Envmodules_Init last op 2019-08-06 13:24:48 +02:00
Xavier Delaruelle
afeae10ec0 Take .modulerc at modulepath root into account
When looking for modulefiles in enabled modulepaths, take .modulerc file
found at the root of a modulepath directory into account. Which means
these RC files are now evaluated like global rc files and can be used to
define module aliases targeting modulefiles stored in the underlying
file tree.

findModules procedure has been adapted to return any .modulerc file
found at the root of the directory. Code that look at modulepath root
has been adapted to use the getFilesInDirectory procedure or command.

A fetch_dotversion argument is added to the getFilesInDirectory Tcl
procedure and its libtclenvmodules counterpart. This argument is
disabled when looking at modulepath root content to avoid returning
eventual .version file stored there.

Shorthand version notation (ex: /1.0) cannot be used in a modulepath rc
file as a module name cannot be determined from this location.
2019-04-30 08:12:47 +02:00
Xavier Delaruelle
9b8e5981a7 Implement getFilesInDirectory in Tcl extension library
Add function in libtclenvmodules to implement getFilesInDirectory as a
command, which provides a more IO-optimized way than native Tcl commands
perform by avoiding specific additional queries to get hidden files like
.modulerc and .version. As a result 1 stat and 2 access syscalls are
saved per directory read.
2019-04-29 16:02:13 +02:00
Xavier Delaruelle
3b3534089e lib: adapt error report to support Tcl8.4
Add code to Tcl extension library to report error specifically when
built against Tcl8.4. This version of Tcl does not propose a
Tcl_ObjPrintf function, so the Tcl_AppendResult function is used instead
when the library is built against this version.
2019-04-29 16:02:13 +02:00
Xavier Delaruelle
3c360a9937 Introduce Modules Tcl extension library
Introduce Modules Tcl extension library (written in C) to extend Tcl
language in order to provide more optimized I/O commands than native Tcl
commands do.

This library first provides a 'readFile' command which performs an open,
read, close of a given modulefile to fetch its content. Compared to the
Tcl native open, read, close commands it saves 1 ioctl + 1 fcntl + N
lstat system calls per modulefile.
2019-04-29 15:56:23 +02:00