home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / pufferfish / source / wb2cli / wb2cli.doc next >
Text File  |  1994-03-26  |  3KB  |  99 lines

  1. TABLE OF CONTENTS
  2.  
  3. WB2CLI
  4. WB2CLI                                                                 WB2CLI
  5.  
  6.    NAME
  7.     WB2CLI                                (V37)
  8.  
  9.    SYNOPSIS
  10.     status = WB2CLI(wbmsg,defaultstack,dosbase)
  11.       D0             A0    D0           A1
  12.  
  13.     LONG WB2CLI(struct WBStartup *,ULONG,struct DosLibrary *)
  14.  
  15.    FUNCTION
  16.     This function will take a workbench started application and change
  17.     it into a CLI-like application.  This will include a path as copied
  18.     from the Workbench.  The CLI default stack is used to pick the stack
  19.     size for the processes run as CLIs.  (This is in SYNC mode)
  20.  
  21.     You would pass in the Workbench message pointer and a pointer
  22.     to an open dos.library.  (The DosLibrary pointer is used to call
  23.     dos.library without the need of globals.)
  24.  
  25.     This *REQUIRES* V37 dos.library and exec.library.
  26.  
  27.    NOTES
  28.     Assembly language programmers:  This routine is _WB2CLI
  29.  
  30.     If you call WB2CLI() and are already a CLI, it will return as if
  31.     it worked even though it did nothing.  (After all, you were a CLI)
  32.     For this reason, you do not need to check if you are a CLI
  33.     started program before you call the function.
  34.  
  35.     One word of interest:  Once you call this function, the pr_CLI
  36.     field of your process will *NOT* be NULL.  This is by definition
  37.     of what this program is trying to do, which is make you like a CLI.
  38.     You will, however, still need to reply the workbench startup message
  39.     that you passed to the WB2CLI routine.
  40.  
  41.     You are, however, responsible for setting up any input or output
  42.     file handles that you may needed.  Being workbench started means
  43.     that you have no standard-in or standard-out.  (Just as before)
  44.     (In other words, this function does not magically give you any
  45.     I/O as you may already have done so or need a special form of it)
  46.     These handles are pr_CIS, pr_COS, etc.  For example, many DOS
  47.     calls may rely on these being valid.  RunCommand() under V37
  48.     is one such creature.
  49.  
  50.    EXAMPLE
  51.     void main(int argc, char *argv[])
  52.     {
  53.     struct  DosLibrary  *DOSBase;
  54.  
  55.         /* We need V37 to do this */
  56.         if (DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",37L))
  57.         {
  58.         /* Cute trick:  If you are a CLI, WB2CLI is a NO-OP */
  59.         /* Thus, you normally don't need to check */
  60.             /* NOTE:  Most of the time you will ignore the error */
  61.             if (WB2CLI((struct WBStartup *)argv,4000,DOSBase))
  62.             {
  63.                 /* We now are workbench started CLI */
  64.                 /* (Complete with path */
  65.             }
  66.             else
  67.             {
  68.                 /* We did not become a CLI but we still */
  69.                 /* can run.  Just not as a CLI */
  70.             }
  71.  
  72.             /* More stuff */
  73.  
  74.             CloseLibrary((struct Library *)DOSBase);
  75.         }
  76.     }
  77.  
  78.    INPUTS
  79.     wbmsg -- The Workbench message that you were started with.  If NULL
  80.              this routine will do nothing...
  81.  
  82.     defaultstack -- The size of the CLI default stack in bytes.
  83.                     You *SHOULD* supply a value of at least 4000.
  84.  
  85.     dosbase -- Pointer to dos.library (must be open)
  86.  
  87.    RESULTS
  88.     A magically transformed process that has a CLI structure added.
  89.  
  90.     status -- Returns TRUE if it worked.  Usually can be ignored
  91.               as your program will continue to work as if you did not
  92.               call this function.
  93.  
  94.    SEE ALSO
  95.     None
  96.  
  97.    BUGS
  98.  
  99.