home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / APLocation / Sources / Utilities.h < prev   
Encoding:
C/C++ Source or Header  |  2001-06-23  |  2.6 KB  |  101 lines

  1. /*
  2.      File:        Utilities.h
  3.  
  4.      Contains:    Location Manager SDK Sample Module handy routines
  5.  
  6.      Version:    ALM SDK 2.0
  7.                  Package:    Location Manager SDK 2.0
  8.  
  9.      Copyright:    © 1996-1997 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        Please include the the file and version information (from above) with
  13.                  the problem description.  Developers belonging to one of the Apple
  14.                  developer programs can submit bug reports to:
  15.  
  16.                      devsupport@apple.com
  17.  
  18. */
  19.  
  20. #ifndef UTILITIES_H_
  21. #define UTILITIES_H_
  22.  
  23. #ifndef __COMPONENTS__
  24. #include <Components.h>
  25. #endif
  26.  
  27. #ifndef __LOCATIONMANAGER__
  28. #include <LocationManager.h>
  29. #endif
  30.  
  31. #ifndef __PROCESSES__
  32. #include <Processes.h>
  33. #endif
  34.  
  35. #ifndef __QUICKDRAW__
  36. #include <Quickdraw.h>
  37. #endif
  38.  
  39. // ------------------------------------------------------------------------------------------------- 
  40.  
  41. // Module-specific defines...
  42.  
  43. #define        kModuleVersion                0
  44.  
  45.     // We didn't actually change the setting format between SDK 1.0 and 2.0, but this was a
  46.     // convenient way to call out the problem; see the discussion at "UseSetting" in Utilities.c...
  47.  
  48. #define        kOldSettingVersion            1        // From SDK 1.0
  49. #define        kSettingVersion                2        // Current settings...
  50.  
  51. // ------------------------------------------------------------------------------------------------- 
  52.  
  53. // Types...
  54.  
  55. typedef struct {
  56.     Component        self;                // Reference back to ourselves for closure...
  57.     SInt32            resFile;            // Reference for our open resource fork...
  58. } Globals, *GlobalsPtr, **GlobalsHandle;
  59.  
  60. typedef struct
  61. {
  62.     UInt32            version;
  63.     Boolean            powerOn;
  64.     Str255            network;
  65. } APSettingRec, *APSettingPtr, **APSettingHandle;
  66.  
  67. // ------------------------------------------------------------------------------------------------- 
  68.  
  69. extern    pascal OSErr TurnSystemModeOn(void)
  70.  FOURWORDINLINE(0x2F3C, 0x0040, 0x0000, 0xA88F);
  71. extern    pascal OSErr TurnSystemModeOff(void)
  72.  FOURWORDINLINE(0x2F3C, 0x0041, 0x0000, 0xA88F);
  73.  
  74. // Exports...
  75.  
  76. extern OSErr
  77. UseSetting (GlobalsHandle globals, APSettingHandle oldSetting, APSettingHandle newSetting, ALMRebootFlags* flags);
  78.     // Make 'setting' the current setting...
  79.  
  80. extern OSErr
  81. ReadSetting (GlobalsHandle globals, APSettingHandle setting);
  82.     // Read the system state into setting...
  83.  
  84. extern void
  85. InsParamStr (StringPtr matchThis, StringPtr replaceWithThis, StringPtr replaceInThis);
  86.     // Insert 'replaceWithThis' into 'replaceInThis' at the first instance of
  87.     // 'matchThis'...
  88.  
  89. extern OSErr
  90. LaunchAP();
  91.  
  92. extern OSErr
  93. LaunchAPScripting();
  94.  
  95. extern OSErr
  96. QuitAPScripting();
  97.  
  98. // ------------------------------------------------------------------------------------------------- 
  99.  
  100. #endif // UTILITIES_H_
  101.