Personal tools
You are here: Home development PDDP simple implimentation

Here is an ugly hackish partcial implimentation of the help menu, searching, and *-help.pd parsing in tcl

set path /extra/ # all libs and all *-help.pd files should be here.
cd $path
set help_files [glob *-help.pd] # list -help files.
set help_index 0
foreach help_file $help_files {
  set FILENAME($help_index) $help_file
  set id [open $help_file r]
  set help_contents [read $id]
  close $id

  foreach help_line [split $help_contents "\n"] { # loop over lines
    foreach help_feild [list DESCRIPTION KEYWORDS CATAGORY]
      if ($help_line contains $help_feild) {
        # Extract from $help_feild to ";" put in variable value

        # Create a different array for each feild
        set $help_feild($help_index) $value

  incr help_index

  # generate index file (is this needed if we rebuild on PD start?)

# The searching could look something like:

# the forloop could be changed for the array searching functions
for {set i 0} {$i < [array size KEYWORDS]} {incr i} {
  if {[string match -nocase $KEYWORDS($i) $keyword_search]} {
    # create a nice output list of matches
    $w.listbox insert end "$FILENAME($i)\t$DESCRIPTION($i)"

# Generating the help menu could contain something like:

# generate list of unique catagories
foreach catagory $catagories {
  # generate list of help files for this catagory in $$catagory
  $ add cascade -label $catagory -menu $$catagory

Notes: -help files COULD be also PDDP all_about_* patches. Any patches in the correct folder(s) with the right feilds would be searchable.

The code above depends on each -help file containing all three Feilds.

Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser