git » fp-git.git » commit 745ceac

added the main indexer script (creates the .h and .dat from the def files)

author ecalot
2004-06-13 06:37:51 UTC
committer ecalot
2004-06-13 06:37:51 UTC
parent ae72c5ebcf0eefb241288873c2bc1f2f1cc1970e

added the main indexer script (creates the .h and .dat from the def files)

stuff/data/makedat +39 -0

diff --git a/stuff/data/makedat b/stuff/data/makedat
new file mode 100755
index 0000000..f8209a9
--- /dev/null
+++ b/stuff/data/makedat
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+NO_COLOR="\033[0m"
+LGREEN="\033[01;32m"
+LRED="\033[01;31m"
+
+SDONE="[$LGREEN Done$NO_COLOR ]"
+SOK="[$LGREEN  OK $NO_COLOR ]"
+SFAIL="[$LRED Fail$NO_COLOR ]"
+
+number=50
+
+#initializes output files
+echo -n "Generating header and xml files            "
+cp -f result/data.h result/data.h.bak 2>/dev/null >/dev/null
+>result/data.h
+cat xml/gen1.xml > xml/resources.xml
+
+#process and add all definitions to the xml and h files
+for definition in `ls def` 
+do
+	bin/makeindex def/$definition index/$definition.index
+	echo "  <item value=\"$number\" path=\"$definition.index\">$definition</item>" >> xml/resources.xml
+	echo "#define $definition $number" >> result/data.h
+	number=`expr $number + 1`
+done
+cat xml/gen2.xml >> xml/resources.xml
+echo -e "$SOK"
+
+#generate the dat file using the proceced indexes and the xml file
+echo -n "Generating dat file                        "
+bin/pr --import=index --force --backup=bak --resource=xml/resources.xml result 2>/dev/null >/dev/null
+result=$?
+
+if [ $result == 0 ] ; then
+	echo -e "$SOK"
+else
+	echo -e "$SFAIL"
+fi