Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
The functions API

Functions

 pkgs_funGetFlag (iFlag)
 Get a flag value string.
 pkgs_funGetSource (fPkg, pos)
 Returns the source of a function (or other Scol definition objects). These arguments can be found by the following functions :
 pkgs_funSearchFromName (szFunName, lFlags, isSensitive, isWhole)
 Search the definition of a function (or a variable, a type, a Comm ...) in the current application packages.
 pkgs_funSearchFromNameChn (chn, szFunName, lFlags, isSensitive, isWhole)
 Search the definition of a function (or a variable, a type, a Comm ...) in a given channel.
 pkgs_funSearchFromNameScol (fScol, szFunName, lFlags, isSensitive, isWhole)
 Search the definition of a function (or a variable, a type, a Comm ...) in a given script launcher (typically a *.scol).
 pkgs_funSetFlag (iFlag, szFlag)
 Set a flag value string. This is helpfull when the source code has been written by a different way. Like "fun\nnameOfFunction\n(args)=".
 pkgs_pkgFunList (chn)
 Similar to the Scol function "_funlist" but its prototype is easier.

Detailed Description

Package to load : lib/pkgs/fun.pkg

Dependancies :

Function Documentation

pkgs_funSearchFromName ( szFunName  ,
lFlags  ,
isSensitive  ,
isWhole   
)

Search the definition of a function (or a variable, a type, a Comm ...) in the current application packages.

The search is only on the packages loaded in the starting of the current application. For all loaded packages or the packages loaded in a given channel, use pkgs_funSearchFromNameChn. For search in loaded package by a launcher (typically a *.scol), use 'pkgs_funSearchFromNameScol'.

This is usefull for a programming editor or a debug application.

Prototype : fun [S [I r1] I I] [[I [[S [I r1]] r1]] r1]

Parameters
S: the name to find
[Ir1] : a list of mode, a mode defines if the searched name is a function, a variable, etc. The mode can take the following values :
  • PKGS_FUN_FUN : a function (fun ...)
  • PKGS_FUN_PROTO : a prototype of a function (proto ...)
  • PKGS_FUN_VAR : a global variable defined by the keyword "var"
  • PKGS_FUN_TYPEOF : a global variable defined by the keyword "typeof"
  • PKGS_FUN_TYPEDEF : a type object defined by the keyword "typedef"
  • PKGS_FUN_STRUCT : a type object defined by the keyword "struct"
  • PKGS_FUN_COMM : a communication (defcom ...)
  • PKGS_FUN_COMMVAR : a variable communication (defcomvar ...)
I: the search is case-sensitive (PKGS_FUN_SENSITIVE) or case-insensitive (PKGS_FUN_INSENSITIVE)
I: the searched name is the whole name (PKGS_FUN_WHOLENAME) or a part of the name (PKGS_FUN_PARITALNAME)
Returns
[[I [[S [I r1]] r1]] r1] : a list of results. For each element :
  • I : the current mode
  • [[S [I r1]] r1] : a list with, for each package filename, a list of positions where the name has been found (this list of positions will be nil if the name is not found in this package).
Remarks
If flags are set as PKGS_FUN_SENSITIVE and PKGS_FUN_WHOLENAME, the result should only be one element
Only definitions are returned, not their call or their use in the packages.
See Also
pkgs_funSearchFromNameChn
pkgs_funSearchFromNameScol
pkgs_funSearchFromNameChn ( chn  ,
szFunName  ,
lFlags  ,
isSensitive  ,
isWhole   
)

Search the definition of a function (or a variable, a type, a Comm ...) in a given channel.

The search is only on the packages loaded in a channel. For search in loaded package by a launcher (typically a *.scol), use 'pkgs_funSearchFromName'. For search in loaded package by a launcher (typically a *.scol), use 'pkgs_funSearchFromNameScol'.

This is usefull for a programming editor or a debug application.

Prototype : fun [S [I r1] I I] [[I [[S [I r1]] r1]] r1]

Parameters
S: the name to find
[Ir1] : a list of mode, a mode defines if the searched name is a function, a variable, etc. The mode can take the following values :
  • PKGS_FUN_FUN : a function (fun ...)
  • PKGS_FUN_PROTO : a prototype of a function (proto ...)
  • PKGS_FUN_VAR : a global variable defined by the keyword "var"
  • PKGS_FUN_TYPEOF : a global variable defined by the keyword "typeof"
  • PKGS_FUN_TYPEDEF : a type object defined by the keyword "typedef"
  • PKGS_FUN_STRUCT : a type object defined by the keyword "struct"
  • PKGS_FUN_COMM : a communication (defcom ...)
  • PKGS_FUN_COMMVAR : a variable communication (defcomvar ...)
I: the search is case-sensitive (PKGS_FUN_SENSITIVE) or case-insensitive (PKGS_FUN_INSENSITIVE)
I: the searched name is the whole name (PKGS_FUN_WHOLENAME) or a part of the name (PKGS_FUN_PARITALNAME)
Returns
[[I [[S [I r1]] r1]] r1] : a list of results. For each element :
  • I : the current mode
  • [[S [I r1]] r1] : a list with, for each package filename, a list of positions where the name has been found (this list of positions will be nil if the name is not found in this package).
