home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / Examples / p3-063 < prev    next >
Encoding:
Text File  |  1994-03-24  |  1.0 KB  |  58 lines

  1. #include <kernel.h>
  2.  
  3. #include "os.h"
  4. #include "osmodule.h"
  5. #include "wimp.h"
  6.  
  7. #define ENTRY_COMMAND 42
  8.  
  9. static char Title [] = "MyModule";
  10.  
  11. static wimp_t Task_Handle;
  12.  
  13. /*This is a CMHG-style command entry point.*/
  14.  
  15. _kernel_oserror *main_command (char *tail, int argc, int cmd_no,
  16.       void *workspace)
  17.  
  18. {  os_error *error = NULL;
  19.  
  20.    switch (cmd_no)
  21.    {  case ENTRY_COMMAND:
  22.          if ((error = xosmodule_enter (Title, tail)) != NULL)
  23.             goto finish;
  24.       break;
  25.  
  26.       /*other commands*/
  27.    }
  28.  
  29. finish:
  30.    return (_kernel_oserror *) error;
  31. }
  32.  
  33. /*This is the module's language entry point.*/
  34.  
  35. int main (void)
  36.  
  37. {  os_error *error = NULL;
  38.  
  39.    if (Task_Handle != 0)
  40.    {  wimp_t t = Task_Handle;
  41.  
  42.       Task_Handle = 0;
  43.       if ((error = xwimp_close_down (t)) != NULL)
  44.          goto finish;
  45.    }
  46.  
  47.    /*Now claim any workspace etc required before initialising the WIMP*/
  48.  
  49.    if ((error = xwimp_initialise (wimp_VERSION_RO3, Title, NULL, NULL,
  50.          &Task_Handle)) != NULL)
  51.       goto finish;
  52.  
  53.    /*Rest of the application.*/
  54.  
  55. finish:
  56.    return 0;
  57. }
  58.