SSCRIPT TECHNICAL PAPER

Plug-Ins Technical Documentation
--------------------------------
(revised for SScript 1.8 and later)

This is the documentation file for Socket Script Plug-Ins implementation 
and is provided for developers.

1 - Plug-Ins description
2 - Supported plug-ins
3 - Including plug-ins
4 - License for third-parties plug-ins

------------------------------------------------------------------------
1                       Plug-Ins description

SScript comes with a lot of native commands. Of course, like any
scripting language, SScript isn't complete. It has the ability to add
plug-ins. The Socket Script distribution comes with a few, and you can
also add your own plug-ins.

------------------------------------------------------------------------
2                        Supported plug-ins

SScript supports 2 types of plugins: Custom Libraries (CL) and Perl
scripts. CLs are included within the code, while Perl scripts are part
of a script.

------------------------------------------------------------------------
3                        Including plug-ins

The type of plugins you should usualy add is Custom Libraries. You have
2 ways to add them. Either edit sscript.c and add a reference to your CL
where there's a banner saying 'ADD CUSTOM LIBRARIES HERE', or you can
include your CL in a script with the include command. When you add them
directly to the code, you need to add your C file to the Makefile, and
add a reference like that to sscript.c:

if(!cas_cmp(lindex(temp,1),"hello"))
{
 hello_world(sockfd,in);
}

Where hello_world would be your CL's function, and people would call it
with 'cl hello <args...>'.

An other way is to use the include command within a script. You must
have your CL C file already compiled, and accepting commands line
arguments that will basicly be the script command. For example if your
binary is called hello_world-cl.binary and you want the user to use 'cl
hello <args...>' your include line would be:

include hello hello_world-cl.binary

Then your hello_world-cl binary would be called whenever SScript sees a
line begining by 'cl hello' and the line would be passed to the binary
file. If you need to bring data back to your SScript script, then you
need to use a temporary file to save your data to, and load it from your
script.

If you only need a Perl plug-in, you can add it directly to a script.
You can either add it to the main script, or to a separate file and call
this file from the main script with the $remote command. In your code,
you can add Perl commands with the 'cl utils perl' keywords. See the
sscript.doc file for syntax.

------------------------------------------------------------------------
4                 License for third-parties plug-ins

When you add plug-ins to your code, you are free to use it for anything
you like. If you want to distribute your plug-ins with SScript, please
contact me first and maybe we could add it as part of the original
SScript distribution. CL's is really the best way to contribute code to
SScript, since you can simply upgrade your CL to add changes, and still
be compatible with future versions of SScript.




Drow@FastEthernet.net
---------------------
Mar 1998
