Browse Prior Art Database

Calling Any API from REXX using the API's Native Interface

IP.com Disclosure Number: IPCOM000113956D
Original Publication Date: 1994-Oct-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 2 page(s) / 54K

Publishing Venue

IBM

Related People

Cohen, ML: AUTHOR [+4]

Abstract

A method is described which identifies a new mechanism for calling any API from REXX directly, using the API's native parameter interface and without having to use any language other than REXX.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 54% of the total text.

Calling Any API from REXX using the API's Native Interface

      A method is described which identifies a new mechanism for
calling any API from REXX directly, using the API's native parameter
interface and without having to use any language other than REXX.

      Normally, to access any API from REXX, the programmer must
write a stub in the API's native language that contains the API call,
and then call that stub from REXX using REXX's limited string
interface.  Fig. 1 shows an example of this method.

 Fig. 1.   Calling an API from REXX today
   In REXX:
   return = myGpiSetColor(hps, CLR_RED)
   In API's native language:
   #include <os2.h>
   #include <string.h>
   #include <stdlib.h>
   ULONG myGpiSetColor(PUCHAR, ULONG, PRXSTRING, PSZ, PRXSTRING);
   #pragma linkage(myGpiSetColor, system)
   ULONG myGpiSetColor(PUCHAR fName, ULONG argc, PRXSTRING argv,
                       PSZ QueueName, PRXSTRING result)
  {
      ULONG  ulHps, ulColor;
      UCHAR  ptr[11];
      BOOL   rc;
      if (argc > 0) {
         memcpy(ptr, RXSTRPTR(argv[0]), 10);
         ulHps = (ULONG)atol(ptr);
      }
      if (argc > 1) {
         memcpy(ptr, RXSTRPTR(argv[1]), 10);
         ulColor = (ULONG)atol(ptr);
     }
      rc = GpiSetColor(ulHps, ulColor);
     _itoa(rc, result->strptr, 10);
     result->strlength = strlen(result->strptr);
     return N...