Files
mercury/tools/divide
Zoltan Somogyi 47a1a02a92 Add vim modelines to most tools.
tools/add_cont_lines:
tools/appears:
tools/assemble:
tools/avg_frame_size:
tools/build_srcdist:
tools/cleanint:
tools/compare_frame_sizes:
tools/configure_mingw_cross:
tools/cont:
tools/ctor_rep_stats:
tools/cur_param:
tools/dd_speedtest:
tools/divide:
tools/extract_dd_stats:
tools/file_name_translation_stats:
tools/frame_sizes:
tools/gdbrun:
tools/half:
tools/info_stats.awk:
tools/linear:
tools/lmc.in:
tools/mai_stats:
tools/make_arena:
tools/next_param:
tools/not:
tools/optstages:
tools/type_ctor_stats:
    Add vim mode lines. Replace tabs with spaces.
2021-04-27 03:54:27 +10:00

38 lines
873 B
Bash
Executable File

#!/bin/sh
# vim: ts=4 sw=4 et ft=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
/^MR_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