Remarks
If flags are set as PKGS_FUN_SENSITIVE and PKGS_FUN_WHOLENAME, the result should only be one element
Only definitions are returned, not their call or their use in the packages.
See also 'scolSearchInChn' (Syspack) http://www.scolring.org/files/doc_html/scolSearchInChn.html
See Also
pkgs_funSearchFromName
pkgs_funSearchFromNameScol
pkgs_funSearchFromNameScol ( fScol  ,
szFunName  ,
lFlags  ,
isSensitive  ,
isWhole   
)

Search the definition of a function (or a variable, a type, a Comm ...) in a given script launcher (typically a *.scol).

The search is only on the packages loaded by this launcher.

This is usefull for a programming editor or a debug application.

Prototype : fun [S [I r1] I I] [[I [[S [I r1]] r1]] r1]

Parameters
S: the name to find
[Ir1] : a list of mode, a mode defines if the searched name is a function, a variable, etc. The mode can take the following values :
  • PKGS_FUN_FUN : a function (fun ...)
  • PKGS_FUN_PROTO : a prototype of a function (proto ...)
  • PKGS_FUN_VAR : a global variable defined by the keyword "var"
  • PKGS_FUN_TYPEOF : a global variable defined by the keyword "typeof"
  • PKGS_FUN_TYPEDEF : a type object defined by the keyword "typedef"
  • PKGS_FUN_STRUCT : a type object defined by the keyword "struct"
  • PKGS_FUN_COMM : a communication (defcom ...)
  • PKGS_FUN_COMMVAR : a variable communication (defcomvar ...)
I: the search is case-sensitive (PKGS_FUN_SENSITIVE) or case-insensitive (PKGS_FUN_INSENSITIVE)
I: the searched name is the whole name (PKGS_FUN_WHOLENAME) or a part of the name (PKGS_FUN_PARITALNAME)
Returns
[[I [[S [I r1]] r1]] r1] : a list of results. For each element :
  • I : the current mode
  • [[S [I r1]] r1] : a list with, for each package filename, a list of positions where the name has been found (this list of positions will be nil if the name is not found in this package).
Remarks
If flags are set as PKGS_FUN_SENSITIVE and PKGS_FUN_WHOLENAME, the result should only be one element
Only definitions are returned, not their call or their use in the packages.
See Also
pkgs_funSearchFromName
pkgs_funSearchFromNameChn
pkgs_funSetFlag ( iFlag  ,
szFlag   
)

Set a flag value string. This is helpfull when the source code has been written by a different way. Like "fun\nnameOfFunction\n(args)=".

Prototype : fun [I S] S

Parameters
I: a flag (mode), it should be one of these following value
  • PKGS_FUN_FUN : a function (fun ...)
  • PKGS_FUN_PROTO : a prototype of a function (proto ...)
  • PKGS_FUN_VAR : a global variable defined by the keyword "var"
  • PKGS_FUN_TYPEOF : a global variable defined by the keyword "typeof"
  • PKGS_FUN_TYPEDEF : a type object defined by the keyword "typedef"
  • PKGS_FUN_STRUCT : a type object defined by the keyword "struct"
  • PKGS_FUN_COMM : a communication (defcom ...)
  • PKGS_FUN_COMMVAR : a variable communication (defcomvar ...)
S: a string
Returns
S : the same string (by example "fun " or "typeof ")
pkgs_funGetFlag ( iFlag  )

Get a flag value string.

Prototype : fun [I] S

Parameters
I: a flag (mode), it should be one of these following value
  • PKGS_FUN_FUN : a function (fun ...)
  • PKGS_FUN_PROTO : a prototype of a function (proto ...)
  • PKGS_FUN_VAR : a global variable defined by the keyword "var"
  • PKGS_FUN_TYPEOF : a global variable defined by the keyword "typeof"
  • PKGS_FUN_TYPEDEF : a type object defined by the keyword "typedef"
  • PKGS_FUN_STRUCT : a type object defined by the keyword "struct"
  • PKGS_FUN_COMM : a communication (defcom ...)
  • PKGS_FUN_COMMVAR : a variable communication (defcomvar ...)
Returns
S : the string (by example "fun " or "typeof ")
See Also
pkgs_funSetFlag
pkgs_pkgFunList ( chn  )

Similar to the Scol function "_funlist" but its prototype is easier.

http://www.scolring.org/files/doc_html/_funlist.html

See also (Syspack) :

http://www.scolring.org/files/doc_html/funType.html

http://www.scolring.org/files/doc_html/getInPackage.html

http://www.scolring.org/files/doc_html/getPackages.html

http://www.scolring.org/files/doc_html/scolAllFuns.html

http://www.scolring.org/files/doc_html/scolAllFunsWithArgs.html

http://www.scolring.org/files/doc_html/scolSearchInChn.html

http://www.scolring.org/files/doc_html/varType.html

Prototype : fun [Chn] [[S I I S] r1]

Parameters
Chn: any channel
Returns
[[S I I S] r1] : a list of tuples. For each tuple :
  • S : the name of the function (or the variable, ...)
  • I : its memory address
  • I : the number of arguments (-1 for a variable)
  • S : its prototype
Remarks
At this time, the return is for the last loaded package only.
pkgs_funGetSource ( fPkg  ,
pos   
)

Returns the source of a function (or other Scol definition objects). These arguments can be found by the following functions :

See Also
pkgs_funSearchFromName
pkgs_funSearchFromNameChn
pkgs_funSearchFromNameScol

Prototype : fun [S I] S

Parameters
S: a package filename
I: a position
Returns
S : the source or nil if error.