コード例 #1
0
LONG REXXENTRY ApiDeregFunc(
  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                    */

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

  if (numargs > 0)
    return INVALID_ROUTINE;


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

  for (j = 0; j < entries; j++)
  {
    RexxDeregisterFunction(ApiFncTable[j]);
  }
  RexxDeregisterFunction("ApiLoadFuncs");
  return VALID_ROUTINE;
}
コード例 #2
0
ULONG EZDropFuncs( 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 ){
        RexxDeregisterFunction( RxFncTable[ j ].rxName );
    }

    return( VALID_ROUTINE );

  error:
    return( INVALID_ROUTINE );
}
コード例 #3
0
ファイル: rxdll.c プロジェクト: OS2World/LIB-REXX-rxdlllib
ULONG RxDllDropFuncs(CHAR *name,  /* Termination 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    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++) {
		RexxDeregisterFunction(RxFuncTbl[j]);
	}

	/*put user exit functions here: be sure to release any onetime memory you allocated*/

	strlcpy(retstr->strptr,LFUNC_OK,255);
	retstr->strlength = strlen(retstr->strptr);
	return FUNC_OK;
}
コード例 #4
0
ファイル: REXXMATH.C プロジェクト: OS2World/LIB-REXX-REXXMath
ULONG MathDropFuncs(CHAR *name, ULONG numargs, RXSTRING args[],
                          CHAR *queuename, RXSTRING *retstr)
{
  INT     entries;                     /* Num of entries             */
  INT     j;                           /* Counter                    */

  retstr->strlength = 0;               /* return a null string result*/

  RexxDeregisterFunction("MathLoadFuncs");
  RexxDeregisterFunction("MathDropFuncs");

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

  for (j = 0; j < entries; j++)
    RexxDeregisterFunction(RxMathFncTable[j].name);

  return VALID_ROUTINE;                /* no error on call           */
}
コード例 #5
0
ファイル: rxapiutl.c プロジェクト: OS2World/LIB-REXX-RexxIPC
// DropRxFuncs -- Drop Rexx functions.
//
//      Return: none
//
void DropRxFuncs(
    const RxFncEntry rxFncTable[],
    USHORT tableDim)
{
    USHORT i;

    for (i = 0; i < tableDim; ++i) {
        RexxDeregisterFunction(rxFncTable[i].rxName);
    }
}
コード例 #6
0
ファイル: test1.c プロジェクト: ErisBlastar/osfree
APIRET APIENTRY DROPFUNCS(PCSZ name,ULONG argc,PRXSTRING argv,PCSZ stck,PRXSTRING retstr)
{
   int rc=0;
   const RexxTestFunction  *func=NULL;

   /* DeRegister all REXX functions */
   for (func = RexxTestFunctions; func->function_name; func++)
      rc = RexxDeregisterFunction(func->function_name);
   sprintf(retstr->strptr,"%d",rc);
   retstr->strlength = strlen(retstr->strptr);
   return 0L;
}
コード例 #7
0
ファイル: PackageManager.cpp プロジェクト: jlfaucher/executor
/**
 * Drop a registered function.
 *
 * @param name   Name of the registered function.
 *
 * @return True if this was deregistered from the global table, false
 *         otherwise.
 */
