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

..03-May-2022-

cmaps/H04-Mar-2018-617571

examples/H04-Mar-2018-509411

help/H04-Mar-2018-4,1162,922

mkfiles/H04-Mar-2018-217160

statslib/H04-Mar-2018-540460

test/H04-Mar-2018-3,0092,554

tm/H04-Mar-2018-3,0732,535

Makefile.inH A D04-Mar-20189.7 KiB222170

READMEH A D04-Mar-20183.3 KiB9967

base64-module.cH A D04-Mar-201814 KiB571448

base64.slH A D04-Mar-201819 21

chksum-module.cH A D04-Mar-20185.4 KiB256183

chksum.hH A D04-Mar-2018611 2415

chksum.slH A D04-Mar-20181.6 KiB8874

chksum_md5.cH A D04-Mar-201811.6 KiB419272

chksum_sha1.cH A D04-Mar-20189.3 KiB352231

csv-module.cH A D04-Mar-201813.8 KiB664552

csv.slH A D04-Mar-201816.3 KiB692599

fcntl-module.cH A D04-Mar-20182.6 KiB148107

fcntl.slH A D04-Mar-201835 32

fork-module.cH A D04-Mar-20187.2 KiB315245

fork.slH A D04-Mar-201817 21

histogram-module.cH A D04-Mar-201821.4 KiB922725

histogram-module.incH A D04-Mar-20185.6 KiB255218

histogram.slH A D04-Mar-20183 KiB151123

iconv-module.cH A D04-Mar-20185.5 KiB267208

iconv.slH A D04-Mar-201835 32

json-module.cH A D04-Mar-201827.6 KiB1,142869

json.slH A D04-Mar-20186 KiB235206

newt-module.cH A D04-Mar-20181.8 KiB9170

onig-module.cH A D04-Mar-201818.7 KiB849669

onig.slH A D04-Mar-201817 21

pcre-module.cH A D04-Mar-201814.2 KiB646515

pcre.slH A D04-Mar-20181.2 KiB4943

png-module.cH A D04-Mar-201817.8 KiB799639

png.slH A D04-Mar-20184 KiB168140

rand-module.cH A D04-Mar-201831.1 KiB1,4671,068

rand.slH A D04-Mar-20184.3 KiB205163

select-module.cH A D04-Mar-20185.3 KiB244191

select.slH A D04-Mar-201837 32

slsmg-module.cH A D04-Mar-20189.8 KiB368286

slsmg.slH A D04-Mar-201835 32

socket-module.cH A D04-Mar-201835.8 KiB1,6011,324

socket.slH A D04-Mar-2018151 65

stats-module.cH A D04-Mar-201828.2 KiB1,101780

stats-module.hH A D04-Mar-20181.1 KiB304

stats-module.incH A D04-Mar-20184.1 KiB231204

stats.slH A D04-Mar-201815.1 KiB701598

stats_kendall.cH A D04-Mar-20189.1 KiB384241

sysconf-module.cH A D04-Mar-201829.3 KiB1,2081,119

sysconf.slH A D04-Mar-201820 21

template.cH A D04-Mar-20181.2 KiB5037

termios-module.cH A D04-Mar-201815.5 KiB750637

termios.slH A D04-Mar-201839 32

varray-module.cH A D04-Mar-20185.8 KiB278204

varray.slH A D04-Mar-201837 32

zlib-module.cH A D04-Mar-201814.3 KiB638489

zlib.slH A D04-Mar-20182.9 KiB150130

README

1This directory contains some examples of dynamically loaded modules
2that may be loaded via the `import' intrinsic function:
3
4  import ("NAME");
5
6This intrinsic function is available to applications that enable it
7via a call to the `SLang_init_import' function.  Of course, the OS
8must provide support for dynamic linking.
9
10When a slang script contains a line such as
11
12  import ("NAME");
13
14or
15
16  import ("NAME", "NAMESPACE");
17
18the interpreter will request that the operating system dynamically
19link to a shared object called NAME-module.so.  In order for such
20linking to take place, the OS must be able to find the module.  The
21search for the module takes place as follows:
22
23   First a search takes place along the set of paths returned by the
24   `get_import_module_path' function.  If not found, a search is
25   performed along the paths given by the `SLANG_MODULE_PATH'
26   environment variable.  Then the search will take place in the path
27   defined by the slang/src/Makefile MODULE_INSTALL_DIR variable.  If
28   the module has not been found along any of these paths, a system
29   dependent search will be performed (e.g., using the `LD_LIBRARY_PATH'
30   environment variable).
31
32Hence, if you are writing a module that will work with all slang
33applications, then module should be installed in the path specified by
34the Makefile variable MODULE_INSTALL_DIR, which by default is
35
36   $(exec_prefix)/lib/slang/v2/modules
37
38for this version of the library.
39
40If the module was sucessfully loaded, the slang library will call the
41function `init_NAME_ns' that NAME-module.so must define.  This
42function must have the prototype:
43
44  int init_NAME_module_ns (char *namespace);
45
46and shall return 0 upon success, or -1 if an error occurred.  The
47namespace argument corresponds to the second (optional) parameter of
48the import intrinsic indicating that the module should be imported
49into the specified namespace.  To this end, the module must call one
50of the SLns_* functions to load intrinsics into the namespace.
51
52****NOTE****
53
54  In order to support the inclusion of the module into more than one
55  namespace, this function may be called multiple times.  Hence, the
56  function should be coded in such a way that initialization code
57  that should execute no more than once does so only once.  See, e.g.,
58  the "register_pcre_type" function in pcre-module.c for an explicit
59  example.
60
61  Module writers are encouraged to supply a script called NAME.sl that
62  looks like:
63
64     import ("NAME");
65     % Optional code...
66     provide ("NAME");
67
68  Then a user would be able to load the module by using, e.g.,
69
70     require ("NAME");
71
72*************
73
74Optionally, the module may define a function called `deinit_NAME_module' that
75will be called by the interpreter to deinitialize the module.  This
76function must have the prototype:
77
78   void deinit_NAME_module (void);
79
80To ensure the correct prototypes for these functions, the module
81should include the line:
82
83    SLANG_MODULE(name);
84
85SLANG_MODULE is a macro that expands into function prototypes.
86
87See the examples in this directory for more information.
88
89To run these modules, use the slsh program in ../slsh/.
90slsh.c is a program that embeds the interpreter and may be used to
91test slang scripts.  In fact, it may be used to create unix executable
92scripts via, e.g.,
93
94#! /usr/bin/env slsh
95
96as the first line of the script.  See ../slsh/scripts subdirectory for
97examples of this approach.
98
99