• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

MakefileH A D06-May-20022.2 KiB5638

Makefile.inH A D21-Feb-20022 KiB5538

READMEH A D10-Feb-20012.2 KiB6743

fcntl-module.cH A D10-Feb-20012.3 KiB11885

newt-module.cH A D30-Aug-20001.8 KiB9270

newt.slH A D14-Nov-1999232 1510

select-module.cH A D10-Feb-20015.2 KiB239183

smg-module.cH A D10-Feb-20018.2 KiB325265

smg.slH A D30-Aug-20001.4 KiB7150

termios-module.cH A D10-Feb-200110.4 KiB441352

varray-module.cH A D21-Feb-20024.4 KiB225173

varray.slH A D21-Feb-2002755 3828

README

1This directory contains some examples of dynamically loaded modules
2that may be loaded via the `import' intrinsic function.  If you choose
3to build these modules, do so only AFTER installing the slang library
4because the Makefile references the installed slang library location.
5
6The default installation location for the modules is in
7$(prefix)/lib/slang/modules.
8
9--------------------------------------------------------------------
10
11This directory contains some examples of dynamically loaded modules
12that may be loaded via the `import' intrinsic function:
13
14  import ("NAME");
15
16This intrinsic function is available to applications that enable it
17via a call to the `SLang_init_import' function.  Of course, the OS
18must provide support for dynamic linking.
19
20When a slang script contains a line such as
21
22  import ("NAME");
23
24or
25
26  import ("NAME", "NAMESPACE");
27
28
29slang requests that the operating system dynamically link to a shared
30object called NAME-module.so.  Then the slang library will call the
31function `init_NAME_ns' that NAME-module.so must define.  This function
32must have the prototype:
33
34  int init_NAME_ns (char *namespace);
35
36and shall return 0 upon success, or -1 if an error occurred.  The
37namespace argument corresponds to the second (option) parameter of the
38import intrinsic.  This means that the user wishes to import the
39module into the specified namespace.  To this end, the module must
40call one of the SLns_* functions to load intrinsics into a namespace.
41
42Optionally, the module may define a function called `deinit_NAME' that
43will be called by the interpreter to deinitialize the module.  This
44function must have the prototype:
45
46   void deinit_NAME (void);
47
48To ensure the correct prototypes for these functions, the module
49should include the line:
50
51    SLANG_MODULE(name);
52
53SLANG_MODULE is a macro that expands into function prototypes.
54
55See the examples in this directory for more information.
56
57To run these modules, use the slsh program in ../slsh/.
58slsh.c is a program that embeds the interpreter and may be used to
59test slang scripts.  In fact, it may be used to create unix executable
60scripts via, e.g.,
61
62#! /usr/bin/env slsh
63
64as the first line of the script.  See ../slsh/scripts subdirectory for
65examples of this approach.
66
67