File: README

package info (click to toggle)
snack 2.2.10-dfsg1-12.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,024 kB
  • sloc: ansic: 35,473; sh: 8,557; tcl: 1,065; python: 701; makefile: 565
file content (82 lines) | stat: -rw-r--r-- 2,684 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
How to write extensions to Snack
--------------------------------

You can create custom commands that operate on Snack's sound objects. These new
commands should be written in C/C++ and can be used just as any other Snack
sound command. To invoke 'newcommand' on the sound 'snd' you would type:

snd newcommand

Use Snack_AddSubCmd() as shown in the example square.c to associate a new
command name and a custom C/C++ function.

The preferred way of creating a Snack extension is to link with
Snack's stub library (unix: libsnackstub2.2.a, win: snackstub22.lib).
In this way your extension should be usable with different versions of Snack
without recompilation.
More general information on stub libraries at http://dev.scriptics.com/doc/tea/

It is also possible to use the old method and link with libsnack.so (HP: .sl).
On Unix you might also have to set the variable LD_LIBRARY_PATH
(HP: SHLIB_PATH) to the directory containing the library file. The drawback
with this method is that you'll have to recompile your extension with each
new release of Snack and Tcl.



Building the sample extension on Unix
-------------------------------------

change directory to the example extension directory (where this README file
is located)

cd ext/

configure using

./configure

and build with

make

Test it using the test.tcl script. You will probably have to set the
environment variable LD_LIBRARY_PATH to point to the build directory.

setenv LD_LIBRARY_PATH `pwd`

Run the Snack extension using

./test.tcl



Building the sample extension on Windows
----------------------------------------

The Snack MSVC workspace (win/snack.dsw) contains a project for the example
square extension.  Try the extension using the test.tcl script in ext/.



Package loading
----------------------------------------

The demonstration script uses the 'load' command to load the extension.
Is is also possible to load it in the same manner as the Snack package,
using a 'package require' command.
Create a pkgIndex.tcl-file in the same directory as the binary with the
following statement

package ifneeded square 1.0 [list load [file join $dir libsquare[info sharedlibextension]]]

It is now possible to install your extension as a Tcl package in the same
way as Snack. Put the library file and the index file in a sibling 
directory to the Snack directory. Use the command 'package require square'.
On Unix it might be necessary to set the environment variable TCLLIBPATH
in order for this to work.
If you just built Snack and the sample extension you use this command

setenv TCLLIBPATH "~/snack2.2.10/unix ~/snack2.2.10/ext $TCLLIBPATH"

Note that the list of directories is space separated.