fortranclient.c

Go to the documentation of this file.
00001 
00006 /* $Id: fortranclient.c,v 1.8 2007/07/24 19:24:32 yarkhan Exp $ */
00007 /* $UTK_Copyright: $ */
00008 
00009 #include <stdarg.h>
00010 
00011 #ifdef HAVE_CONFIG_H
00012 #include "config.h"
00013 #endif /* HAVE_CONFIG_H */
00014 
00015 #include "netsolveclient.h"
00016 #include "grpc.h"
00017 
00028 void
00029 fnetsl(char *nickname, ...)
00030 {
00031   va_list argptr;
00032   char *buf;
00033   int *return_value, len;
00034 
00035   grpc_set_default_major("COL");
00036 
00037   /* Getting the problem's nickname */
00038   va_start(argptr, nickname);
00039 
00040 #ifdef F2CSTRCRAYSTYLE
00041   va_arg(argptr, int);
00042 #endif
00043 
00044   /* Get the address of the return value */
00045   return_value = (int *) va_arg(argptr, int *);
00046 
00047   /* The trailing "()" in the problem name signifies the end of the
00048    * string.  Strip this off since it isn't used by the GridRPC client.
00049    */
00050   buf = nickname;
00051   while((*buf != '(') && (*buf != '\0'))
00052     buf++;
00053 
00054   len = (int) (buf - nickname + 2);
00055 
00056   buf = (char *) malloc(len + 1);
00057 
00058   if(!buf) {
00059     *return_value = NetSolveSystemError;
00060     return;
00061   }
00062 
00063   memcpy(buf, nickname, len);
00064   buf[len] = '\0';
00065 
00066   *return_value = netslX(buf, argptr, GS_CALL_FROM_FORTRAN,
00067                          NS_BLOCK, NS_NOASSIGNMENT);
00068 
00069   free(buf);
00070 
00071   return;
00072 }
00073 
00081 void
00082 fnetslerr(int *info)
00083 {
00084   fprintf(stderr, "%s\n", netsolveErrorMessage(*info));
00085 }
00086 
00094 void
00095 fnetslmajor(char *maj)
00096 {
00097   netslmajor(maj);
00098 }
00099 
00111 void
00112 fnetslnb(char *nickname, ...)
00113 {
00114   va_list argptr;
00115   char *buf;
00116   int *return_value, len;
00117 
00118   grpc_set_default_major("COL");
00119 
00120   /* Getting the problem's nickname */
00121   va_start(argptr, nickname);
00122 
00123 #if defined(F2CSTRCRAYSTYLE)
00124   va_arg(argptr, int);
00125 #endif
00126 
00127   /* Get the address of the return value */
00128   return_value = (int *) va_arg(argptr, int *);
00129 
00130   buf = nickname;
00131   while((*buf != '(') && (*buf != '\0'))
00132     buf++;
00133 
00134   len = (int) (buf - nickname + 2);
00135 
00136   buf = (char *) malloc(len + 1);
00137 
00138   if(!buf) {
00139     *return_value = NetSolveSystemError;
00140     return;
00141   }
00142 
00143   memcpy(buf, nickname, len);
00144   buf[len] = '\0';
00145 
00146   *return_value = netslX(buf, argptr, GS_CALL_FROM_FORTRAN,
00147                          NS_NOBLOCK, NS_NOASSIGNMENT);
00148 
00149   free(buf);
00150 
00151   return;
00152 }
00153 
00166 void
00167 fnetslpr(int *request_id, int *info)
00168 {
00169   if(!info || !request_id) return;
00170 
00171   *info = netslpr(*request_id);
00172   return;
00173 }
00174 
00175 
00187 void
00188 fnetslwt(int *request_id, int *info)
00189 {
00190   if(!info || !request_id) return;
00191 
00192   *info = netslwt(*request_id);
00193   return;
00194 }