home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / system / _palmemu / palmemu.exe / HostControl.h < prev    next >
C/C++ Source or Header  |  2000-08-01  |  27KB  |  879 lines

  1. /* -*- mode: C++; tab-width: 4 -*- */
  2. /* ===================================================================== *\
  3.     Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
  4.     All rights reserved.
  5.  
  6.     This file is part of the Palm OS Emulator.
  7.  
  8.     This program is free software; you can redistribute it and/or modify
  9.     it under the terms of the GNU General Public License as published by
  10.     the Free Software Foundation; either version 2 of the License, or
  11.     (at your option) any later version.
  12. \* ===================================================================== */
  13.  
  14. #ifndef _HOSTCONTROL_H_
  15. #define _HOSTCONTROL_H_
  16.  
  17. #if !defined (__SYSTRAPS_H_) && !defined (__CORETRAPS_H_)
  18. #error "Please #include either <CoreTraps.h> or <SysTraps.h>, depending on what's in your Palm Includes directory."
  19. #endif
  20.  
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26.  
  27. /*
  28.     Set the values for selectors. Note that these values MUST be
  29.     two bytes long and have the high byte be non-zero. The reason
  30.     for this has to do with the way SysGremlins was originally
  31.     declared. It took a GremlinsSelector enumerated value. Originally,
  32.     there was only one value, and it was zero. The way the 68K compiler
  33.     works, it decides that GremlinsSelectors are only one byte long,
  34.     so a call to SysGremlins would push one byte onto the stack. Because
  35.     all values on the stack need to be word-aligned, the processor
  36.     subtracts 1 from the stack before pushing on the byte. Therefore,
  37.     the stack looks like:
  38.  
  39.             previous contents
  40.             garbage byte
  41.             selector
  42.             return address
  43.  
  44.     When the two middle bytes are read together as a word, they appear
  45.     as: <selector> * 256 + <garbage byte>.
  46.  
  47.     With this setup, we have two choices: leave the selector size at
  48.     one byte and limit ourselves to 256 functions, or define the selector
  49.     to be a two byte value, with the first 256 values (all those with 0x00
  50.     in the upper byte) to be GremlinIsOn. The latter sounds preferable, so
  51.     we start the new selectors at 0x0100.
  52. */
  53.  
  54.  
  55.     // Host information selectors
  56.  
  57. #define hostSelectorGetHostVersion            0x0100
  58. #define hostSelectorGetHostID                0x0101
  59. #define hostSelectorGetHostPlatform            0x0102
  60. #define hostSelectorIsSelectorImplemented    0x0103
  61. #define hostSelectorGestalt                    0x0104
  62. #define hostSelectorIsCallingTrap            0x0105
  63.  
  64.  
  65.     // Profiler selectors
  66.  
  67. #define hostSelectorProfileInit                0x0200
  68. #define hostSelectorProfileStart            0x0201
  69. #define hostSelectorProfileStop                0x0202
  70. #define hostSelectorProfileDump                0x0203
  71. #define hostSelectorProfileCleanup            0x0204
  72. #define hostSelectorProfileDetailFn            0x0205
  73.  
  74.  
  75.     // Std C Library wrapper selectors
  76.  
  77. #define hostSelectorErrNo                    0x0300
  78.  
  79. #define hostSelectorFClose                    0x0301
  80. #define hostSelectorFEOF                    0x0302
  81. #define hostSelectorFError                    0x0303
  82. #define hostSelectorFFlush                    0x0304
  83. #define hostSelectorFGetC                    0x0305
  84. #define hostSelectorFGetPos                    0x0306
  85. #define hostSelectorFGetS                    0x0307
  86. #define hostSelectorFOpen                    0x0308
  87. #define hostSelectorFPrintF                    0x0309        /* Floating point not yet supported in Poser */
  88. #define hostSelectorFPutC                    0x030A
  89. #define hostSelectorFPutS                    0x030B
  90. #define hostSelectorFRead                    0x030C
  91. #define hostSelectorRemove                    0x030D
  92. #define hostSelectorRename                    0x030E
  93. #define hostSelectorFReopen                    0x030F        /* Not yet implemented in Poser */
  94. #define hostSelectorFScanF                    0x0310        /* Not yet implemented */
  95. #define hostSelectorFSeek                    0x0311
  96. #define hostSelectorFSetPos                    0x0312
  97. #define hostSelectorFTell                    0x0313
  98. #define hostSelectorFWrite                    0x0314
  99. #define hostSelectorTmpFile                    0x0315
  100. #define hostSelectorTmpNam                    0x0316
  101.  
  102. #define hostSelectorGetEnv                    0x0317
  103.  
  104. #define hostSelectorMalloc                    0x0318
  105. #define hostSelectorRealloc                    0x0319
  106. #define hostSelectorFree                    0x031A
  107.  
  108.     // time.h wrappers
  109. #define hostSelectorAscTime                    0x0370
  110. #define hostSelectorClock                    0x0371
  111. #define hostSelectorCTime                    0x0372
  112. // #define hostSelectorDiffTime                0x0373
  113. #define hostSelectorGMTime                    0x0374
  114. #define hostSelectorLocalTime                0x0375
  115. #define hostSelectorMkTime                    0x0376
  116. #define hostSelectorStrFTime                0x0377
  117. #define hostSelectorTime                    0x0378
  118.  
  119.     // dirent.h wrappers
  120. #define hostSelectorOpenDir                    0x0380
  121. #define hostSelectorReadDir                    0x0381
  122. // #define hostSelectorRewindDir                0x0382
  123. #define hostSelectorCloseDir                0x0383
  124. // #define hostSelectorTellDir                    0x0384
  125. // #define hostSelectorSeekDir                    0x0385
  126. // #define hostSelectorScanDir                    0x0386
  127.  
  128.     // fcntl.h wrappers
  129. // #define hostSelectorOpen                    0x0386
  130. // #define hostSelectorCreat                    0x0388
  131. // #define hostSelectorFcntl                    0x0389
  132.  
  133.     // unistd.h wrappers
  134. // #define hostSelectorAccess                    0x038A
  135. // #define hostSelectorChDir                    0x038B
  136. // #define hostSelectorClose                    0x038C
  137. // #define hostSelectorDup                        0x038D
  138. // #define hostSelectorDup2                    0x038E
  139. // #define hostSelectorGetCwd                    0x038F
  140. // #define hostSelectorIsATTY                    0x0390
  141. // #define hostSelectorLink                    0x0391
  142. // #define hostSelectorLSeek                    0x0392
  143. // #define hostSelectorRead                    0x0393
  144. #define hostSelectorRmDir                    0x0394
  145. // #define hostSelectorTTYName                    0x0395
  146. // #define hostSelectorUnlink                    0x0396
  147. // #define hostSelectorWrite                    0x0397
  148.  
  149. // #define hostSelectorFChDir                    0x0398
  150. // #define hostSelectorFChMod                    0x0399
  151. // #define hostSelectorFileNo                    0X039A
  152. // #define hostSelectorFSync                    0x039B
  153. // #define hostSelectorFTruncate                0x039C
  154. // #define hostSelectorGetHostName                0x039D
  155. // #define hostSelectorGetWD                    0x039E
  156. // #define hostSelectorMkSTemp                    0x039F
  157. // #define hostSelectorMkTemp                    0x03A0
  158. // #define hostSelectorRe_Comp                    0x03A1
  159. // #define hostSelectorRe_Exec                    0x03A2
  160. // #define hostSelectorReadLink                0x03A3
  161. // #define hostSelectorSetHostName                0x03A4
  162. // #define hostSelectorSymLink                    0x03A5
  163. // #define hostSelectorSync                    0x03A6
  164. #define hostSelectorTruncate                0x03A7
  165.  
  166.     // sys/stat.h wrappers
  167. // #define hostSelectorChMod                    0x03A8
  168. // #define hostSelectorFStat                    0x03A9
  169. #define hostSelectorMkDir                    0x03AA
  170. #define hostSelectorStat                    0x03AB
  171. // #define hostSelectorLStat                    0x03AC
  172.  
  173.     // sys/time.h wrappers
  174. // #define hostSelectorGetTimeOfDay            0x03AD
  175. #define hostSelectorUTime                    0x03AE
  176.  
  177.  
  178.     // Gremlin selectors
  179.  
  180. #define hostSelectorGremlinIsRunning        0x0400
  181. #define hostSelectorGremlinNumber            0x0401
  182. #define hostSelectorGremlinCounter            0x0402
  183. #define hostSelectorGremlinLimit            0x0403
  184. #define hostSelectorGremlinNew                0x0404
  185.  
  186.  
  187.     // Database selectors
  188.  
  189. #define hostSelectorImportFile                0x0500
  190. #define hostSelectorExportFile                0x0501
  191.  
  192. #define hostSelectorExgLibOpen                0x0580
  193. #define hostSelectorExgLibClose                0x0581
  194. #define hostSelectorExgLibSleep                0x0582
  195. #define hostSelectorExgLibWake                0x0583
  196. #define hostSelectorExgLibHandleEvent        0x0584
  197. #define hostSelectorExgLibConnect            0x0585
  198. #define hostSelectorExgLibAccept            0x0586
  199. #define hostSelectorExgLibDisconnect        0x0587
  200. #define hostSelectorExgLibPut                0x0588
  201. #define hostSelectorExgLibGet                0x0589
  202. #define hostSelectorExgLibSend                0x058A
  203. #define hostSelectorExgLibReceive            0x058B
  204. #define hostSelectorExgLibControl            0x058C
  205. #define hostSelectorExgLibRequest            0x058D
  206.  
  207.  
  208.     // Preferences selectors
  209.  
  210. #define hostSelectorGetPreference            0x0600
  211. #define hostSelectorSetPreference            0x0601
  212.  
  213.  
  214.     // Logging selectors
  215.  
  216. #define hostSelectorLogFile                    0x0700
  217. #define hostSelectorSetLogFileSize            0x0701
  218.  
  219.  
  220.     // RPC selectors
  221.  
  222. #define hostSelectorSessionCreate            0x0800        /* Not yet implemented in Poser */
  223. #define hostSelectorSessionOpen                0x0801        /* Not yet implemented in Poser */
  224. #define hostSelectorSessionClose            0x0802
  225. #define hostSelectorSessionQuit                0x0803
  226. #define hostSelectorSignalSend                0x0804
  227. #define hostSelectorSignalWait                0x0805
  228. #define hostSelectorSignalResume            0x0806
  229.  
  230.  
  231.     // External tracing tool support
  232.  
  233. #define hostSelectorTraceInit                0x0900
  234. #define hostSelectorTraceClose                0x0901
  235. #define hostSelectorTraceOutputT            0x0902
  236. #define hostSelectorTraceOutputTL            0x0903
  237. #define hostSelectorTraceOutputVT            0x0904
  238. #define hostSelectorTraceOutputVTL            0x0905
  239. #define hostSelectorTraceOutputB            0x0906
  240.  
  241. #if INCLUDE_SECRET_STUFF
  242.     // Slot support
  243.  
  244. #define hostSelectorSlotMax                    0x0A00
  245. #define hostSelectorSlotRoot                0x0A01
  246. #define hostSelectorSlotHasCard                0x0A02
  247.  
  248. #endif    // INCLUDE_SECRET_STUFF
  249.  
  250.  
  251.     // File choosing support
  252.  
  253. #define hostSelectorGetFile                    0x0B00
  254. #define hostSelectorPutFile                    0x0B01
  255. #define hostSelectorGetDirectory            0x0B02
  256.  
  257. #define hostSelectorLastTrapNumber            0x0BFF
  258.  
  259.  
  260.     // * Types
  261.  
  262. typedef UInt16    HostControlSelectorType;
  263. typedef long    HostBoolType;
  264. typedef long    HostClockType;
  265. typedef long    HostErrType;
  266. typedef long    HostIDType;
  267. typedef long    HostPlatformType;
  268. typedef long    HostSignalType;
  269. typedef long    HostSizeType;
  270. typedef long    HostTimeType;
  271.  
  272.  
  273.     // * HostDIRType
  274.  
  275. struct HostDIRType
  276. {
  277.     long    _field;
  278. };
  279.  
  280. typedef struct HostDIRType HostDIRType;
  281.  
  282.  
  283.     // * HostDirEntType
  284.  
  285. #define HOST_NAME_MAX    255
  286.  
  287. struct HostDirEntType
  288. {
  289.     char    d_name[HOST_NAME_MAX + 1];
  290. };
  291.  
  292. typedef struct HostDirEntType HostDirEntType;
  293.  
  294.  
  295.     // * HostFILEType
  296.  
  297. struct HostFILEType
  298. {
  299.     long    _field;
  300. };
  301.  
  302. typedef struct HostFILEType HostFILEType;
  303.  
  304.  
  305.     // * HostGremlinInfoType
  306.  
  307. struct HostGremlinInfoType
  308. {
  309.     long        fFirstGremlin;
  310.     long        fLastGremlin;
  311.     long        fSaveFrequency;
  312.     long        fSwitchDepth;
  313.     long        fMaxDepth;
  314.     char        fAppNames[200];    // Comma-seperated list of application names
  315.                                 // to run Gremlins on.  If the string is empty,
  316.                                 // all applications are fair game.  If the string
  317.                                 // begins with a '-' (e.g., "-Address,Datebook"),
  318.                                 // then all applications named in the list are
  319.                                 // excluded instead of included.
  320. };
  321.  
  322. typedef struct HostGremlinInfoType HostGremlinInfoType;
  323.  
  324.  
  325.     // * HostStatType
  326.     //        Note that the field names here have an underscore appended to
  327.     //        them in order to differentiate them from "compatibility macros"
  328.     //        under Solaris.
  329.  
  330. struct HostStatType
  331. {
  332.     unsigned long    st_dev_;
  333.     unsigned long    st_ino_;
  334.     unsigned long    st_mode_;
  335.     unsigned long    st_nlink_;
  336.     unsigned long    st_uid_;
  337.     unsigned long    st_gid_;
  338.     unsigned long    st_rdev_;
  339.     HostTimeType    st_atime_;
  340.     HostTimeType    st_mtime_;
  341.     HostTimeType    st_ctime_;
  342.     unsigned long    st_size_;
  343.     unsigned long    st_blksize_;
  344.     unsigned long    st_blocks_;
  345.     unsigned long    st_flags_;
  346. };
  347.  
  348. typedef struct HostStatType HostStatType;
  349.  
  350.  
  351.     // * HostTmType
  352.     //        Note that the field names here have an underscore appended to
  353.     //        them for consistancy with HostStatType.
  354.  
  355. struct HostTmType
  356. {
  357.     long    tm_sec_;    /* seconds after the minute - [0,59] */
  358.     long    tm_min_;    /* minutes after the hour - [0,59] */
  359.     long    tm_hour_;    /* hours since midnight - [0,23] */
  360.     long    tm_mday_;    /* day of the month - [1,31] */
  361.     long    tm_mon_;    /* months since January - [0,11] */
  362.     long    tm_year_;    /* years since 1900 */
  363.     long    tm_wday_;    /* days since Sunday - [0,6] */
  364.     long    tm_yday_;    /* days since January 1 - [0,365] */
  365.     long    tm_isdst_;    /* daylight savings time flag */
  366. };
  367.  
  368. typedef struct HostTmType HostTmType;
  369.  
  370.  
  371.     // * HostUTimeType
  372.     //        Note that the field names here have an underscore appended to
  373.     //        them for consistancy with HostStatType.
  374.  
  375. struct HostUTimeType
  376. {
  377.     HostTimeType    crtime_;    /* creation time */
  378.     HostTimeType    actime_;    /* access time */
  379.     HostTimeType    modtime_;    /* modification time */
  380. };
  381.  
  382. typedef struct HostUTimeType HostUTimeType;
  383.  
  384.  
  385.     // * Backward compatiblity
  386.  
  387. typedef HostControlSelectorType    HostControlTrapNumber;
  388. typedef HostBoolType            HostBool;
  389. typedef HostErrType                HostErr;
  390. typedef HostIDType                HostID;
  391. typedef HostPlatformType        HostPlatform;
  392. typedef HostSignalType            HostSignal;
  393. typedef HostFILEType            HostFILE;
  394.  
  395.  
  396.  
  397. #ifndef hostErrorClass
  398.     #define    hostErrorClass                0x1C00    // Host Control Manager
  399. #else
  400.     #if hostErrorClass != 0x1C00
  401.         #error "You cannot change hostErrorClass without telling us."
  402.     #endif
  403. #endif
  404.  
  405. enum    // HostErrType values
  406. {
  407.     hostErrNone = 0,
  408.  
  409.     hostErrBase = hostErrorClass,
  410.  
  411.     hostErrUnknownGestaltSelector,
  412.     hostErrDiskError,
  413.     hostErrOutOfMemory,
  414.     hostErrMemReadOutOfRange,
  415.     hostErrMemWriteOutOfRange,
  416.     hostErrMemInvalidPtr,
  417.     hostErrInvalidParameter,
  418.     hostErrTimeout,
  419.     hostErrInvalidDeviceType,
  420.     hostErrInvalidRAMSize,
  421.     hostErrFileNotFound,
  422.     hostErrRPCCall,                // Issued if the following functions are not called remotely:
  423.                                 //        HostSessionCreate
  424.                                 //        HostSessionOpen
  425.                                 //        HostSessionClose
  426.                                 //        HostSessionQuit
  427.                                 //        HostSignalWait
  428.                                 //        HostSignalResume
  429.     hostErrSessionRunning,        // Issued by HostSessionCreate, HostSessionOpen, and
  430.                                 // HostSessionQuit if a session is running.
  431.     hostErrSessionNotRunning,    // Issued by HostSessionClose if no session is running.
  432.     hostErrNoSignalWaiters,        // Issued by HostSendSignal if no one's waiting for a signal.
  433.     hostErrSessionNotPaused        // Issued when HostSignalResume, but the session was not
  434.                                 // halted from a HostSignalSend call.
  435. };
  436.  
  437.  
  438. enum    // HostIDType values
  439. {
  440.     hostIDPalmOS,            // The plastic thingy
  441.     hostIDPalmOSEmulator,    // The Copilot thingy
  442.     hostIDPalmOSSimulator    // The Mac libraries you link with thingy
  443. };
  444.  
  445.  
  446. enum    // HostPlatformType values
  447. {
  448.     hostPlatformPalmOS,
  449.     hostPlatformWindows,
  450.     hostPlatformMacintosh,
  451.     hostPlatformUnix
  452. };
  453.  
  454. enum    // HostSignalType values
  455. {
  456.     hostSignalReserved,
  457.     hostSignalIdle,
  458.     hostSignalQuit,
  459. #if 0
  460.     // (Proposed...not supported yet)
  461.     hostSignalSessionStarted,
  462.     hostSignalSessionStopped,
  463.     hostSignalHordeStarted,
  464.     hostSignalGremlinStarted,
  465.     hostSignalGremlinSuspended,
  466.     hostSignalGremlinResumed,
  467.     hostSignalGremlinStopped,
  468.     hostSignalHordeStopped,
  469. #endif
  470.     hostSignalUser    = 0x40000000    // User-defined values start here and go up.
  471. };
  472.  
  473.  
  474. // Use these to call FtrGet to see if you're running under the
  475. // Palm OS Emulator.  If not, FtrGet will return ftrErrNoSuchFeature.
  476.  
  477. #define kPalmOSEmulatorFeatureCreator    ('pose')
  478. #define kPalmOSEmulatorFeatureNumber    (0)
  479.  
  480.  
  481. // Define this, since SysTraps.h doesn't have it.
  482.  
  483. #ifdef __SYSTRAPS_H_
  484. #define sysTrapHostControl sysTrapSysGremlins
  485. #endif
  486.  
  487.  
  488. // Define HOST_TRAP
  489.  
  490. #if defined (_SYSTEM_API)
  491.  
  492. #define HOST_TRAP(selector)    \
  493.     _SYSTEM_API(_CALL_WITH_16BIT_SELECTOR)(_SYSTEM_TABLE, sysTrapHostControl, selector)
  494.  
  495. #else
  496.  
  497. #define HOST_TRAP(selector)                                                    \
  498.     FIVEWORD_INLINE(                                                        \
  499.         0x3F3C, selector,                    /* MOVE.W #selector, -(A7)    */    \
  500.         m68kTrapInstr + sysDispatchTrapNum,    /* TRAP $F                    */    \
  501.         sysTrapHostControl,                    /* sysTrapHostControl        */    \
  502.         0x544F)                                /* ADD.Q #2, A7                */ 
  503. #endif
  504.  
  505.  
  506. /* ==================================================================== */
  507. /* Host environment-related calls                                        */
  508. /* ==================================================================== */
  509.  
  510. long                HostGetHostVersion(void)
  511.                         HOST_TRAP(hostSelectorGetHostVersion);
  512.  
  513. HostIDType            HostGetHostID(void)
  514.                         HOST_TRAP(hostSelectorGetHostID);
  515.  
  516. HostPlatformType    HostGetHostPlatform(void)
  517.                         HOST_TRAP(hostSelectorGetHostPlatform);
  518.  
  519. HostBoolType        HostIsSelectorImplemented(long selector)
  520.                         HOST_TRAP(hostSelectorIsSelectorImplemented);
  521.  
  522. HostErrType            HostGestalt(long gestSel, long* response)
  523.                         HOST_TRAP(hostSelectorGestalt);
  524.  
  525. HostBoolType        HostIsCallingTrap(void)
  526.                         HOST_TRAP(hostSelectorIsCallingTrap);
  527.  
  528.  
  529. /* ==================================================================== */
  530. /* Profiling-related calls                                                */
  531. /* ==================================================================== */
  532.  
  533. HostErrType            HostProfileInit(long maxCalls, long maxDepth)
  534.                         HOST_TRAP(hostSelectorProfileInit);
  535.  
  536. HostErrType            HostProfileDetailFn(void* addr, HostBoolType logDetails)
  537.                         HOST_TRAP(hostSelectorProfileDetailFn);
  538.  
  539. HostErrType            HostProfileStart(void)
  540.                         HOST_TRAP(hostSelectorProfileStart);
  541.  
  542. HostErrType            HostProfileStop(void)
  543.                         HOST_TRAP(hostSelectorProfileStop);
  544.  
  545. HostErrType            HostProfileDump(const char* filename)
  546.                         HOST_TRAP(hostSelectorProfileDump);
  547.  
  548. HostErrType            HostProfileCleanup(void)
  549.                         HOST_TRAP(hostSelectorProfileCleanup);
  550.  
  551.  
  552. /* ==================================================================== */
  553. /* Std C Library-related calls                                            */
  554. /* ==================================================================== */
  555.  
  556. long                HostErrNo(void)
  557.                         HOST_TRAP(hostSelectorErrNo);
  558.  
  559.  
  560. long                HostFClose(HostFILEType* f)
  561.                         HOST_TRAP(hostSelectorFClose);
  562.  
  563. long                HostFEOF(HostFILEType* f)
  564.                         HOST_TRAP(hostSelectorFEOF);
  565.  
  566. long                HostFError(HostFILEType* f)
  567.                         HOST_TRAP(hostSelectorFError);
  568.  
  569. long                HostFFlush(HostFILEType* f)
  570.                         HOST_TRAP(hostSelectorFFlush);
  571.  
  572. long                HostFGetC(HostFILEType* f)
  573.                         HOST_TRAP(hostSelectorFGetC);
  574.  
  575. long                HostFGetPos(HostFILEType* f, long* posP)
  576.                         HOST_TRAP(hostSelectorFGetPos);
  577.  
  578. char*                HostFGetS(char* s, long n, HostFILEType* f)
  579.                         HOST_TRAP(hostSelectorFGetS);
  580.  
  581. HostFILEType*        HostFOpen(const char* name, const char* mode)
  582.                         HOST_TRAP(hostSelectorFOpen);
  583.  
  584. long                HostFPrintF(HostFILEType* f, const char* fmt, ...)
  585.                         HOST_TRAP(hostSelectorFPrintF);
  586.  
  587. long                HostFPutC(long c, HostFILEType* f)
  588.                         HOST_TRAP(hostSelectorFPutC);
  589.  
  590. long                HostFPutS(const char* s, HostFILEType* f)
  591.                         HOST_TRAP(hostSelectorFPutS);
  592.  
  593. long                HostFRead(void* buffer, long size, long count, HostFILEType* f)
  594.                         HOST_TRAP(hostSelectorFRead);
  595.  
  596. long                HostRemove(const char* name)
  597.                         HOST_TRAP(hostSelectorRemove);
  598.  
  599. long                HostRename(const char* oldName, const char* newName)
  600.                         HOST_TRAP(hostSelectorRename);
  601.  
  602. HostFILEType*        HostFReopen(const char* name, const char* mode, HostFILEType* f)
  603.                         HOST_TRAP(hostSelectorFReopen);
  604.  
  605. long                HostFScanF(HostFILEType* f, const char* fmt, ...)
  606.                         HOST_TRAP(hostSelectorFScanF);
  607.  
  608. long                HostFSeek(HostFILEType* f, long offset, long origin)
  609.                         HOST_TRAP(hostSelectorFSeek);
  610.  
  611. long                HostFSetPos(HostFILEType* f, long* pos)
  612.                         HOST_TRAP(hostSelectorFSetPos);
  613.  
  614. long                HostFTell(HostFILEType* f)
  615.                         HOST_TRAP(hostSelectorFTell);
  616.  
  617. long                HostFWrite(const void* buffer, long size, long count, HostFILEType* f)
  618.                         HOST_TRAP(hostSelectorFWrite);
  619.  
  620. HostFILEType*        HostTmpFile(void)
  621.                         HOST_TRAP(hostSelectorTmpFile);
  622.  
  623. char*                HostTmpNam(char* name)
  624.                         HOST_TRAP(hostSelectorTmpNam);
  625.  
  626. char*                HostGetEnv(const char*)
  627.                         HOST_TRAP(hostSelectorGetEnv);
  628.  
  629.  
  630. void*                HostMalloc(long size)
  631.                         HOST_TRAP(hostSelectorMalloc);
  632.  
  633. void*                HostRealloc(void* p, long size)
  634.                         HOST_TRAP(hostSelectorRealloc);
  635.  
  636. void                HostFree(void* p)
  637.                         HOST_TRAP(hostSelectorFree);
  638.  
  639.  
  640. char*                HostAscTime(const HostTmType*)
  641.                         HOST_TRAP(hostSelectorAscTime);
  642.  
  643. char*                HostCTime(const HostTimeType*)
  644.                         HOST_TRAP(hostSelectorCTime);
  645.  
  646. HostClockType        HostClock(void)
  647.                         HOST_TRAP(hostSelectorClock);
  648.  
  649. //double                HostDiffTime(HostTimeType, HostTimeType)
  650. //                        HOST_TRAP(hostSelectorDiffTime);
  651.  
  652. HostTmType*            HostGMTime(const HostTimeType*)
  653.                         HOST_TRAP(hostSelectorGMTime);
  654.  
  655. HostTmType*            HostLocalTime(const HostTimeType*)
  656.                         HOST_TRAP(hostSelectorLocalTime);
  657.  
  658. HostTimeType        HostMkTime(HostTmType*)
  659.                         HOST_TRAP(hostSelectorMkTime);
  660.  
  661. HostSizeType        HostStrFTime(char*, HostSizeType, const char*, const HostTmType*)
  662.                         HOST_TRAP(hostSelectorStrFTime);
  663.  
  664. HostTimeType        HostTime(HostTimeType*)
  665.                         HOST_TRAP(hostSelectorTime);
  666.  
  667.  
  668. long                HostMkDir(const char*)
  669.                         HOST_TRAP(hostSelectorMkDir);
  670.  
  671. long                HostRmDir(const char*)
  672.                         HOST_TRAP(hostSelectorRmDir);
  673.  
  674. HostDIRType*        HostOpenDir(const char*)
  675.                         HOST_TRAP(hostSelectorOpenDir);
  676.  
  677. HostDirEntType*        HostReadDir(HostDIRType*)
  678.                         HOST_TRAP(hostSelectorReadDir);
  679.  
  680. long                HostCloseDir(HostDIRType*)
  681.                         HOST_TRAP(hostSelectorCloseDir);
  682.  
  683.  
  684. long                HostStat(const char*, HostStatType*)
  685.                         HOST_TRAP(hostSelectorStat);
  686.  
  687. long                HostTruncate(const char*, long)
  688.                         HOST_TRAP(hostSelectorTruncate);
  689.  
  690.  
  691. long                HostUTime (const char*, HostUTimeType*)
  692.                         HOST_TRAP(hostSelectorUTime);
  693.  
  694.  
  695. /* ==================================================================== */
  696. /* Gremlin-related calls                                                */
  697. /* ==================================================================== */
  698.  
  699. HostBoolType        HostGremlinIsRunning(void)
  700.                         HOST_TRAP(hostSelectorGremlinIsRunning);
  701.  
  702. long                HostGremlinNumber(void)
  703.                         HOST_TRAP(hostSelectorGremlinNumber);
  704.  
  705. long                HostGremlinCounter(void)
  706.                         HOST_TRAP(hostSelectorGremlinCounter);
  707.  
  708. long                HostGremlinLimit(void)
  709.                         HOST_TRAP(hostSelectorGremlinLimit);
  710.  
  711. HostErrType            HostGremlinNew(const HostGremlinInfoType*)
  712.                         HOST_TRAP(hostSelectorGremlinNew);
  713.  
  714.  
  715. /* ==================================================================== */
  716. /* Import/export-related calls                                            */
  717. /* ==================================================================== */
  718.  
  719. HostErrType            HostImportFile(const char* fileName, long cardNum)
  720.                         HOST_TRAP(hostSelectorImportFile);
  721.  
  722. HostErrType            HostExportFile(const char* fileName, long cardNum, const char* dbName)
  723.                         HOST_TRAP(hostSelectorExportFile);
  724.  
  725.     // These are private, internal functions.  Third party applications
  726.     // should not be calling them.
  727.  
  728. Err                    HostExgLibOpen            (UInt16 libRefNum)
  729.                         HOST_TRAP(hostSelectorExgLibOpen);
  730.  
  731. Err                    HostExgLibClose            (UInt16 libRefNum)
  732.                         HOST_TRAP(hostSelectorExgLibClose);
  733.  
  734. Err                    HostExgLibSleep            (UInt16 libRefNum)
  735.                         HOST_TRAP(hostSelectorExgLibSleep);
  736.  
  737. Err                    HostExgLibWake            (UInt16 libRefNum)
  738.                         HOST_TRAP(hostSelectorExgLibWake);
  739.  
  740. Err                    HostExgLibHandleEvent    (UInt16 libRefNum, void* eventP)
  741.                         HOST_TRAP(hostSelectorExgLibHandleEvent);
  742.  
  743. Err                     HostExgLibConnect        (UInt16 libRefNum, void* exgSocketP)
  744.                         HOST_TRAP(hostSelectorExgLibConnect);
  745.  
  746. Err                    HostExgLibAccept        (UInt16 libRefNum, void* exgSocketP)
  747.                         HOST_TRAP(hostSelectorExgLibAccept);
  748.  
  749. Err                    HostExgLibDisconnect    (UInt16 libRefNum, void* exgSocketP,Err error)
  750.                         HOST_TRAP(hostSelectorExgLibDisconnect);
  751.  
  752. Err                    HostExgLibPut            (UInt16 libRefNum, void* exgSocketP)
  753.                         HOST_TRAP(hostSelectorExgLibPut);
  754.  
  755. Err                    HostExgLibGet            (UInt16 libRefNum, void* exgSocketP)
  756.                         HOST_TRAP(hostSelectorExgLibGet);
  757.  
  758. UInt32                 HostExgLibSend            (UInt16 libRefNum, void* exgSocketP, const void* const bufP, const UInt32 bufLen, Err* errP)
  759.                         HOST_TRAP(hostSelectorExgLibSend);
  760.  
  761. UInt32                 HostExgLibReceive        (UInt16 libRefNum, void* exgSocketP, void* bufP, const UInt32 bufSize, Err* errP)
  762.                         HOST_TRAP(hostSelectorExgLibReceive);
  763.  
  764. Err                 HostExgLibControl        (UInt16 libRefNum, UInt16 op, void* valueP, UInt16* valueLenP)
  765.                         HOST_TRAP(hostSelectorExgLibControl);
  766.  
  767. Err                 HostExgLibRequest        (UInt16 libRefNum, void* exgSocketP)
  768.                         HOST_TRAP(hostSelectorExgLibRequest);
  769.  
  770.  
  771. /* ==================================================================== */
  772. /* Preference-related calls                                                */
  773. /* ==================================================================== */
  774.  
  775. HostBoolType        HostGetPreference(const char*, char*)
  776.                         HOST_TRAP(hostSelectorGetPreference);
  777.  
  778. void                HostSetPreference(const char*, const char*)
  779.                         HOST_TRAP(hostSelectorSetPreference);
  780.  
  781.  
  782. /* ==================================================================== */
  783. /* Logging-related calls                                                */
  784. /* ==================================================================== */
  785.  
  786. HostFILEType*        HostLogFile(void)
  787.                         HOST_TRAP(hostSelectorLogFile);
  788.  
  789. void                HostSetLogFileSize(long)
  790.                         HOST_TRAP(hostSelectorSetLogFileSize);
  791.  
  792.  
  793. /* ==================================================================== */
  794. /* RPC-related calls                                                    */
  795. /* ==================================================================== */
  796.  
  797. HostErrType            HostSessionCreate(const char* device, long ramSize, const char* romPath)
  798.                         HOST_TRAP(hostSelectorSessionCreate);
  799.  
  800. HostErrType            HostSessionOpen(const char* psfFileName)
  801.                         HOST_TRAP(hostSelectorSessionOpen);
  802.  
  803. HostErrType            HostSessionClose(const char* saveFileName)
  804.                         HOST_TRAP(hostSelectorSessionClose);
  805.  
  806. HostErrType            HostSessionQuit(void)
  807.                         HOST_TRAP(hostSelectorSessionQuit);
  808.  
  809. HostErrType            HostSignalSend(HostSignalType signalNumber)
  810.                         HOST_TRAP(hostSelectorSignalSend);
  811.  
  812. HostErrType            HostSignalWait(long timeout, HostSignalType* signalNumber)
  813.                         HOST_TRAP(hostSelectorSignalWait);
  814.  
  815. HostErrType            HostSignalResume(void)
  816.                         HOST_TRAP(hostSelectorSignalResume);
  817.  
  818.  
  819. /* ==================================================================== */
  820. /* Tracing calls                                                        */
  821. /* ==================================================================== */
  822.  
  823. void                HostTraceInit(void)
  824.                         HOST_TRAP(hostSelectorTraceInit);
  825.  
  826. void                HostTraceClose(void)
  827.                         HOST_TRAP(hostSelectorTraceClose);
  828.  
  829. void                HostTraceOutputT(unsigned short, const char*, ...)
  830.                         HOST_TRAP(hostSelectorTraceOutputT);
  831.  
  832. void                HostTraceOutputTL(unsigned short, const char*, ...)
  833.                         HOST_TRAP(hostSelectorTraceOutputTL);
  834.  
  835. void                HostTraceOutputVT(unsigned short, const char*, char* /*va_list*/)
  836.                         HOST_TRAP(hostSelectorTraceOutputVT);
  837.  
  838. void                HostTraceOutputVTL(unsigned short, const char*, char* /*va_list*/)
  839.                         HOST_TRAP(hostSelectorTraceOutputVTL);
  840.  
  841. void                HostTraceOutputB(unsigned short, const unsigned char*, unsigned long/*size_t*/)
  842.                         HOST_TRAP(hostSelectorTraceOutputB);
  843.  
  844.  
  845. #if INCLUDE_SECRET_STUFF
  846. /* ==================================================================== */
  847. /* Slot related calls                                                    */
  848. /* ==================================================================== */
  849.  
  850. long                HostSlotMax(void)
  851.                         HOST_TRAP(hostSelectorSlotMax);
  852.  
  853. const char*            HostSlotRoot(long slotNo)
  854.                         HOST_TRAP(hostSelectorSlotRoot);
  855.  
  856. HostBoolType        HostSlotHasCard(long slotNo)
  857.                         HOST_TRAP(hostSelectorSlotHasCard);
  858.  
  859.  
  860. #endif    // INCLUDE_SECRET_STUFF
  861. /* ==================================================================== */
  862. /* File Choosing support                                                */
  863. /* ==================================================================== */
  864.  
  865. const char*            HostGetFile(const char* prompt, const char* defaultDir)
  866.                         HOST_TRAP(hostSelectorGetFile);
  867.  
  868. const char*            HostPutFile(const char* prompt, const char* defaultDir, const char* defaultName)
  869.                         HOST_TRAP(hostSelectorPutFile);
  870.  
  871. const char*            HostGetDirectory(const char* prompt, const char* defaultDir)
  872.                         HOST_TRAP(hostSelectorGetDirectory);
  873.  
  874. #ifdef __cplusplus 
  875. }
  876. #endif
  877.  
  878. #endif /* _HOSTCONTROL_H_ */
  879.