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

..03-May-2022-

Makefile.inH A D14-Dec-20051.5 KiB6334

READMEH A D14-Dec-20052.6 KiB8352

aclocal.m4H A D14-Dec-200524 21

configureH A D14-Dec-200536.5 KiB1,158848

configure.inH A D14-Dec-20054.9 KiB169140

square.cH A D14-Dec-20052.7 KiB11864

square.dspH A D14-Dec-20054.5 KiB10892

square.vcprojH A D14-Dec-20054.4 KiB153152

test.tclH A D14-Dec-2005386 226

README

1How to write extensions to Snack
2--------------------------------
3
4You can create custom commands that operate on Snack's sound objects. These new
5commands should be written in C/C++ and can be used just as any other Snack
6sound command. To invoke 'newcommand' on the sound 'snd' you would type:
7
8snd newcommand
9
10Use Snack_AddSubCmd() as shown in the example square.c to associate a new
11command name and a custom C/C++ function.
12
13The preferred way of creating a Snack extension is to link with
14Snack's stub library (unix: libsnackstub2.2.a, win: snackstub22.lib).
15In this way your extension should be usable with different versions of Snack
16without recompilation.
17More general information on stub libraries at http://dev.scriptics.com/doc/tea/
18
19It is also possible to use the old method and link with libsnack.so (HP: .sl).
20On Unix you might also have to set the variable LD_LIBRARY_PATH
21(HP: SHLIB_PATH) to the directory containing the library file. The drawback
22with this method is that you'll have to recompile your extension with each
23new release of Snack and Tcl.
24
25
26
27Building the sample extension on Unix
28-------------------------------------
29
30change directory to the example extension directory (where this README file
31is located)
32
33cd ext/
34
35configure using
36
37./configure
38
39and build with
40
41make
42
43Test it using the test.tcl script. You will probably have to set the
44environment variable LD_LIBRARY_PATH to point to the build directory.
45
46setenv LD_LIBRARY_PATH `pwd`
47
48Run the Snack extension using
49
50./test.tcl
51
52
53
54Building the sample extension on Windows
55----------------------------------------
56
57The Snack MSVC workspace (win/snack.dsw) contains a project for the example
58square extension.  Try the extension using the test.tcl script in ext/.
59
60
61
62Package loading
63----------------------------------------
64
65The demonstration script uses the 'load' command to load the extension.
66Is is also possible to load it in the same manner as the Snack package,
67using a 'package require' command.
68Create a pkgIndex.tcl-file in the same directory as the binary with the
69following statement
70
71package ifneeded square 1.0 [list load [file join $dir libsquare[info sharedlibextension]]]
72
73It is now possible to install your extension as a Tcl package in the same
74way as Snack. Put the library file and the index file in a sibling
75directory to the Snack directory. Use the command 'package require square'.
76On Unix it might be necessary to set the environment variable TCLLIBPATH
77in order for this to work.
78If you just built Snack and the sample extension you use this command
79
80setenv TCLLIBPATH "~/snack2.2.10/unix ~/snack2.2.10/ext $TCLLIBPATH"
81
82Note that the list of directories is space separated.
83