This file is indexed.

/usr/share/doc/libcnf-dev/html/node64.html is in libcnf-dev 4.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Rationale for Mixed Language Programming</TITLE>
<META NAME="description" CONTENT="Rationale for Mixed Language Programming">
<META NAME="keywords" CONTENT="sun209">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="sun209.css">
<LINK REL="next" HREF="node65.html">
<LINK REL="previous" HREF="node45.html">
<LINK REL="up" HREF="sun209.html">
<LINK REL="next" HREF="node65.html">
</HEAD>
<BODY >
<BR> <HR>
<A NAME="tex2html880"
 HREF="node65.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
<A NAME="tex2html878"
 HREF="sun209.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
<A NAME="tex2html872"
 HREF="node63.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A>   <A HREF="sun209.html#stardoccontents"><IMG
 ALIGN="BOTTOM" BORDER="0" SRC="contents_motif.gif"
 ALT="252"></A>
<BR>
<B> Next:</B> <A NAME="tex2html881"
 HREF="node65.html">Alphabetical List of F77 Macros</A>
<BR>
<B>Up:</B> <A NAME="tex2html879"
 HREF="sun209.html">CNF and F77 Mixed Language Programming - FORTRAN and C</A>
<BR>
<B> Previous:</B> <A NAME="tex2html873"
 HREF="node63.html">Other Operating Systems</A>
<BR> <HR> <P>

<!--End of Navigation Panel-->

<H1><A NAME="SECTION000160000000000000000"></A><A NAME="xref_rationale_for_mixed_language_programming"></A><A NAME="rationale"></A>
<BR>
Rationale for Mixed Language Programming
</H1>
Starlink has historically been a ``FORTRAN only'' project. There are several
reasons for this. Primarily it is because scientists have been brought up with
FORTRAN and for most purposes it is perfectly adequate for our needs. However,
there are some tasks for which FORTRAN is not really suitable. In such
situations it may be better to write programs in a language other than FORTRAN,
rather than try to persuade FORTRAN to do something that it is not suited to.
Writing recursive procedures is the classic example, but there are many more.
Starlink has recognised the need for a language other than FORTRAN by providing
C compilers at all Starlink nodes. 

<P>
There are in fact good reasons to avoid diversifying into trendy new languages
unless it is absolutely necessary. Any substantial piece of software will
require someone to support it long after the original author has moved on to
other things and it is not reasonable to expect that person to have expertise
in a large number of programming languages. However, for some purposes, FORTRAN
77 is simply not adequate. In fact some major parts of Starlink software have
been written in other languages because of this. 
<A HREF="/star/docs/sun92.htx/sun92.html#xref_">HDS.</A> 
is written in C (it was originally written in Bliss, in the days when even C 
was impractical because of restrictions in the early compilers).
In the future, FORTRAN&nbsp;90 will overcome many of the limitations that 
FORTRAN&nbsp;77 has but, until that becomes readily available (and even after), 
some things are simply better written in C.

<P>
It is often the case that most of a program can be written in FORTRAN, leaving
only a few tricky parts that cannot be written using standard (or even non
standard) FORTRAN. An example of a task that cannot be performed using 
standard FORTRAN is getting some memory for use in your program. 
Admittedly, there are often system service subroutines available but these are
virtually guaranteed to be non portable to other computers.
Often a better approach is to write the tricky parts in C. This is exactly the
approach that has been adopted for HDS.
The problem then is how to pass data between FORTRAN routines and C functions.
This document will describe  how to do this. 
Clearly the details of passing information between program segments
written in different languages will be machine dependent; however, there are
also many important similarities. Despite any problems that may arise, it is
easier to port programs written in a mixture of FORTRAN and C to other computer
systems than to port programs written purely in FORTRAN that make use of
machine-specific routines for system services. 

<P>
How to mix FORTRAN and C in a way that is portable to all current Starlink 
hardware is described in
<A HREF="node18.html#f77_cfromf">More on Calling C from FORTRAN</A>
and
<A HREF="node36.html#f77_ffromc">More on Calling FORTRAN from C</A>. 

<P>
It is quite likely that you will often want to use C to make use of something
that the C run time library provides, such as allocating memory. This
requirement is sufficiently common that a library of FORTRAN callable routines
has already been provided to do exactly that. 
It is called PSX and is described in 
<A HREF="/star/docs/sun121.htx/sun121.html#xref_">SUN/121</A>. 
In many programs, use of the PSX library will remove the need to write any C 
code at all.

<P>
You may think that if you want to use C for part of a program then you should
use C for all of the program. This may indeed be the best option; however, if
you also want to call subroutines that are written in FORTRAN (<EM>e.g.</EM> 
just about any Starlink library), then you are going to be involved in mixed 
language programming anyway. 
The correct choice will depend on the circumstances.

<P>
Writing mixed language programs is not something that should be embarked upon
lightly. There might be a better way of achieving the same result using just
FORTRAN. 
The source code may not look as pretty, but if it runs effectively and
efficiently then that is all that is required. If you can achieve what you want
using standard FORTRAN then you should do so. If you cannot, then this document
will tell you how to mix FORTRAN and C <I>in a portable way</I>. 
The programming language manuals of the computer manufacturers tell you how to 
mix languages on their own hardware, but achieving portability needs a little 
more thought.

<P>
Finally, if you are new to C, you should be aware that the way that things are
normally done in C can be rather different from the way that they are normally
done in FORTRAN. When I was new to C, I proudly showed someone one of my first
C programs. ``That's not a C program,'' they said,  ``That's a FORTRAN program
that's written in C.'' They were, of course, right. A useful book an C
programming is Banahan [<A
 HREF="node189.html#Banahan">3</A>]. This describes how to write programs in
ANSI standard C and is written in an easy-going style. The author is not averse
to criticizing C when he thinks that a feature of the language is not
appropriate.

<P>

<P>
<BR> <HR>
<A NAME="tex2html880"
 HREF="node65.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
<A NAME="tex2html878"
 HREF="sun209.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
<A NAME="tex2html872"
 HREF="node63.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A>   <A HREF="sun209.html#stardoccontents"><IMG
 ALIGN="BOTTOM" BORDER="0" SRC="contents_motif.gif"
 ALT="252"></A>
<BR>
<B> Next:</B> <A NAME="tex2html881"
 HREF="node65.html">Alphabetical List of F77 Macros</A>
<BR>
<B>Up:</B> <A NAME="tex2html879"
 HREF="sun209.html">CNF and F77 Mixed Language Programming - FORTRAN and C</A>
<BR>
<B> Previous:</B> <A NAME="tex2html873"
 HREF="node63.html">Other Operating Systems</A>
<BR> <HR> <P>

<!--End of Navigation Panel-->
<ADDRESS>
<I>CNF and F77 Mixed Language Programming -- FORTRAN and C<BR>Starlink User Note 209<BR>P.M. Allan<BR>A.J. Chipperfield<BR>R.F. Warren-Smith<BR>19 January 2000<BR>E-mail:<A HREF="mailto:ussc@star.rl.ac.uk">ussc@star.rl.ac.uk</A></I>
</ADDRESS>
</BODY>
</HTML>