00001 #include <stdio.h>
00002 #include <ctype.h>
00003 #include <string.h>
00004 #include "../fortran_macros.h"
00005
00006 static int check_args(int *arg1, char *arg2, int *arg3, int len)
00007 {
00008 int n, err = 0;
00009
00010
00011
00012 if (*arg1 != 1) {
00013 printf ("first argument is %d and should be 1\n", *arg1);
00014 err++;
00015 }
00016
00017
00018
00019 if (strncmp (arg2, "string", 6)) {
00020 printf ("second argument is ");
00021 for (n = 0; n < 6; n++) {
00022 if (isascii(arg2[n]) && isprint(arg2[n]))
00023 putchar (arg2[n]);
00024 else
00025 printf ("0x%2.2X", (unsigned)arg2[n]);
00026 }
00027 printf (" and should be string\n");
00028 err++;
00029 }
00030
00031
00032
00033 if (len != 32) {
00034 printf ("the implicit string length is %d and should be 32\n", len);
00035 err++;
00036 }
00037
00038
00039
00040
00041
00042 if (err) {
00043 printf ("the following test may cause a segmentation violation\n");
00044 fflush (stdout);
00045 }
00046 if (*arg3 != 3) {
00047 printf ("last argument is %d and should be 3\n", *arg3);
00048 err++;
00049 }
00050 return err;
00051 }
00052
00053 void FMNAME(cg_sub,CG_SUB)(int *i, STR_PSTR(str), int *j STR_PLEN(str))
00054 {
00055 puts ("checking cg_sub");
00056 if (check_args (i, STR_PTR(str), j, STR_LEN(str)))
00057 puts ("incorrect interface");
00058 else
00059 puts ("OK");
00060 }
00061
00062 void FMNAME(adfsub,ADFSUB)(int *i, STR_PSTR(str), int *j STR_PLEN(str))
00063 {
00064 puts ("checking adfsub");
00065 if (check_args (i, STR_PTR(str), j, STR_LEN(str)))
00066 puts ("incorrect interface");
00067 else
00068 puts ("OK");
00069 }