home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / macintosh technotes and q&as / technotes / tn / energyservapi.hqx / EnergyServPubLib.c < prev   
Encoding:
Text File  |  1996-10-12  |  2.6 KB  |  110 lines

  1. // EnergyServicesLib.c
  2. //
  3. // Apple Macintosh Developer Technical Support
  4. //
  5. //    Contains:    Glue code for calling the energy services INIT
  6. //
  7. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  8. //
  9. // You may incorporate this sample code into your applications without
  10. // restriction, though the sample code has been provided "AS IS" and the
  11. // responsibility for its operation is 100% yours.  However, what you are
  12. // not permitted to do is to redistribute the source as "DSC Sample Code"
  13. // after having made changes. If you're going to re-distribute the source,
  14. // we require that you make it clear in the source that the code was
  15. // descended from Apple Sample Code, but that you've made changes.
  16.  
  17.  
  18. #include "Gestalt.h"
  19.  
  20. #include "EnergyServPub.h"
  21.  
  22. ESRoutineCallPtr    gESMainRoutine = nil;
  23.  
  24. long    CallESMain(short selector, long parm1, long parm2)
  25. {
  26.     ESDataPtr    theLocation;
  27.     OSErr        theErr;
  28.  
  29.     if (gESMainRoutine == nil) {
  30.         theErr = Gestalt('wnkl', (long *)&theLocation);
  31.         if ((theErr == noErr) && (theLocation !=nil))
  32.             gESMainRoutine = theLocation->WinkleINITMain;
  33.     }
  34.     if (gESMainRoutine != nil) {
  35.         return (CallESRoutineProc(gESMainRoutine,selector, parm1, parm2));
  36.     } else theErr = -1;
  37.     return theErr;
  38. }
  39.  
  40. OSErr    ESLoadPreferences(GlobDataPtr thePrefs)
  41. {
  42.     return (CallESMain(xESLoadPreferences,(long)thePrefs, 0));
  43. }
  44.  
  45. OSErr    ESGetPreferences(GlobDataPtr thePrefs)
  46. {
  47.     return (CallESMain(xESGetPreferences,(long)thePrefs, 0));
  48. }
  49.  
  50. OSErr    ESSetPreferences(GlobDataPtr thePrefs)
  51. {
  52.     return (CallESMain(xESSetPreferences,(long)thePrefs, 0));
  53. }
  54.  
  55. OSErr    ESRefreshSettings()
  56. {
  57.     return (CallESMain(xESRefreshSettings,0, 0));
  58. }
  59.  
  60. OSErr    ESSavePreferences(GlobDataPtr thePrefs)
  61. {
  62.     return (CallESMain(xESSavePreferences,(long)thePrefs, 0));
  63. }
  64.  
  65. OSErr    ESRestoreDefaults(GlobDataPtr thePrefs)
  66. {
  67.     return (CallESMain(xESRestoreDefaults,(long)thePrefs, 0));
  68. }
  69.  
  70. OSErr    ESAddNoteProc(ESNotifyProcPtr theProc, long data)
  71. {
  72.     return (CallESMain(xESAddNoteProc, (long)theProc, data));
  73. }
  74.  
  75. OSErr    ESRemoveNoteProc(ESNotifyProcPtr theProc)
  76. {
  77.     return (CallESMain(xESRemoveNoteProc, (long)theProc, 0));
  78. }
  79.  
  80. OSErr    ESGetUnsavedFolder(Ptr    theString)
  81. {
  82.     return (CallESMain(xESGetUnsavedFolder, (long)theString, 0));
  83. }
  84.  
  85. OSErr    ESSetUnsavedFolder(Ptr    theString)
  86. {
  87.     return (CallESMain(xESSetUnsavedFolder, (long)theString, 0));
  88. }
  89.  
  90. OSErr    ESGetINITVersion(Handle* theVers)
  91. {
  92.     return (CallESMain(xESGetINITVersion, (long)theVers, 0));
  93. }
  94.  
  95. OSErr    ESGetAliasFileName(Ptr    theString)
  96. {
  97.     return (CallESMain(1306, (long)theString, 0));
  98. }
  99.  
  100. /*OSErr    TESTInstallShutdown(long theSecs)
  101. {
  102.     return (CallESMain(xESInstallShutDown, theSecs, 0));
  103. }
  104.  
  105. OSErr    TESTCancelShutdown()
  106. {
  107.     return (CallESMain(xESCancelShutdown, 0, 0));
  108. }*/
  109.  
  110.