Much of the information from the previous section is pertinent to implementing a SIDL class in FORTRAN 77. The types of the arguments are as indicated in Table 8.1. Your implementation can call other SIDL methods in which case follow the rules for client calls.
You should invoke Babel:
% babel -server=f77 file.sidlor simply
% babel -s=f77 file.sidl
This will create a babel.make, numerous C headers, numerous C source files and some FORTRAN 77 source files. Your job is to fill in the FORTRAN 77 source files with the implementation of the methods. The files you need to edit all end with _Impl.f. All your changes to the file should be made between code splicer pairs. 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 this example, you would replace the line "C Insert extra code here... " with your lines of code.
C DO-NOT-DELETE splicer.begin(_miscellaneous_code_start) C Insert extra code here... C DO-NOT-DELETE splicer.end(_miscellaneous_code_start)
Each _Impl.f file contains numerous empty subroutines. Each subroutine that you must implement is partially implemented. The SUBROUTINE statement is written, and the types of the arguments have been declared. You must provide the body of each subroutine that implements the expected behavior of the method.
There are two implicit methods (i.e. methods that did not appear in the SIDL file) that must also be implemented. The _ctor() method is a constructor function that is run whenever an object is created. It's purpose is to initialize the object to make it ready for any of the other method calls. The _dtor() method is a destructor function that is run whenever an object is destroyed. The destructor's purpose is to free any resources allocated by the object. If the object has no state, these functions are typically empty.
The SIDL IOR keeps a pointer (i.e. C void *) for each object that is intended to hold a pointer to the object's internal data. The FORTRAN 77 skeleton provides two functions that the FORTRAN 77 developer will need to use to access the private pointer. The name of the function is derived from the fully qualified type name as follows. Replace periods with underscores and append __get_data_f or __set_data_f. The first argument is the object pointer (i.e. self), and the second argument is an opaque . These arguments are 64 bit integers in FORTRAN 77, but the number of bits actually stored by the IOR is determined by the sizeof(void *).
Babel/SIDL does not provide a low level mechanism for FORTRAN 77 to allocate memory to use for the private data pointer; however, there is an example of a FORTRAN 77 object with state in Section 8.8.