#!/bin/bash

set -x

ocamlsrc=/usr/local/src/ocaml-3.09.3
pwd=$(pwd)


pushd $ocamlsrc/byterun

gcc -DCAML_NAME_SPACE -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -E -o minor_gc.i minor_gc.c

$pwd/../../elsa/ccparse -tr c_lang -oc $pwd/minor_gc.oast minor_gc.i

popd

../ast_graph minor_gc.oast -o minor_gc.dot

# make a layout and get the coordinates
# 
# dot -v minor_gc.dot -o minor_gc_layout.dot
#
#add a page attribute to minor_gc_layout.dot
#
# page="240,70";
#
# generate ps
#
# neato -v -Tps minor_gc_layout.dot -o minor_gc.ps
#
#separate the last but one page
#
#import into gimp
#crop the interesting part
#store as minor_gc-detail.png
#shrink to 2000 pixels, store as minor_gc-detail-small.png
#
#add the frame with
#convert -bordercolor blue -border 5 -bordercolor white -border 50 minor_gc-detail-small.png minor_gc-detail-small-border.png