RexxObject *PackageManager::dropRegisteredRoutine(RexxString *name)
{
    // we register this using the uppercase name, so make sure we uppercase it
    // before looking in the tables.
    name = name->upper();
    ProtectedObject p(name);
    // remove this from the local cache, then remove it from the global function
    // registration.
    registeredRoutines->remove(name);
    const char *functionName = name->getStringData();

    {
        UnsafeBlock releaser;
        // if this is a registered routine, removed it from the registered table
        registeredRoutines->remove(name);
        // just allow this to pass through to Rexxapi.  If this was truely registered
        // instead of loaded implicitly, this will remove the entry.  Otherwise, it will
        // return false.
        return RexxDeregisterFunction(functionName) == 0 ? TheFalseObject : TheTrueObject;
    }
}
コード例 #8
0
MRESULT EXPENTRY Calculator(
  HWND    hwnd,                        /* window handle              */
  ULONG   msg,                         /* dispatched message id      */
  MPARAM  mp1,                         /* first message parameter    */
  MPARAM  mp2 )                        /* second message parameter   */
{
  ULONG   action;                      /* Action to process          */

   switch (msg) {                      /* switch based on the message*/
                                       /* received                   */

      /* The initialization message has been received.  We do some   */
      /* additional fixup of the dialog to make it look a little     */
      /* nicer.                                                      */

      case WM_INITDLG:

                                       /* initialize accumulator     */
         MAKERXSTRING(accumulator, accbuff, 1);
         strcpy(accbuff, "0");         /* fill in a zero             */
         digits = 0;                   /* no digits in number        */
         hadperiod = NO;               /* no period yet              */
         hadexponent = NO;             /* no exponential yet         */
         oldaction = 0;                /* no pending operations      */
         strcpy(precision, "9");       /* set default precision      */
         form = SCIENTIFIC;            /* set default form           */
         SetDisplay(&accumulator);     /* set initial display value  */
                                       /* update the calculator      */
                                       /* display                    */
         WinSetWindowText(WinWindowFromID(hwnd, DISPLAY),
             display.strptr);
                                       /* register our external      */
                                       /* functions                  */
         RexxRegisterFunctionExe("CalcPrecision", (PFN)CalcPrecision);
         RexxRegisterFunctionExe("CalcForm", (PFN)CalcForm);

         return FALSE;                 /* initialization complete    */

      /* We are going away, time to post a quit message to the       */
      /* message loop.                                               */

      case WM_CLOSE:

                                       /* Deregister our defined     */
                                       /* functions                  */
         RexxDeregisterFunction("CalcPrecision");
         RexxDeregisterFunction("CalcForm");
                                       /* Standard Close processing  */
         WinPostMsg(hwnd, WM_QUIT, 0L, 0L);
         return FALSE;                 /* Exit now                   */

      /* We've received a WM_CONTROL message.  This was              */
      /* generated by the "Form" check blox.                         */

      case WM_CONTROL:                 /* change current form        */

         action = SHORT1FROMMP(mp1);   /* Extract message sub-type   */

         switch (action) {             /* process the control        */

           case BUTTON_FORM:           /* form switch button         */

             if (form == SCIENTIFIC) { /* current scientific?        */
               form = ENGINEERING;     /* make it engineering        */
                                       /* update label               */
               WinSetWindowText(WinWindowFromID(hwnd, BUTTON_FORM),
                   "Engineering");
             }
             else {
               form = SCIENTIFIC;      /* otherwise scientfic        */
               WinSetWindowText(WinWindowFromID(hwnd, BUTTON_FORM),
                  "Scientific");
             }
             return FALSE;             /* all done                   */
           default:                    /* Unknown, can't handle this */
             return FALSE;
         }

      /* We've received a WM_COMMAND message.  WM_COMMAND messages   */
      /* are generated by "pressing" buttons on the calculator.  The */
      /* additional parameters in the received message identify the  */
      /* button that was pressed                                     */

      case WM_COMMAND:

         action = SHORT1FROMMP(mp1);   /* Extract message sub-type   */

         switch (action) {

            /* The following buttons will be processed by the actual */
            /* calculator routine                                    */

            case BUTTON_CLEAR:         /* Clear key                  */

                                       /* initialize accumulator     */
              MAKERXSTRING(accumulator, accbuff, 1);
              strcpy(accbuff, "0");    /* fill in a zero             */
                                       /* initialize the display     */
              MAKERXSTRING(display, dispbuff, 1);
              strcpy(dispbuff, "0");   /* fill in a zero display     */
              digits = 0;              /* no digits yet              */
              hadperiod = NO;          /* turn off number processing */
              hadexponent = NO;        /* flags.                     */
              oldaction = 0;           /* and any pending operations */
                                       /* update the calculator      */
                                       /* display                    */
              WinSetWindowText(WinWindowFromID(hwnd, DISPLAY),
                  display.strptr);
              return FALSE;            /* All done                   */

            case BUTTON_DIGITS:        /* set new digits             */
                                       /* not a whole number?        */
              if (!CheckWhole(&display))
                                       /* give an error beep         */
                WinAlarm(HWND_DESKTOP, WA_ERROR);
              else {                   /* process the number         */
                                       /* copy the number            */
                strcpy(precision, display.strptr);
                                       /* redisplay the accumlator   */
                SetDisplay(&accumulator);
                                       /* display                    */
                WinSetWindowText(WinWindowFromID(hwnd, DISPLAY),
                    display.strptr);
              }
              return FALSE;            /* All done                   */

            case BUTTON_0:             /* Numeric keys               */
            case BUTTON_1:
            case BUTTON_2:
            case BUTTON_3:
            case BUTTON_4:
            case BUTTON_5:
            case BUTTON_6:
            case BUTTON_7:
            case BUTTON_8:
            case BUTTON_9:
            case BUTTON_PERIOD:        /* decimal point              */
            case BUTTON_EXPONENT:      /* exponent value             */
            case BUTTON_SIGN:          /* sign change                */

                                       /* Add a digit to display     */
              AddDigit(action);
                                       /* update the accumulator     */
                                       /* display                    */
              WinSetWindowText(WinWindowFromID(hwnd, DISPLAY),
                    display.strptr);
              return FALSE;            /* All done                   */

            /* The arithmetic operation keys all have a deferred     */
            /* execution.  When one of these is pressed, the previous*/
            /* arithmetic operation is processed using the           */
            /* accumulator and the current display.  The new operator*/
            /* is saved for later execution.  If no operator exists, */
            /* then the current display is moved to the accumulator  */
            /* and no arithmetic is done                             */

            case BUTTON_MULTIPLY:      /* Multiply key               */
            case BUTTON_DIVIDE:        /* Division key               */
            case BUTTON_PLUS:          /* Addition key               */
            case BUTTON_MINUS:         /* Subtraction key            */
            case BUTTON_IDIV:          /* integer division           */
            case BUTTON_REMAINDER:     /* remainder division         */
            case BUTTON_POWER:         /* raise a number to power    */
            case BUTTON_ENTER:         /* "Total" key                */
            case BUTTON_PROGRAM1:      /* programmed Rexx function   */
            case BUTTON_PROGRAM2:      /* programmed Rexx function   */

                                       /* Process pending operations */
              ProcessArithmetic(action);
              SetDisplay(&accumulator);/* reset display buffer       */
                                       /* update the calculator      */
                                       /* display                    */
              WinSetWindowText(WinWindowFromID(hwnd, DISPLAY),
                    accumulator.strptr);
              return FALSE;            /* All done                   */

            default:                   /* Unknown, can't handle this */
               return FALSE;
         }

      case WM_ERASEBACKGROUND:         /* disable background erase   */
        return MRFROMLONG(TRUE);       /* don't allow this           */

      /* Message not handled by us.  PM gives us first chance at all */
      /* messages.  Those we don't want to process we pass on to the */
      /* default dialog procedure.                                   */

      default:
         return WinDefWindowProc(hwnd, msg, mp1, mp2);

   }

   return FALSE;                       /* Should never reach here    */
 }