Project

General

Profile

Up

_envList

Return a list of the environment content :

  • all loaded packages (files and strings), the last is the first. So packages loaded in a start up and packages and strings dynamically loaded later are returned.
  • and the initial environment is also returned.

Thus, all functions, all Scol constantes, all types and all global variables are returned.
About types, even created with struct or typedef are returned.
About functions, even in a struct or a typedef (fields definition) are also returned.

Prototype :

fun [Chn] [[S S I S] r1]

  • Chn : any channel. If nil, the initial environment will be only returned. Else, associated environment with this channel will be returned (= the initial environment + all packages and strings loaded in this channel).

Return : [[S S I S] r1] A list of all items. For each item :

  • S : the name (of the function, type, etc). By example "_openchannel".
  • S : its type (nothing for a type). By example : "fun [S S Env] Chn".
  • I : the arity (the number of arguments for a function) : negative for a type, a Scol constante or a global variable (in this last case : nil). By example : 3
  • S : the package name where it defined (for the initial environment : "Initial environment")
It returns nil if error.

See also :

Example :

fun printEnv (l)=
	if l == nil then
		0
	else
	(
		_fooS sprintf "name = %s  type = %s  arity = %i  pkg = %s" hd l;
		printEnv tl l
	);;
	
fun main ()=
	_showconsole;
	printEnv _envList _channel;
	0;;

Note :

The local variables are not returned (this is logic ...).

WARNING : this function can take a long time before return.

The list size could be greater than thousands of elements.