As can be seen in the above example, EXTRACT lines are hidden from the FORTRAN compiler by adding the leading comment character `*'. In fact EXTRACT can use any of the following comment prefixes:-
Prefix Language
* Fortran
/* C (adds */ at end of line if required)
; VAX MACRO
! VAX DCL
# UNIX script (see LEADING_SOURCE in next section)
% TEX or LATEX
so that a file can freely mix modules containing source in all these
languages. For simplicity this document will assume the language FORTRAN but
could equally well refer to /*FILE lines or !IF lines.
If using EXTRACT with C, there are a couple of points to watch:-
#include <stdio.h>
into thinking that the delimitor is #).
Here is a sample C program:-
*FILE MEMBER=CDHSTC LIBRARY=SNOMAN LANGUAGE=C DATE=03:May:1996 */
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
#define MAXHOST 8
/*IF UNIX */
/*IF APOLLO */
/*$int cdhstc(hnf) */
/*ELSE */
int cdhstc_(hnf)
/*ENDIF */
char *hnf;
{
int i = MAXHOST;
struct utsname u;
char q[MAXHOST+1];
if (uname(&u) < 0) return(-1);
sprintf(q,"%-*s",MAXHOST,u.nodename);
strncpy(hnf,q,i);
return(0);
}
/*ENDIF */
/*ENDFILE MEMBER=CDHSTC */