Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- outhtml=utf8_sym16k.html
- outtmp=$(date +%s)".tmp"
- outtext=utf8_pre16k.html
- chx=0
- if [ $# -gt 0 ] ; then
- chx=$(echo "$1 * 256 * 64" | bc);
- outhtml=utf8_sym16k_ofs$chx.html
- outtext=utf8_pre16k_ofs$chx.html
- fi
- modHex=256
- modFF=255
- modZero=0
- dhx=512
- ehx=768
- fhx=1024
- nhx=1023
- mhx=1024
- yhx=$(echo "$chx + 16384" | bc);
- printf "<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\t<head>\n\t\t<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"/>\n\t\t<link rel=\"stylesheet\" href=\"https://area23.at/css/od.css\" />\n\t\t<title>utf-8 symbols</title>\n\t</head>\n" > $outhtml
- printf "\n\t<body>\n\t\t<h1>UTF-8 Symbols</h1>\n" >> $outhtml
- cat $outhtml > $outtext
- while [ $chx -lt $yhx ] ; do
- dhx=$(echo "$chx + 256" | bc);
- ehx=$(echo "$chx + 512" | bc);
- fhx=$(echo "$chx + 768" | bc);
- nhx=$(echo "$chx + 1023" | bc);
- mhx=$(echo "$chx + 1024" | bc);
- modZero=$(echo "$chx % $modHex" | bc)
- if [ $modZero -eq 0 ] ; then
- printf "hex \tx%x \t- \tx%x\tdec \t%d \t- \t%d\n" $chx $nhx $chx $nhx
- printf "\n\t\t<h2>hex x%x - x%x dec %d - %d</h2>\n" $chx $nhx $chx $nhx >> $outhtml
- printf "\n\t\t<h2>hex x%x - x%x dec %d - %d</h2>\n" $chx $nhx $chx $nhx >> $outtext
- printf "\n\t\t<table>\n\t\t\t<tr>\n" >> $outhtml
- printf "\t\t\t\t<td>sym </td>\n\t\t\t\t<td>hex %x</td>\n\t\t\t\t<td>dec %d</td>\n\t\t\t\t<td> </td>\n" $chx $chx >> $outhtml
- printf "\t\t\t\t<td>sym </td>\n\t\t\t\t<td>hex %x</td>\n\t\t\t\t<td>dec %d</td>\n\t\t\t\t<td> </td>\n" $dhx $dhx >> $outhtml
- printf "\t\t\t\t<td>sym </td>\n\t\t\t\t<td>hex %x</td>\n\t\t\t\t<td>dec %d</td>\n\t\t\t\t<td> </td>\n" $ehx $ehx >> $outhtml
- printf "\t\t\t\t<td>sym </td>\n\t\t\t\t<td>hex %x</td>\n\t\t\t\t<td>dec %d</td>\n" $fhx $fhx >> $outhtml
- printf "\t\t\t</tr>\n" >> $outhtml
- printf "\n\t\t<pre>sym \thx x%x\td %d\t \tsym \thx x%x \td %d\tnbsp;" $chx $chx $dhx $dhx >> $outtext
- printf "\tsym \thx x%x\td %d\t \tsym \thx x%x\td %d\n" $ehx $ehx $fhx $fhx >> $outtext
- fi
- printf "\t\t\t<tr>\n" >> $outhtml
- if [ $chx -lt 32 ] ; then
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- else
- printf "\t\t\t\t<td>&#x%x;</td>\n" $chx >> $outhtml
- printf "\t\t\t\t<td>&#x%x;</td>\n" $chx >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $chx >> $outhtml
- fi
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $dhx >> $outhtml
- printf "\t\t\t\t<td>&#x%x;</td>\n" $dhx >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $dhx >> $outhtml
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $ehx >> $outhtml
- printf "\t\t\t\t<td>&#x%x;</td>\n" $ehx >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $ehx >> $outhtml
- printf "\t\t\t\t<td> </td>\n" >> $outhtml
- printf "\t\t\t\t<td>&#x%x;</td>\n" $fhx >> $outhtml
- printf "\t\t\t\t<td>&#x%x;</td>\n" $fhx >> $outhtml
- printf "\t\t\t\t<td>&#%d;</td>\n" $fhx >> $outhtml
- printf "\t\t\t</tr>\n" >> $outhtml
- if [ $chx -lt 32 ] ; then
- printf " \t \t \t " >> $outtext
- else
- printf "&#x%x;\t&#x%x;\t&#%d;\t " $chx $chx $chx >> $outtext
- fi
- printf "\t&#%d;\t&#x%x;\t&#%d;\t " $dhx $dhx $dhx >> $outtext
- printf "\t&#x%x;\t&#x%x;\t&#%d;\t " $ehx $ehx $ehx >> $outtext
- printf "\t&#%d;\t&#x%x;\t&#%d;\n" $fhx $fhx $fhx >> $outtext
- modFF=$(echo "$chx % $modHex" | bc)
- if [ $modFF -eq 255 ] ; then
- printf "\n\t\t</table>\n\t\t<hr />\n" >> $outhtml
- printf "</pre>\n\t\t<hr />\n" >> $outtext
- chx=$(echo "$chx + 768" | bc);
- fi
- chx=$(echo "$chx + 1" | bc);
- done
- printf "\n\t</body>\n</html>\n" >> $outhtml
- printf "\n\t</body>\n</html>\n" >> $outtext
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement