Recovered from cvs revision 2007-05-01 07:40:00
This commit is contained in:
266
ase/rel/doc.awk
Normal file
266
ase/rel/doc.awk
Normal file
@ -0,0 +1,266 @@
|
||||
/*
|
||||
* $Id: doc.awk,v 1.3 2007/04/30 08:32:40 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
global header, mode;
|
||||
global empty_line_count;
|
||||
global para_started;
|
||||
global list_count;
|
||||
|
||||
func print_text (full)
|
||||
{
|
||||
local fra1, fra2, link, idx, t1, t2;
|
||||
|
||||
gsub ("<", "\\<", full);
|
||||
gsub (">", "\\>", full);
|
||||
|
||||
while (match (full, /\{[^{},]+,[^{},]+\}/) > 0)
|
||||
{
|
||||
fra1 = substr (full, 1, RSTART-1);
|
||||
link = substr (full, RSTART, RLENGTH);
|
||||
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
|
||||
|
||||
idx = index(link, ",");
|
||||
t1 = substr (link, 2, idx-2);
|
||||
t2 = substr (link, idx+1, length(link)-idx-1);
|
||||
|
||||
full = sprintf ("%s<a href='%s'>%s</a>%s", fra1, t2, t1, fra2);
|
||||
}
|
||||
|
||||
while (match (full, /\[\[[^\[\][:space:]]+\]\]/) > 0)
|
||||
{
|
||||
fra1 = substr (full, 1, RSTART-1);
|
||||
link = substr (full, RSTART+2, RLENGTH-4);
|
||||
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
|
||||
|
||||
full = sprintf ("%s<i>%s</i>%s", fra1, link, fra2);
|
||||
}
|
||||
|
||||
while (match (full, /##[^#[:space:]]+##/) > 0)
|
||||
{
|
||||
fra1 = substr (full, 1, RSTART-1);
|
||||
link = substr (full, RSTART+2, RLENGTH-4);
|
||||
fra2 = substr (full, RSTART+RLENGTH, length(full)-RLENGTH);
|
||||
|
||||
full = sprintf ("%s<b>%s</b>%s", fra1, link, fra2);
|
||||
}
|
||||
|
||||
print full;
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
header = 1;
|
||||
mode = 0;
|
||||
empty_line_count = 0;
|
||||
para_started = 0;
|
||||
|
||||
#output=ARGV[0];
|
||||
#gsub (/\.man/, ".html", output);
|
||||
#print "OUTPUT TO: " output;
|
||||
|
||||
print "</html>";
|
||||
print "</head>";
|
||||
print "<meta http-equiv='content-type' content='text/html; charset=UTF-8'>";
|
||||
print "<link href='doc.css' rel='stylesheet' type='text/css' />";
|
||||
}
|
||||
|
||||
header && /^\.[[:alpha:]]+[[:space:]]/ {
|
||||
if ($1 == ".title")
|
||||
{
|
||||
local i;
|
||||
|
||||
printf "<title>";
|
||||
for (i = 2; i <= NF; i++) printf "%s ", $i;
|
||||
print "</title>";
|
||||
}
|
||||
}
|
||||
|
||||
header && !/^\.[[:alpha:]]+[[:space:]]/ {
|
||||
|
||||
header = 0;
|
||||
print "</head>";
|
||||
print "<body>";
|
||||
}
|
||||
|
||||
!header {
|
||||
local text;
|
||||
|
||||
if (mode == 0)
|
||||
{
|
||||
if (/^$/)
|
||||
{
|
||||
# empty line
|
||||
if (para_started)
|
||||
{
|
||||
para_started = 0;
|
||||
print "</p>";
|
||||
}
|
||||
empty_line_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (/^= [^=]+ =$/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
text=substr($0, 2, length($0)-2);
|
||||
print "<h1>" text "</h1>";
|
||||
}
|
||||
else if (/^== [^=]+ ==$/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
text=substr($0, 3, length($0)-4);
|
||||
print "<h2>" text "</h2>";
|
||||
}
|
||||
else if (/^=== [^=]+ ===$/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
text=substr($0, 4, length($0)-6);
|
||||
print "<h3>" text "</h3>";
|
||||
}
|
||||
else if (/^==== [^=]+ ====$/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
text=substr($0, 5, length($0)-8);
|
||||
print "<h4>" text "</h4>";
|
||||
}
|
||||
else if (/^\{\{\{$/)
|
||||
{
|
||||
# {{{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
print "<pre class='code'>";
|
||||
mode = 1;
|
||||
}
|
||||
else if (/\[\[\[/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
print "<ul>";
|
||||
mode = 2;
|
||||
list_count = 0;
|
||||
}
|
||||
else if (/\(\(\(/)
|
||||
{
|
||||
if (para_started)
|
||||
{
|
||||
print "</p>";
|
||||
para_started = 0;
|
||||
}
|
||||
print "<ol>";
|
||||
mode = 3;
|
||||
list_count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!para_started > 0)
|
||||
{
|
||||
print "<p>";
|
||||
para_started = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
gsub ("<", "\\<");
|
||||
gsub (">", "\\>");
|
||||
print $0;
|
||||
*/
|
||||
|
||||
print_text ($0);
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
empty_line_count = 0;
|
||||
}
|
||||
}
|
||||
else if (mode == 1)
|
||||
{
|
||||
if (/^}}}$/)
|
||||
{
|
||||
# }}}
|
||||
print "</pre>";
|
||||
mode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gsub ("<", "\\<");
|
||||
gsub (">", "\\>");
|
||||
print $0;
|
||||
}
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
if (/^]]]$/)
|
||||
{
|
||||
# ]]]
|
||||
print "</li>";
|
||||
print "</ul>";
|
||||
mode = 0;
|
||||
}
|
||||
else if (/^\* [^[:space:]]+/)
|
||||
{
|
||||
gsub ("<", "\\<");
|
||||
gsub (">", "\\>");
|
||||
if (list_count > 0) print "</li>";
|
||||
print "<li>";
|
||||
|
||||
print_text (substr ($0, 3, length($0)-2));
|
||||
list_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_text ($0);
|
||||
}
|
||||
}
|
||||
else if (mode == 3)
|
||||
{
|
||||
if (/^\)\)\)$/)
|
||||
{
|
||||
# )))
|
||||
print "</li>";
|
||||
print "</ol>";
|
||||
mode = 0;
|
||||
}
|
||||
else if (/^\* [^[:space:]]+/)
|
||||
{
|
||||
gsub ("<", "\\<");
|
||||
gsub (">", "\\>");
|
||||
if (list_count > 0) print "</li>";
|
||||
print "<li>";
|
||||
|
||||
print_text (substr ($0, 3, length($0)-2));
|
||||
list_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
print_text ($0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
}
|
21
ase/rel/lic.awk
Normal file
21
ase/rel/lic.awk
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* $Id: lic.awk,v 1.3 2007/04/30 08:32:40 bacon Exp $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
|
||||
NR == 1 {
|
||||
new_file = ARGV[0];
|
||||
printf "" > new_file; /* clear the file */
|
||||
}
|
||||
|
||||
/^ \* \{License\}/ {
|
||||
print " * Copyright (c) 2007, Hyung-Hwan Chung." >> new_file;
|
||||
print " * All rights reserved." >> new_file;
|
||||
print " * Licensed under the BSD license: " >> new_file;
|
||||
print " * http://www.abiyo.net/ase/license.html" >> new_file;
|
||||
}
|
||||
|
||||
!/^ \* \{License\}/ {
|
||||
print $0 >> new_file;
|
||||
}
|
144
ase/rel/rel.sh
Executable file
144
ase/rel/rel.sh
Executable file
@ -0,0 +1,144 @@
|
||||
#!/bin/sh
|
||||
|
||||
finalize ()
|
||||
{
|
||||
cur="$1"; dir="$2";
|
||||
|
||||
if [ "$dir" = "" ]
|
||||
then
|
||||
cd "$BASE"
|
||||
else
|
||||
cd "$BASE/$dir"
|
||||
fi
|
||||
|
||||
for i in *
|
||||
do
|
||||
if [ "$i" = "*" ]; then continue; fi
|
||||
if [ "$i" = "CVS" ]; then continue; fi
|
||||
if [ "$i" = "stx" ]; then continue; fi
|
||||
|
||||
if [ "$cur" = "" ]
|
||||
then
|
||||
file="$i"
|
||||
full="$BASE/$i"
|
||||
else
|
||||
file="$cur/$i"
|
||||
full="$BASE/$cur/$i"
|
||||
fi
|
||||
|
||||
if [ -d "$full" ]
|
||||
then
|
||||
if [ "$dir" = "" ]
|
||||
then
|
||||
new="$i"
|
||||
else
|
||||
new="$dir/$i"
|
||||
fi
|
||||
|
||||
finalize "$file" "$new"
|
||||
cur="$1"; dir="$2";
|
||||
elif [ -f "$full" ]
|
||||
then
|
||||
target="$SOURCE_ROOT/ase"
|
||||
mkdir -p "$target/$cur"
|
||||
|
||||
case "$i" in
|
||||
*.h|*.c|*.cc|*.cpp|*.java|*.awk|*.in)
|
||||
"$ASEAWK" -f "$BASE/rel/lic.awk" -a "$target/$file" "$full"
|
||||
;;
|
||||
*.man)
|
||||
html=`echo $i | sed 's/.man$/.html/'`
|
||||
"$ASEAWK" -f "$BASE/rel/doc.awk" "$full" > "$SOURCE_ROOT/html/$html"
|
||||
"$ASEAWK" -f "$BASE/rel/doc.awk" "$full" > "$ASETGT/$html"
|
||||
cp -f "$full" "$target/$file"
|
||||
;;
|
||||
*.css)
|
||||
cp -f "$full" "$target/$file"
|
||||
cp -f "$full" "$SOURCE_ROOT/html/$i"
|
||||
cp -f "$full" "$ASETGT/$i"
|
||||
;;
|
||||
*.dsp|*.dsw|*.sln|*.vcproj|*.csproj|*.bat|*.cmd)
|
||||
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
|
||||
;;
|
||||
descrip.mms)
|
||||
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
|
||||
;;
|
||||
*.frx)
|
||||
cp -f "$full" "$target/$file"
|
||||
;;
|
||||
*)
|
||||
if [ "$dir" = "test/com" ]
|
||||
then
|
||||
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
|
||||
else
|
||||
cp -f "$full" "$target/$file"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
echo "Usage: $0 awk version target archiver"
|
||||
echo "where awk := full path to aseawk"
|
||||
echo " version := any string"
|
||||
echo " target := full path to the target directory"
|
||||
echo " archiver := gzip | zip"
|
||||
}
|
||||
|
||||
############################
|
||||
# BEGINNING OF THE PROGRAM #
|
||||
############################
|
||||
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
print_usage "$0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$4" != "gzip" -a "$4" != "zip" ]
|
||||
then
|
||||
print_usage "$0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ASEAWK="$1"
|
||||
ASEVER="$2"
|
||||
ASETGT="$3"
|
||||
ASEARC="$4"
|
||||
|
||||
CURDIR=`pwd`
|
||||
cd ".."
|
||||
BASE=`pwd`
|
||||
|
||||
SOURCE_ROOT="$ASETGT/ase-$ASEVER"
|
||||
|
||||
rm -rf "$ASETGT"
|
||||
mkdir -p "$ASETGT"
|
||||
mkdir -p "$SOURCE_ROOT"
|
||||
mkdir -p "$SOURCE_ROOT/html"
|
||||
|
||||
finalize "" ""
|
||||
|
||||
cd "$ASETGT"
|
||||
|
||||
if [ "$ASEARC" = "gzip" ]
|
||||
then
|
||||
tar -cvf "ase-$ASEVER.tar" "ase-$ASEVER"
|
||||
gzip "ase-$ASEVER.tar"
|
||||
mv "ase-$ASEVER.tar.gz" "ase-$ASEVER.tgz"
|
||||
elif [ "$ASEARC" = "zip" ]
|
||||
then
|
||||
ls -l
|
||||
echo zip -r "ase-$ASEVER" "ase-$ASEVER"
|
||||
zip -r ase "ase-$ASEVER"
|
||||
mv -f ase.zip "ase-$ASEVER.zip"
|
||||
fi
|
||||
|
||||
rm -rf "ase-$ASEVER"
|
||||
|
||||
cd "$CURDIR"
|
||||
exit 0
|
2
ase/rel/unix2dos.awk
Normal file
2
ase/rel/unix2dos.awk
Normal file
@ -0,0 +1,2 @@
|
||||
BEGIN { ORS="\r\n"; }
|
||||
{ print $0; }
|
Reference in New Issue
Block a user