mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 10:23:46 +00:00
Estimated hours taken: 1 <overview or general description of changes> <directory>/<file>: <detailed description of changes>
37 lines
814 B
Bash
Executable File
37 lines
814 B
Bash
Executable File
#!/bin/sh
|
|
# Given the name of a C source file generated by the Mercury compiler,
|
|
# and a count of the number of the number of modules in it (say N),
|
|
# generate N+1 files named $filename.part.{0,1,...N}.
|
|
#
|
|
# $filename.part.N will contain the module initialization stuff from the
|
|
# of the source file; the other files will contain a module each. Any stuff
|
|
# before the first module will be in $filename.part.0.
|
|
#
|
|
# Since divide can take a long time, it prints messages saying which part
|
|
# it is up to.
|
|
|
|
if test $# != 2
|
|
then
|
|
echo "Usage: divide filename module_count"
|
|
exit 1
|
|
fi
|
|
|
|
TERMCAP=/etc/termcap; export TERMCAP
|
|
cp $1 tmp
|
|
|
|
i=0
|
|
while test $i -lt $2
|
|
do
|
|
ed - tmp > /dev/null << END
|
|
/^END_MODULE/
|
|
1,.w $1.part.$i
|
|
1,.d
|
|
w
|
|
q
|
|
END
|
|
echo done part $i
|
|
i=`expr $i + 1`
|
|
done
|
|
mv tmp $1.part.$i
|
|
echo done final part $i
|