On Friday 03 November 2006 10:49, Steven T. Hatton wrote:
> On Thursday 02 November 2006 10:14, bertrand greslier wrote:
> > thank for the bash lecon, it is very interresting to discover new
> > function like pushd for me...
>
> Oh should mention, there were a couple of minor problems with the script if
> anybody else happens to try using it.  1 was that somehow I neglected a
> `do' in the semantic.cache line.  If you don't use semantic you won't need
> that anyway.  The other problem was that function fail { echo "Error: $1"
> && exit -1 } should not have all been on the same line.  I tried to pretty
> it up before I sent it, and neglected to test it... which is always a bad
> idea.

Whoops! I forgot the most important item.  My script didn't handle 
OPENTHREAD_EXPORT_DIRECTIVE correctly.  Note the changed sed command.


#!/bin/bash

function fail { 
    echo "Error: $1" && exit -1 
};

[ -n "$OSG" ] || fail "Need to set \$OSG"

TEMP_DIR=$OSG/tmp

[ -e $TEMP_DIR ] || mkdir $TEMP_DIR

[ -d $TEMP_DIR ] || fail "Failed to find or create directory $OSG/tmp"

[ -d $OSG/include ] || fail "Directory $OSG/include does not exist"

for sc in $(find $OSG -name semantic.cache);do rm $sc; done

function traverse {
    pushd $1 > /dev/null
    echo "traversing $PWD"
    local td=$2/$1
    [ -e $td ] || mkdir $td
    [ -d $td ] || fail "Failed to find or create directory $td"

    for d in $(find . -maxdepth 1 -mindepth 1 -type d); do traverse ${d#./} 
$td; done    

    for f in $(find . -maxdepth 1 -mindepth 1 -type f); do
        local tf=$td/${f#./}
        cp ${f#./} $tf;
        [ -f $tf ] || fail "failed to create $tf"
        local gs="";
        gs=$(grep _EXPORT $tf | grep -v \#)
        [ -n "$gs" ] && eval "sed -e 's/[A-Z]*_EXPORT[A-Z_]*//g' $tf > $f";
    done
    
    popd > /dev/null
};

pushd $OSG > /dev/null
traverse include $TEMP_DIR
popd > /dev/null

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to