ABSTRACT

Recently the COSY system [I, 2. 3, 4, 5, 6] has been ported to a language independent platfonn to accommodate the use in various modern and widely used programming environments. ln particular, the languages supported include FORTRAN 77, C, as well as the object oriented environments of FORTRAN 90 and C++. This is achieved in the following way. The original FORTRAN 77 based language environment consists mainly of operations on a suite of COSY objects. most notably the DA (Differential Algebra) objects that have proven very useful for beam physics purposes [7]. These objects can traditionally be utilized either within the environment of a FORTRAN precompiler[8, 9, 10], or within the object oriented language environment of the COSY scripting tool[ I], which will be discussed in detail below. Support in the C world is achieved by the use of a FORTRAN-to-e precompiler. and the FORTRAN source has been adjusted to achieve reliable cross-compilation to the C environment that results in efficient code. To assure future reliability and reproducibility of this porting operation, the C source code ofthe cross-complier is maintained together with the FORTRAN package. The use within C++ and FORTRAN90 are achieved by a suite of light wrappers providing C++ and FORTRAN90 objects for the COSY objects [II]. Great care is taken to maintain the high performance of these data types, which is achieved by merely representing the objects via pointers into COSY's original memory management system. Altogether this approach allows the rendering of COSY objects in four different language environments, while developers need only to write and maintain the FORTRAN 77 based source code in COSY.