# SED script applied to C files generated by CAMLIDL
#
# 1. Insert a comment after first line
#
1 a\\n/* This file is part of the MLGmpIDL interface, released under LGPL license.\n   Please read the COPYING file packaged in the distribution  */
#
# 2. Subtle trick: when encountering a variable named OUTOUTOUTT,
# (which represent an out paramater)
# substitute to the declaration: mpz_ptr OUTOUTOUT; 
# the declarations: mpz_t OUTOUTOUT; mpz_ptr OUTTOUTTOUTT=OUTOUTOUT
#
s/\([^ ]*\)_ptr OUTOUTOUT/\1_t OUTOUTOUT\; \1_ptr OUTTOUTTOUTT = OUTOUTOUT;/g;
#
# this is because mpz_ptr does not allocate the stack space 
# needed for the mpz_t to be returned.
#
# 3.Substitution when calling camlidl_c2ml_mpz_mpz_ptr
#
s/(&OUTOUTOUT/(\&OUTTOUTTOUTT/g;  
s/struct mpfr_rnd_t/mpfr_rnd_t/g;
