home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWOSMisc / SLVersn.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  1.3 KB  |  51 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLVersn.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Author:                Damon Cokenias
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef SLVERSN_H
  13. #include "SLVersn.h"
  14. #endif
  15.  
  16. #ifndef FWCFMRES_H
  17. #include "FWCFMRes.h"
  18. #endif
  19.  
  20. #ifndef FWRESACC_H
  21. #include "FWResAcc.h"
  22. #endif
  23.  
  24. //----------------------------------------------------------------------------------------
  25. // FW_GetODFLibraryVersion
  26. //----------------------------------------------------------------------------------------
  27. FW_Version FW_GetODFLibraryVersion (Environment* ev)
  28. {
  29.     static unsigned long    gCachedVersion = 0;
  30.  
  31. #ifdef FW_BUILD_MAC
  32.  
  33.     if (gCachedVersion) {
  34.         return gCachedVersion;
  35.     } else {    
  36.         FW_PSharedLibraryResourceFile        odfLibResFile (ev);
  37.         FW_PResource                        versResource (ev, odfLibResFile, 1, 'vers');        
  38.     
  39.         FW_CAcquireResourceData                versData (ev, versResource);
  40.         FW_ASSERT (versData.GetSize () >= sizeof (unsigned long));
  41.         
  42.         // First 32 bits of 'vers' resource is the packed version number
  43.         gCachedVersion = *((unsigned long*) versData.GetData ());
  44.         return gCachedVersion;
  45.     }
  46. #else
  47.     // DTC -- We'll have to do the right thing for Windows here
  48.     return 0;
  49. #endif
  50. }
  51.