⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex2html.sh

📁 一个用来实现偏微分方程中网格的计算库
💻 SH
字号:
#!/bin/bash# The first argument is the C file name e.g. (ex1.C) which# is going to be converted to html.# The output file name is implied by it.## Use this like this:# arthur(43)$ ./ex2html.sh ../../examples/ex1/ex1.C# or:# arthur(45)$ ./ex2html.sh ../../examples/ex1/ex1.C "make --no-print-directory -C ../../examples/ex1 run"## the latter case also appends the console output generated by the programinput_file=$1;base=`basename $input_file | cut -d"." -f1`;output_file=$base.php;# First we put our special php headings inecho "<?php \$root=\"\"; ?>" > $output_file;echo "<?php require(\$root.\"navigation.php\"); ?>" >> $output_file;echo "<html>" >> $output_file;echo "<head>" >> $output_file;echo "  <?php load_style(\$root); ?>" >> $output_file;echo "</head>" >> $output_file;echo " " >> $output_file;echo "<body>" >> $output_file;echo " " >> $output_file;echo "<?php make_navigation(\"$base\",\$root)?>" >> $output_file;echo " " >> $output_file;echo "<div class=\"content\">" >> $output_file;# First generate the html with the nice comments in it.echo "<a name=\"comments\"></a> "                             >> $output_file;perl program2html.pl $input_file >> $output_file;# Now put some kind of separating messageecho "<a name=\"nocomments\"></a> "                           >> $output_file;echo "<br><br><br> <h1> The program without comments: </h1> " >> $output_file;# Now bust out the magic.  We are going to use# two perl scripts and enscript to get sweet looking# C code into our html.perl stripcomments.pl $input_file | enscript -q --header="" --pretty-print=cpp --color --title="" --language=html --output=- | perl stripenscript.pl >> $output_file;# Now run the example and redirect stdout into the fileif test $# -gt 1; then    echo "<a name=\"output\"></a> "                           >> $output_file;    echo "<br><br><br> <h1> The console output of the program: </h1> " >> $output_file;    echo "<pre>" >> $output_file;    $2 >> $output_file 2>&1;    echo "</pre>" >> $output_file;fi;# Now put our special php footer inecho "</div>" >> $output_file;echo "<?php make_footer() ?>" >> $output_file;echo "</body>" >> $output_file;echo "</html>" >> $output_file;# Put in a few emacs comments to force syntax highlightingecho "<?php if (0) { ?>" >> $output_file;echo "\#Local Variables:" >> $output_file;echo "\#mode: html" >> $output_file;echo "\#End:" >> $output_file;echo "<?php } ?>" >> $output_file;# Finally, move the output_file to the html directorymv $output_file ../../doc/html# Local Variables:# mode: shell-script# End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -