echo "/* Do not edit this file it is automatically generated by */"
echo "/* $AUBITDIR/lib/bin/mk_convertsql */"
echo " "

echo "static char *cvsql_names[] = {"
cat $1 | ( while read a b
do
	if [ "$a" = "" ]
	then 
		continue
	fi
        echo "   \"CVSQL_$a\","
done)
echo "\"ENDOFLIST\""
echo "};"

echo " "
echo " "
echo "enum cvsql_type {"
cat $1 | (while read a b
do
	if [ "$a" = "" ]
	then 
		continue
	fi
	echo "   CVSQL_$a,"
done)
echo "ENDOFLIST"
echo "};"

echo " "
echo " "
echo "char *cvsql_description[]= {"

cat $1 | (while read a b
do
	if [ "$a" = "" ]
	then 
		continue
	fi
	b=`echo "$b" | sed 's/"/\\\\"/g'`
	echo "   \"$b\","
done)
echo "\"ENDOFLIST\""
echo "};"



echo " "

echo " "

echo "static int A4GL_cv_str_to_func (char *p, int len,int warnifnotfound)"
echo "{"

cat $1 | (while read a b
do
	if [ "$a" = "" ]
	then 
		continue
	fi
	echo "if (match_strncasecmp (p, \"$a\", len) == 0)"
	echo "   return CVSQL_$a;"

done)

echo " "
echo " "
echo "// If we've not matched it - it must be something new"
echo "#ifdef DEBUG"
echo "  A4GL_debug (\"NOT IMPLEMENTED: %s\", p);"
echo "#endif"
echo "  if (warnifnotfound) {"
echo "                PRINTF (\"Unknown : %s%c\", p,10);"
echo "        }"
echo "  return 0;"
echo "}"

