[PD-dev] Work on "help" menu and help-patch searching spec

B. Bogart ben at ekran.org
Wed May 4 21:12:38 CEST 2005


Hey Krzysztof,

Thanks for contributing this.

Maybe I'm just too tired but I'm having trouble imagining the structure
of the index file. something like:

counter-help.pd control sound

Could put the counter-help in both the control and sound catagories?

Any developer added catagories would be automagically added to the list?

I was thinking that a short description of each entry (help-file) would
be very handy to show when searching. Since the name of the object/extra
  may not be meaningful. So lets say we have DESCRIPTION KEYWORDS
CATAGORY in the template. The patch parsing script could:
(in sketchy pseudo 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 $w.menu.$catagory
   $w.menu add cascade -label $catagory -menu $w.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.

Anyhow its just a sketch of how things could work. I've put this on the
wiki: https://puredata.org/Members/bbogart/SimpleImplimentation

I agree with HC that we should only depend on tcl/tk for the searching
system.

B.

Hans-Christoph Steiner wrote:
>
> On Apr 27, 2005, at 4:46 AM, Krzysztof Czaja wrote:
>
>> Hans-Christoph Steiner wrote:
>> ...
>>
>>> A simple set of keywords would be easiest to implement to start
>>> with.    Then we can test the basic idea out, and see whether its
>>> worthwhile  to  invest a lot of time coding an dynamic, flexible
>>> keyword system.
>>
>>
>> dynamic is easier...  in tcl it could be
>>
>> while {[gets $ch line] >= 0} {
>>   if {[regexp $skipbadentries $line] == 0} { ;# for safety
>>     set helpfile [lindex $line 0]
>>     foreach c [lrange $line 1 end] {
>>       lappend categories($c) $helpfile
>>     }
>>   }
>> }
>>
>> which might be fed by
>>
>> find . -name "*-help.pd" -exec awk \
>>  '/KEYWORDS/ {print FILENAME substr($0,index($0,"KEYWORDS")+9)}' {} \;
>>
>> Krzysztof
>>
>
> Looks good, except find and awk are not standard on Windows.  If we are
> doing to make a dynamic system, it should be dynamic at run time, not
> just build time.  It should run whenever Pd starts so that user-added
> patches are also included.
>
> And I don't think we want to start making Pd dependent on find and awk.
>
> .hc
>
> ________________________________________________________________________
> ____
>
> "Information wants to be free."
>                              -Stewart Brand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20050504/078fbed0/attachment.pgp>


More information about the Pd-dev mailing list