i wrote:
> the script i'm using is attached. comments/corrections welcome, of course.
the list apparently didn't like the script as an attachment. here:
#!/bin/sh
# Copyright 2010 One Laptop per Child
# License information below.
# produce a listing of the code and initialized constant sizes
# for the all the obj/*.rel files produced by sdcc.
# requires dc, xargs, cut, sed.
me=${0##*/}
tmpfile="/tmp/$me.$$"
trap "rm -f $tmpfile" 0
main()
{
pwd
date
printf " %27s %7s %7s %7s %7s\n" code const xdata data bit
listsizes | tee $tmpfile
echo
echo "-- totals (no libraries) --------"
echo -n "code:\t"
sumcol 2 < $tmpfile
echo -n "const:\t"
sumcol 3 < $tmpfile
echo -n "xdata:\t"
sumcol 4 < $tmpfile
echo -n "data:\t"
sumcol 5 < $tmpfile
echo -n "bits:\t"
sumcol 6 < $tmpfile
}
listsizes()
{
for x in obj/*.rel
do
(
echo $x:
(
egrep 'CSEG' $x;
egrep 'CONST' $x;
egrep 'XSEG' $x;
egrep 'DSEG' $x;
egrep 'BSEG' $x;
)|
sed -e 's/A //' \
-e 's/size //' \
-e 's/ flags.*//' \
-e 's/[CDXB]SEG\|CONST//' \
-e 's/[0-9A-F]\+/0x&/g'
) |
xargs -n 6 printf "%-20s %7d %7d %7d %7d %7d\n"
done
}
# tally the Nth field of the input
sumcol()
{
awk '
BEGIN { total = 0; }
{ total += $'$1'}
END { print total; }
'
}
main
exit
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
As a special exception, you may use this file as part of a free software
library for the XO of the One Laptop per Child project without restriction.
Specifically, if other files instantiate
templates or use macros or inline functions from this file, or you compile
this file and link it with other files to produce an executable, this
file does not by itself cause the resulting executable to be covered by
the GNU General Public License. This exception does not however
invalidate any other reasons why the executable file might be covered by
the GNU General Public License.
=---------------------
paul fox, [email protected]
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user