% babel -server=C file.sidlor use the short form
% babel -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) */ /* Put additional includes or other arbitrary code here... */ /* 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*/ double* A, /*inout*/ double* x, /*in*/ double* b, /*in*/ int32_t m, /*in*/ int32_t n) { /* DO-NOT-DELETE splicer.begin(num.Linsol.solve) */ /* Insert the implementation of the solve method here... */ /* 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.