Пример #1
0
/**
 * Resolve a package function activator.
 *
 * @param function  The function name.
 * @param package   The package/library name.
 * @param procedure Procedure name.  Only used if directly loaded from a library
 *                  file.
 *
 * @return A function activator for this function, if it can be
 *         resolved.
 */
RoutineClass *PackageManager::resolveRoutine(RexxString *function, RexxString *packageName, RexxString *procedure)
{
    // see if we have this one already
    RoutineClass *func = (RoutineClass *)registeredRoutines->at(function);

    // if we have this, then we can return it directly.
    if (func != OREF_NULL)
    {
        return func;
    }

    const char *functionName = function->getStringData();
    const char *libraryName = packageName->getStringData();
    const char *procedureName = procedure->getStringData();

    {
        UnsafeBlock releaser;   // don't hold the block while making the API call
        // go register this (unconditionally....at this point, we don't care if this fails)
        RexxRegisterFunctionDll(functionName, libraryName, procedureName);
    }


    // resolve a registered entry, if we can and add it to the cache
    return createRegisteredRoutine(function);
}
ULONG EZLoadFuncs( CHAR *name, ULONG numargs, RXSTRING args[],
                   CHAR *queuename, RXSTRING *retstr )
  {
    int entries;
    int j;

    place_holder( args );
    place_holder( queuename );
    place_holder( name );
    
    retstr->strlength = 0;

    if( numargs > 0 ) goto error;

    entries = sizeof( RxFncTable ) / sizeof( fncEntry );

    for( j = 0; j < entries; ++j ){
        RexxRegisterFunctionDll( RxFncTable[ j ].rxName, DLLNAME,
          RxFncTable[ j ].cName );
    }

    return( VALID_ROUTINE );

  error:
    return( INVALID_ROUTINE );
}
Пример #3
0
ULONG RxDllLoadFuncs(CHAR *name,  /* Initialization Routine */
               ULONG numargs,      /* Number of arguments */
               RXSTRING args[],    /* Null-terminated RXSTRINGs array*/
               CHAR *queuename,    /* Current external data queue name */
               RXSTRING *retstr)   /* returning RXSTRING  */
	{
	USHORT    i,j,k;
	USHORT    F,D;
	USHORT    FuncCnt;    /* Num of functions  */

	if (numargs > 0) {             /* check arguments:if any, something bad may be happening */
		strlcpy(retstr->strptr,LFUNC_FAILED,255);
		retstr->strlength = strlen(retstr->strptr);
		return FUNC_FAILED;
	}

	FuncCnt = sizeof(RxFuncTbl)/sizeof(PCSZ);
	for (j = 1; j < FuncCnt; j++) {
		RexxRegisterFunctionDll(RxFuncTbl[j],RxFuncTbl[0], RxFuncTbl[j]);
	}

	/* Put user initialization here : onetime memory allocations etc*/

	strlcpy(retstr->strptr,LFUNC_OK,255);
	retstr->strlength = strlen(retstr->strptr);
	return FUNC_OK;
}
Пример #4
0
ULONG MathLoadFuncs(CHAR *name, ULONG numargs, RXSTRING args[],
                           CHAR *queuename, RXSTRING *retstr)
{
  INT    entries;                      /* Num of entries             */
  INT    j;                            /* Counter                    */

  retstr->strlength = 0;               /* set return value           */

  entries = sizeof(RxMathFncTable)/sizeof(RxMathFunc);

  RexxRegisterFunctionDll("MathLoadFuncs", "REXXMATH", "MathLoadFuncs");
  RexxRegisterFunctionDll("MathDropFuncs", "REXXMATH", "MathDropFuncs");

  for (j = 0; j < entries; j++) {
    RexxRegisterFunctionDll(RxMathFncTable[j].name,
          "REXXMATH", "MathFunc");
  }
  return VALID_ROUTINE;
}
Пример #5
0
/*-----------------------------------------------------------------------------
 * This function is called to initiate REXX interface.
 *----------------------------------------------------------------------------*/
static int InitTestRexx(PSZ progname)
{
   const RexxTestFunction  *func=NULL;
   ULONG rc=0L;

   /* Register all REXX functions */
   for (func = RexxTestFunctions; func->function_name; func++)
      rc = RexxRegisterFunctionDll(func->function_name,DLLNAME,func->function_name);

   return 0;
}
Пример #6
0
// LoadRxFuncs -- Load Rexx functions.
//
//      Return: none
//
void LoadRxFuncs(
    const RxFncEntry rxFncTable[],
    USHORT tableDim,
    PCSZ dllName)
{
    USHORT i;

    for (i = 0; i < tableDim; ++i) {
        RexxRegisterFunctionDll(
            rxFncTable[i].rxName,
            dllName,
            rxFncTable[i].cName);
    }
}
Пример #7
0
LONG REXXENTRY ApiLoadFuncs(
  PSZ       name,                      /* Function name              */
  LONG      numargs,                   /* Number of arguments        */
  RXSTRING  args[],                    /* Argument array             */
  PSZ       queuename,                 /* Current queue              */
  PRXSTRING retstr )                   /* Return RXSTRING            */
{
  INT    entries;                      /* Num of entries             */
  INT    j;                            /* Counter                    */


  entries = sizeof(ApiFncTable)/sizeof(PSZ);

  for (j = 0; j < entries; j++)
  {
    RexxRegisterFunctionDll(ApiFncTable[j],
          "REXXAPI1", ApiFncTable[j]);
  }
  return VALID_ROUTINE;
}