% babel -exclude-external -server=C file.sidlor use the short form
% babel -E -sC file.sidl
This will create a Makefile frament called babel.make, several C headers and source files. To create a working C implementation, the only files that need to be hand-edited are the C ``Impl'' files (header and source files that end in _Impl.h or _Impl.c. Changes to these files should be made between code splicer pairs. Code splicing is a technique Babel uses to preserve hand-edited code between multiple invocations of Babel. This allows a developer to refine their SIDL file without ruining all their previous implementations. Code between splicer pairs will be retained by subsequent invocations of Babel; code outside splicer pairs is not.
Here is an example of a code splicer pair in C.
/* DO-NOT-DELETE splicer.begin(num.Linsol._includes) */ /* Insert-Code-Here {num.Linsol._includes} (includes and arbitrary code) */ /* DO-NOT-DELETE splicer.end(num.Linsol._includes) */
The following example shows the Babel generate implementation file for the solve example from Section 5.4. The r-array data is presented as double pointers, and the index variables are normal integers.
void impl_num_Linsol_solve(/* in */ num_Linsol self, /* in rarray[m,n] */ double* A, /* inout rarray[n] */ double* x, /* in */ int32_t m, /* in */ int32_t n, /* out */ sidl_BaseInterface *_ex) { *_ex = 0; /* DO-NOT-DELETE splicer.begin(num.Linsol.solve) */ /* Insert-Code-Here {num.Linsol.solve} (solve method) */ /* DO-NOT-DELETE splicer.end(num.Linsol.solve) */ }
The data for the 2-D array A is in column-major order. Use of the RarrayElem2 macro to access A is covered above in Section 6.4.