Hogwarts Wand Docs: ../server/try1cmp

File: ../server/try1cmp

#!/bin/bash
#@DOC@ run fmtb_parse different ways on a file for comparison
#
# Copyright (C) 2006  Nathan (Acorn) Pooley
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License (gpl.txt) for more details. 
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# 
# You can contact the author, Nathan (Acorn) Pooley, by writing
# to Nathan (Acorn) Pooley, 949 Buckeye Drive, Sunnyvale, CA  94086, USA
# or through the form at http://www.rawbw.com/~acorn/wand/feedback.html
# 

_usage() {
    if [[ -n $1 ]] ; then
        echo "$*"
    fi  
    echo "Usage try1cmp <file>"
    echo "Usage try1cmp <file> -t"
    echo "Usage try1cmp <file> <name>"
    echo "   Run fmtb_parse on <file> using various options."
    echo "   Output is places in various files (t1*)."
    echo "   With -t just show tokens"
    echo "   If <name> is provided then it is passed to fmtb_parse as"
    echo "   the name of the spell to check."
    exit 1
}

file="$1"
name="$2"
tok=""

if [[ -z $file ]] ; then
    _usage "Please specify filename"
fi
if [[ ! -f $file ]] ; then
    _usage "File '$file' not found"
fi

if [[ x$name = x-t ]] ; then
    name=""
    tok="-q -t"
fi



echo "Creating t1O..."
fmtb_parse_oldA $tok -c $name < "$file" | sed 's|[^a-zA-Z0-9_ ]\[[0-9;]*m||g' > t1O
echo "Created  t1O  (fmtb_parse_oldA)"
echo "Creating t1o..."
fmtb_parse $tok -c -o $name < "$file" > t1o
echo "Created  t1o  (old algorithm)"
echo "Creating t1M..."
fmtb_parse $tok -c -M $name < "$file" > t1M
echo "Created  t1M  (classic minimal algorithm)"
echo "Creating t1m..."
fmtb_parse $tok -c -m $name < "$file" > t1m
echo "Created  t1m  (minimal algorithm)"
if (( 0 )) ; then
    echo "Creating t1p..."
    fmtb_parse $tok -c -p $name < "$file" > t1p
    echo "Created  t1p  (picsim algorithm)"
fi
echo "Done! - Now mgdiff the above files"

This file Copyright (C) 2006 by Nathan (Acorn) Pooley
Go to TOP Wand page
Go to Acorn's personal webpage
Go to Hogwarts website: www.gotohogwarts.com
Snout: www.snout.org/game
Gadgets of Justice Unlimited
Snout GC (Wiki)
Snout Wiki
File created by do_doc at Wed May 30 03:30:37 PDT 2007