Пример #1
0
void
F77_FUNC(xdrfwrapstring,XDRFWRAPSTRING)(int *xdrid, char *sp_ptr,
					int *ret, int sp_len)
{
	char *tsp;
	int maxsize;

        xdr_fortran_lock();
	maxsize = (sp_len) + 1;
	tsp = (char*) malloc((size_t)(maxsize * sizeof(char)));
	if (tsp == NULL) {
	    *ret = -1;
	    return;
            xdr_fortran_unlock();
	}
	if (ftocstr(tsp, maxsize, sp_ptr, sp_len)) {
	    *ret = -1;
	    free(tsp);
	    return;
            xdr_fortran_unlock();
	}
	*ret = xdr_string(xdridptr[*xdrid], (char **) &tsp, (u_int)maxsize);
	ctofstr( sp_ptr, sp_len, tsp);
	cnt += maxsize;
	free(tsp);
        xdr_fortran_unlock();
}
Пример #2
0
void pvmfspawn (WatcomFortranStr *aout_str, int *flag, WatcomFortranStr *where_str, int *count, int *tids, int *info)
{
   char* aout_ptr  = aout_str->strP;
   int   aout_len  = aout_str->len;
   char* where_ptr = where_str->strP;
   int   where_len = where_str->len;
#else
void __stdcall
PVMFSPAWN (char *aout_ptr,int aout_len, int *flag, char *where_ptr,int where_len, int *count, int *tids, int *info)
{
#endif

   char taout[MAX_PROC_NAME + 1];
   char twhere[MAX_HOST_NAME + 1];
   /*
    * Copy the program and where names to make sure there's
    * a NUL at the end.
    */
   
   if (ftocstr(taout, sizeof(taout), aout_ptr, aout_len)) {
      *info = PvmBadParam;
      return;
   }
   
   /*
    * if the where parameter is '*', pass a NULL pointer to
    * initiate which will allow execution on any machine.
    */

   if (*(where_ptr) == '*') {
      *info = pvm_spawn(taout, (char**)0, *flag, "", *count, tids);

   } else {
      if (ftocstr(twhere, sizeof(twhere), where_ptr, where_len)) {
         *info = PvmBadParam;
         return;
      }
   
      *info = pvm_spawn(taout, (char**)0, *flag, twhere, *count, tids);

   }
}
Пример #3
0
void
F77_FUNC(xdrfstring,XDRFSTRING)(int *xdrid, char * sp_ptr,
				int *maxsize, int *ret, int sp_len)
{
	char *tsp;

	tsp = (char*) malloc((size_t)(((sp_len) + 1) * sizeof(char)));
	if (tsp == NULL) {
	    *ret = -1;
	    return;
	}
	if (ftocstr(tsp, *maxsize+1, sp_ptr, sp_len)) {
	    *ret = -1;
	    free(tsp);
	    return;
	}
        *ret = xdr_string(xdridptr[*xdrid], (char **) &tsp, (unsigned int) *maxsize);
	ctofstr( sp_ptr, sp_len , tsp);
	cnt += *maxsize;
	free(tsp);
}