Skip to content

Commit

Permalink
adjust scripts for reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Jan 31, 2014
1 parent 1402b79 commit beb04e2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 39 deletions.
6 changes: 3 additions & 3 deletions run_imp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo ".data" > $2
echo ".align 4" >> $2

cat $2_implist | while read i; do
rm -f tmpsym
rm -f $2_tmpsym
case $i in
__imp_*)
si=`echo $i | cut -c 7-`
Expand All @@ -21,11 +21,11 @@ cat $2_implist | while read i; do
while read f; do
sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'`
if test -n "$sym"; then
echo $sym > tmpsym
echo $sym > $2_tmpsym
break
fi
done
sym=`cat tmpsym`
sym=`cat $2_tmpsym`
if test -z "$sym"; then
echo "no file/sym for $i, lf $f"
exit 1
Expand Down
48 changes: 25 additions & 23 deletions run_mkimpinc.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
#!/bin/sh
set -e

echo -n > $3
echo -n > $1

cat $1 | \
cat $2 | \
while read a; do
a_no_at=`echo $a | awk -F@ '{printf $1}'`
#echo "$a_no_at equ _$a" >> $3
#echo "EXTRN _$a:PROC" >> $3
echo "EXTRN $a:PROC" >> $3
#echo "$a_no_at equ _$a" >> $1
#echo "EXTRN _$a:PROC" >> $1
echo "EXTRN $a:PROC" >> $1
done

echo "; '_' funcs" >> $3
if test -n "$3"; then
echo "; '_' funcs" >> $1

cat $2 | \
while read a; do
case $a in
\#*)
continue
;;
\;*)
continue
;;
"")
continue
;;
*)
;;
esac
cat $3 | \
while read a; do
case $a in
\#*)
continue
;;
\;*)
continue
;;
"")
continue
;;
*)
;;
esac

echo "EXTRN $a:PROC" >> $3
done
echo "EXTRN $a:PROC" >> $1
done
fi
31 changes: 18 additions & 13 deletions run_mkpubinc.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
#!/bin/sh
set -e

echo -n > $3
echo -n > $1

cat $1 | fromdos | sed -e \
'1,/^_rdata.*segment/d;/^_data_last/q;/^[[:blank:];]/d;/^;/d;/^_r\?data\>/d;' | awk '{print $1}' | \
cat $2 | fromdos | sed -e \
'1,/^_rdata.*segment/d;/^_data.*\<ends\>/q;/^[[:blank:];]/d;/^;/d;/^_r\?data\>/d;' | awk '{print $1}' | \
while read a; do
test -z "$a" && continue
case $a in
__IMPORT_DESCRIPTOR*)
continue
;;
_data)
continue
;;
*)
;;
esac

echo "_$a equ $a" >> $3
echo "PUBLIC _$a" >> $3
echo "_$a equ $a" >> $1
echo "PUBLIC _$a" >> $1
done

echo "; funcs called from C" >> $3
if test -n "$3"; then
echo "; funcs called from C" >> $1

cat $2 | \
while read a; do
# echo "_$a equ $a" >> $3
# echo "PUBLIC _$a" >> $3
a=`echo $a | awk -F@ '{print $1}'`
echo "PUBLIC $a" >> $3
done
cat $3 | \
while read a; do
# echo "_$a equ $a" >> $1
# echo "PUBLIC _$a" >> $1
a=`echo $a | awk -F@ '{print $1}'`
echo "PUBLIC $a" >> $1
done
fi

0 comments on commit beb04e2

Please sign in to comment.