home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / Triton / Developer / LibSource / OpenTriton.c < prev    next >
C/C++ Source or Header  |  1998-02-03  |  2KB  |  94 lines

  1. /*
  2.  *  OpenTriton -- A free release of the triton.library source code
  3.  *  Copyright (C) 1993-1998  Stefan Zeiger
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with this program; if not, write to the Free Software
  17.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  */
  20.  
  21.  
  22. #include "triton_lib.h"
  23.  
  24.  
  25. struct Library *TritonBase;
  26. struct TR_App *__Triton_Support_App;
  27.  
  28.  
  29. /****** triton.lib/TR_OpenTriton ******
  30. *
  31. *   NAME    
  32. *    TR_OpenTriton -- Opens Triton ready to use.
  33. *
  34. *   SYNOPSIS
  35. *    success = TR_OpenTriton(version, tag1,...)
  36. *    D0
  37. *
  38. *    BOOL TR_OpenTriton(ULONG, ULONG,...);
  39. *
  40. *   FUNCTION
  41. *    Opens triton.library with the specified minimum
  42. *    version and creates an application.
  43. *    The supplied tags are passed as a taglist to
  44. *    TR_CreateApp().
  45. *
  46. *   RESULT
  47. *    success - Was everything opened successful?
  48. *
  49. *   SEE ALSO
  50. *    TR_CloseTriton(), TR_CreateApp()
  51. *
  52. ******/
  53.  
  54. BOOL __stdargs TR_OpenTriton(ULONG version, ULONG taglist,...)
  55. {
  56.   if(!(TritonBase=OpenLibrary(TRITONNAME,version))) return FALSE;
  57.   if(!(__Triton_Support_App=TR_CreateApp((struct TagItem *)&taglist))) return FALSE;
  58.   return TRUE;
  59. }
  60.  
  61.  
  62. /****** triton.lib/TR_CloseTriton ******
  63. *
  64. *   NAME    
  65. *    TR_CloseTriton -- Closes Triton easily.
  66. *
  67. *   SYNOPSIS
  68. *    TR_CloseTriton()
  69. *
  70. *    VOID TR_CloseTriton(VOID);
  71. *
  72. *   FUNCTION
  73. *    Closes the application created by OpenTriton()
  74. *    and closes triton.library.
  75. *
  76. *   SEE ALSO
  77. *    TR_OpenTriton()
  78. *
  79. ******/
  80.  
  81. VOID __regargs TR_CloseTriton(VOID)
  82. {
  83.   if(__Triton_Support_App)
  84.   {
  85.     TR_DeleteApp(__Triton_Support_App);
  86.     __Triton_Support_App=NULL;
  87.   }
  88.   if(TritonBase)
  89.   {
  90.     CloseLibrary(TritonBase);
  91.     TritonBase=NULL;
  92.   }
  93. }
  94.