Version 11 of tclxosd

Updated 2009-02-06 03:41:30 by kdl
What: tclxosd
Where: http://sourceforge.net/projects/tclxosd/
       http://www.ignavus.net/software.html
Description: Tcl bindings for libxosd (On Screen Display)
Updated: 12/2008
Contact: See in tclxosd package

AMG: I like the configure script. ;^) It starts out as a shell script then transforms into a Tcl script. Here's an excerpt:

#!/bin/sh
# \
TCL_NAME=tclsh;\
FIND_PATH=`echo -n $PATH | sed 's|:| |g' | tail -n 1`; \
TCL_SHELL=`find $FIND_PATH -name $TCL_NAME -ignore_readdir_race`
#\
echo -n "checking for tclsh... "
# ... *snip* ...\
# give control to tclsh\
exec tclsh "$0" "$@"
puts -nonewline "cheking for libdl... "

kdl: This is my first extension for Tcl, so not be very strict. Configure script liked me too :), but it is not versatile, I think. Any suggestions are wellcome. I have a question about interface - in version 0.1 of tclxosd we have:

set osd [xosd::create]
xosd::display $osd 0 XOSD_string {text to display}

Would it better to make "osd-command" (as in image) ?:

xosd::create osd1
$osd1 set_align XOSD_left
$osd1 display 0 XOSD_string {text to display}

AMG: It's up to you. Both approaches are widely used in extensions and the Tcl core. I guess it comes down to whether you prefer to put the subject before or after the verb. :^)

However, I do recommend against having xosd::create write the command name into a variable. Instead have it return the command name. Let the caller worry about writing it into a variable with set. You could make it take the name of the command to create, but if you do, please make it an optional argument. If a name is not supplied, have it pick a unique name.

Hey, I have a question. Why do all the "enumerated" options have XOSD_ prefixes? This isn't C; there is no reason to worry about symbolic constants polluting the namespace. I suggest dropping them or making them optional.

kdl: Thank you for observations, Andy. XOSD_ prefixes leaved in extension for compatibility with libxosd syntax, maybe for somebody this more clearly. Perhaps, separation of commands will be good solution:

xosd::set_pos_top $osd
xosd::set_align_center $osd
xosd::display_string $osd $line_number {text to display}
xosd::display_slider $osd $line_number 60