url="http://www.xml-x.org/errors.html" copyright="Copyright (c) 2000-2005 XML-X group" date=$(date) root="XE" input="${root}.txt" header1="Listing of Errors as returned in ErrorResponse" # . functions.sh stuff() { echo " * "; echo " * DO NOT EDIT THIS FILE. See source file below."; echo " * "; echo " * @See ${url}" echo " * @date ${date}" echo " * @file ${input}" echo " * @author $0" echo " * @copy ${copyright}" } ################ PHP ############################# start_php() { echo " \"server is buggy, returned -1\"," } comment_php() { int=$1; word=$2; comment="$3" com="" case "${int}" in '') echo "" ;; "#"*) echo "$1 $2 $3" ;; "//"*) echo "$1 $2 $3" ;; *) if [ "${comment}" != "" ] then echo " $int => \"${comment}\"," fi ;; esac } end_php() { echo ");" echo "" echo "function getErrorString(\$e) { global \$errors; return \$errors[\$e]; }" echo "" echo "?>" } ################ GET TEXT PO ############################# start_po() { echo "#######################################################" echo "##" echo "## XML-X errors" echo "## @See ${url}" echo "## @date ${date}" echo "## @file ${input}" echo "## @author $0" echo "## @copy ${copyright}" echo "##" echo "" } make_po() { int=$1; word=$2; comment="$3" com="" case "${int}" in '') echo "#" ;; "#"*) echo "$1 $2 $3" ;; "//"*) echo "# $1 $2 $3" ;; *) echo "msgid \"${comment}\"" echo "msgstr \"\"" echo "" ;; esac } pause_po() { : } comment_po() { : } end_po() { echo "##" echo "## END - XML-X errors" echo "##" echo "#######################################################" } ################ HTML ############################# start_html() { title="XML-X Errors - ${root}" echo "${title}" echo "" echo "

${title}

" echo "
"
    java_style_comment $1
    echo "
" echo "" echo "" echo " " echo " " echo " " echo " " echo " " echo "" # make_html "-1" UNKNOWN "anything negative is a bug" } e="" j="$e$e" ;; *) if [ "${comment}" = "" ] then com=" " else com="$comment" fi echo "" ;; esac } pause_html() { echo "" echo "
ErrnoIdText
" make_html() { int=$1; word=$2; comment="$3" com="" case "${int}" in '') echo "" ;; "//"*|"#"*) echo "
$1 $2 $3
${int}${j}${word}${j}${com}
" } comment_html() { : } end_html() { echo "" echo "" } ################ JAVA ############################# java_style_comment() { echo "/**" echo " * $1" echo " * Listing of Errors as returned in ErrorResponse" stuff echo " */" echo } make_java() { int=$1; word=$2; comment="$3" com="" case "${int}" in '') echo "";; "#"*) echo " // $1 $2 $3" ;; "//"*) echo " $1 $2 $3" ;; *) [ "${comment}" = "" ] || com=" // $comment" echo " $word = $int,${com}" ;; esac } start_java() { echo "package webfunds.xmlx;"; echo "" java_style_comment $1 echo echo "public class ${root}" echo "{" echo "" echo " public static final int" echo "" } pause_java() { # echo " UNKNOWN = -1; // anything negative is buggy" echo " JUNK_FIX_ME = -1; // bug in generation script" echo "" } comment_java() { : } end_java() { echo "}" } list="po php java html" for language in $list do file=${root}.${language} { start_${language} ${file} while read int word comment do make_${language} $int $word "$comment" done < ${input} pause_${language} ${file} while read int word comment do comment_${language} $int $word "$comment" done < ${input} end_${language} } > ${file} ls -l ${file} done