3 #if defined(WITH_F77_WRAPPER)
11 #ifdef NEED_F77_UNDERSCORE
12 # define F77_FNAME(fname) fname ## _
14 # define F77_FNAME(fname) fname
17 typedef void (*GraceFortranFunctionType
) (const char *str
, int len
);
18 static GraceFortranFunctionType fortran_error
= (GraceFortranFunctionType
) 0;
20 static void GraceFortranWrapper(const char *str
)
22 if (fortran_error
== (GraceFortranFunctionType
) 0) {
23 fprintf(stderr
, "%s\n", str
);
25 fortran_error(str
, strlen(str
));
29 void F77_FNAME(graceregistererrorfunctionf
) (GraceFortranFunctionType f
)
32 GraceRegisterErrorFunction(GraceFortranWrapper
);
35 int F77_FNAME(graceopenf
) (const int *arg
)
37 return (GraceOpen (*arg
));
40 int F77_FNAME(graceisopenf
) (void)
42 return (GraceIsOpen ());
45 int F77_FNAME(graceclosef
) (void)
47 return (GraceClose ());
50 int F77_FNAME(graceclosepipef
) (void)
52 return (GraceClosePipe());
55 int F77_FNAME(graceflushf
) (void)
57 return (GraceFlush ());
61 int F77_FNAME(gracecommandf
) (const char* arg
, int length
)
66 str
= (char*) malloc ((size_t) (length
+ 1));
68 fprintf (stderr
, "GraceCommandf: Not enough memory\n");
71 strncpy (str
, arg
, length
);
73 res
= GraceCommand (str
);
78 #else /* don't include Fortran wrapper */
80 /* To make ANSI C happy about non-empty file */
81 void F77_FNAME(_gracef_np_c_dummy_func
) (void) {}
83 #endif /* WITH_F77_WRAPPER */