home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Utilities / Partition Logic 0.68 / partlogic-0.68.iso / system / headers / sys / api.h next >
Encoding:
C/C++ Source or Header  |  2007-05-10  |  142.3 KB  |  2,906 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2007 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  api.h
  20. //
  21.  
  22. // This file describes all of the functions that are directly exported by
  23. // the Visopsys kernel to the outside world.  All functions and their
  24. // numbers are listed here, as well as macros needed to perform call-gate
  25. // calls into the kernel.  Also, each exported kernel function is represented
  26. // here in the form of a little inline function.
  27.  
  28. #if !defined(_API_H)
  29.  
  30. // This file should mostly never be included when we're compiling a kernel
  31. // file (kernelApi.c is an exception)
  32. #if defined(KERNEL)
  33. #error "You cannot call the kernel API from within a kernel function"
  34. #endif
  35.  
  36. #ifndef _X_
  37. #define _X_
  38. #endif
  39.  
  40. #include <time.h>
  41. #include <sys/cdefs.h>
  42. #include <sys/device.h>
  43. #include <sys/disk.h>
  44. #include <sys/file.h>
  45. #include <sys/image.h>
  46. #include <sys/loader.h>
  47. #include <sys/lock.h>
  48. #include <sys/memory.h>
  49. #include <sys/network.h>
  50. #include <sys/process.h>
  51. #include <sys/progress.h>
  52. #include <sys/stream.h>
  53. #include <sys/text.h>
  54. #include <sys/utsname.h>
  55. #include <sys/variable.h>
  56. #include <sys/window.h>
  57.  
  58. // Included in the Visopsys standard library to prevent API calls from
  59. // within kernel code.
  60. extern int visopsys_in_kernel;
  61.  
  62. // This is the big list of kernel function codes.
  63.  
  64. // Text input/output functions.  All are in the 1000-1999 range.
  65. #define _fnum_textGetConsoleInput                    1000
  66. #define _fnum_textSetConsoleInput                    1001
  67. #define _fnum_textGetConsoleOutput                   1002
  68. #define _fnum_textSetConsoleOutput                   1003
  69. #define _fnum_textGetCurrentInput                    1004
  70. #define _fnum_textSetCurrentInput                    1005
  71. #define _fnum_textGetCurrentOutput                   1006
  72. #define _fnum_textSetCurrentOutput                   1007
  73. #define _fnum_textGetForeground                      1008
  74. #define _fnum_textSetForeground                      1009
  75. #define _fnum_textGetBackground                      1010
  76. #define _fnum_textSetBackground                      1011
  77. #define _fnum_textPutc                               1012
  78. #define _fnum_textPrint                              1013
  79. #define _fnum_textPrintAttrs                         1014
  80. #define _fnum_textPrintLine                          1015
  81. #define _fnum_textNewline                            1016
  82. #define _fnum_textBackSpace                          1017
  83. #define _fnum_textTab                                1018
  84. #define _fnum_textCursorUp                           1019
  85. #define _fnum_textCursorDown                         1020
  86. #define _fnum_ternelTextCursorLeft                   1021
  87. #define _fnum_textCursorRight                        1022
  88. #define _fnum_textEnableScroll                       1023
  89. #define _fnum_textScroll                             1024
  90. #define _fnum_textGetNumColumns                      1025
  91. #define _fnum_textGetNumRows                         1026
  92. #define _fnum_textGetColumn                          1027
  93. #define _fnum_textSetColumn                          1028
  94. #define _fnum_textGetRow                             1029
  95. #define _fnum_textSetRow                             1030
  96. #define _fnum_textSetCursor                          1031
  97. #define _fnum_textScreenClear                        1032
  98. #define _fnum_textScreenSave                         1033
  99. #define _fnum_textScreenRestore                      1034
  100. #define _fnum_textInputStreamCount                   1035
  101. #define _fnum_textInputCount                         1036
  102. #define _fnum_textInputStreamGetc                    1037
  103. #define _fnum_textInputGetc                          1038
  104. #define _fnum_textInputStreamReadN                   1039
  105. #define _fnum_textInputReadN                         1040
  106. #define _fnum_textInputStreamReadAll                 1041
  107. #define _fnum_textInputReadAll                       1042
  108. #define _fnum_textInputStreamAppend                  1043
  109. #define _fnum_textInputAppend                        1044
  110. #define _fnum_textInputStreamAppendN                 1045
  111. #define _fnum_textInputAppendN                       1046
  112. #define _fnum_textInputStreamRemove                  1047
  113. #define _fnum_textInputRemove                        1048
  114. #define _fnum_textInputStreamRemoveN                 1049
  115. #define _fnum_textInputRemoveN                       1050
  116. #define _fnum_textInputStreamRemoveAll               1051
  117. #define _fnum_textInputRemoveAll                     1052
  118. #define _fnum_textInputStreamSetEcho                 1053
  119. #define _fnum_textInputSetEcho                       1054
  120.  
  121. // Disk functions.  All are in the 2000-2999 range.
  122. #define _fnum_diskReadPartitions                     2000
  123. #define _fnum_diskReadPartitionsAll                  2001
  124. #define _fnum_diskSync                               2002
  125. #define _fnum_diskSyncAll                            2003
  126. #define _fnum_diskGetBoot                            2004
  127. #define _fnum_diskGetCount                           2005
  128. #define _fnum_diskGetPhysicalCount                   2006
  129. #define _fnum_diskGet                                2007
  130. #define _fnum_diskGetAll                             2008
  131. #define _fnum_diskGetAllPhysical                     2009
  132. #define _fnum_diskGetFilesystemType                  2010
  133. #define _fnum_diskGetPartType                        2011
  134. #define _fnum_diskGetPartTypes                       2012
  135. #define _fnum_diskSetFlags                           2013
  136. #define _fnum_diskSetLockState                       2014
  137. #define _fnum_diskSetDoorState                       2015
  138. #define _fnum_diskGetMediaState                      2016
  139. #define _fnum_diskReadSectors                        2017
  140. #define _fnum_diskWriteSectors                       2018
  141. #define _fnum_diskEraseSectors                       2019
  142. #define _fnum_diskGetStats                           2020
  143.  
  144. // Filesystem functions.  All are in the 3000-3999 range.
  145. #define _fnum_filesystemFormat                       3000
  146. #define _fnum_filesystemClobber                      3001
  147. #define _fnum_filesystemCheck                        3002
  148. #define _fnum_filesystemDefragment                   3003
  149. #define _fnum_filesystemResizeConstraints            3004
  150. #define _fnum_filesystemResize                       3005
  151. #define _fnum_filesystemMount                        3006
  152. #define _fnum_filesystemUnmount                      3007
  153. #define _fnum_filesystemGetFree                      3008
  154. #define _fnum_filesystemGetBlockSize                 3009
  155.  
  156. // File functions.  All are in the 4000-4999 range.
  157. #define _fnum_fileFixupPath                          4000
  158. #define _fnum_fileGetDisk                            4001
  159. #define _fnum_fileCount                              4002
  160. #define _fnum_fileFirst                              4003
  161. #define _fnum_fileNext                               4004
  162. #define _fnum_fileFind                               4005
  163. #define _fnum_fileOpen                               4006
  164. #define _fnum_fileClose                              4007
  165. #define _fnum_fileRead                               4008
  166. #define _fnum_fileWrite                              4009
  167. #define _fnum_fileDelete                             4010
  168. #define _fnum_fileDeleteRecursive                    4011
  169. #define _fnum_fileDeleteSecure                       4012
  170. #define _fnum_fileMakeDir                            4013
  171. #define _fnum_fileRemoveDir                          4014
  172. #define _fnum_fileCopy                               4015
  173. #define _fnum_fileCopyRecursive                      4016
  174. #define _fnum_fileMove                               4017
  175. #define _fnum_fileTimestamp                          4018
  176. #define _fnum_fileGetTemp                            4019
  177. #define _fnum_fileStreamOpen                         4020
  178. #define _fnum_fileStreamSeek                         4021
  179. #define _fnum_fileStreamRead                         4022
  180. #define _fnum_fileStreamReadLine                     4023
  181. #define _fnum_fileStreamWrite                        4024
  182. #define _fnum_fileStreamWriteStr                     4025
  183. #define _fnum_fileStreamWriteLine                    4026
  184. #define _fnum_fileStreamFlush                        4027
  185. #define _fnum_fileStreamClose                        4028
  186.  
  187. // Memory manager functions.  All are in the 5000-5999 range.
  188. #define _fnum_memoryGet                              5000
  189. #define _fnum_memoryGetPhysical                      5001
  190. #define _fnum_memoryRelease                          5002
  191. #define _fnum_memoryReleaseAllByProcId               5003
  192. #define _fnum_memoryChangeOwner                      5004
  193. #define _fnum_memoryGetStats                         5005
  194. #define _fnum_memoryGetBlocks                        5006
  195. #define _fnum_memoryBlockInfo                        5007
  196.  
  197. // Multitasker functions.  All are in the 6000-6999 range.
  198. #define _fnum_multitaskerCreateProcess               6000
  199. #define _fnum_multitaskerSpawn                       6001
  200. #define _fnum_multitaskerGetCurrentProcessId         6002
  201. #define _fnum_multitaskerGetProcess                  6003
  202. #define _fnum_multitaskerGetProcessByName            6004
  203. #define _fnum_multitaskerGetProcesses                6005
  204. #define _fnum_multitaskerSetProcessState             6006
  205. #define _fnum_multitaskerProcessIsAlive              6007
  206. #define _fnum_multitaskerSetProcessPriority          6008
  207. #define _fnum_multitaskerGetProcessPrivilege         6009
  208. #define _fnum_multitaskerGetCurrentDirectory         6010
  209. #define _fnum_multitaskerSetCurrentDirectory         6011
  210. #define _fnum_multitaskerGetTextInput                6012
  211. #define _fnum_multitaskerSetTextInput                6013
  212. #define _fnum_multitaskerGetTextOutput               6014
  213. #define _fnum_multitaskerSetTextOutput               6015
  214. #define _fnum_multitaskerDuplicateIO                 6016
  215. #define _fnum_multitaskerGetProcessorTime            6017
  216. #define _fnum_multitaskerYield                       6018
  217. #define _fnum_multitaskerWait                        6019
  218. #define _fnum_multitaskerBlock                       6020
  219. #define _fnum_multitaskerDetach                      6021
  220. #define _fnum_multitaskerKillProcess                 6022
  221. #define _fnum_multitaskerKillByName                  6023
  222. #define _fnum_multitaskerTerminate                   6024
  223. #define _fnum_multitaskerSignalSet                   6025
  224. #define _fnum_multitaskerSignal                      6026
  225. #define _fnum_multitaskerSignalRead                  6027
  226. #define _fnum_multitaskerGetIOPerm                   6028
  227. #define _fnum_multitaskerSetIOPerm                   6029
  228.  
  229. // Loader functions.  All are in the 7000-7999 range.
  230. #define _fnum_loaderLoad                             7000
  231. #define _fnum_loaderClassify                         7001
  232. #define _fnum_loaderClassifyFile                     7002
  233. #define _fnum_loaderGetSymbols                       7003
  234. #define _fnum_loaderCheckCommand                     7004
  235. #define _fnum_loaderLoadProgram                      7005
  236. #define _fnum_loaderLoadLibrary                      7006
  237. #define _fnum_loaderExecProgram                      7007
  238. #define _fnum_loaderLoadAndExec                      7008
  239.  
  240. // Real-time clock functions.  All are in the 8000-8999 range.
  241. #define _fnum_rtcReadSeconds                         8000
  242. #define _fnum_rtcReadMinutes                         8001
  243. #define _fnum_rtcReadHours                           8002
  244. #define _fnum_rtcDayOfWeek                           8003
  245. #define _fnum_rtcReadDayOfMonth                      8004
  246. #define _fnum_rtcReadMonth                           8005
  247. #define _fnum_rtcReadYear                            8006
  248. #define _fnum_rtcUptimeSeconds                       8007
  249. #define _fnum_rtcDateTime                            8008
  250.  
  251. // Random number functions.  All are in the 9000-9999 range.
  252. #define _fnum_randomUnformatted                      9000
  253. #define _fnum_randomFormatted                        9001
  254. #define _fnum_randomSeededUnformatted                9002
  255. #define _fnum_randomSeededFormatted                  9003
  256.  
  257. // Environment functions.  All are in the 10000-10999 range.
  258. #define _fnum_environmentGet                         10000
  259. #define _fnum_environmentSet                         10001
  260. #define _fnum_environmentUnset                       10002
  261. #define _fnum_environmentDump                        10003
  262.  
  263. // Raw graphics drawing functions.  All are in the 11000-11999 range
  264. #define _fnum_graphicsAreEnabled                     11000
  265. #define _fnum_graphicGetModes                        11001
  266. #define _fnum_graphicGetMode                         11002
  267. #define _fnum_graphicSetMode                         11003
  268. #define _fnum_graphicGetScreenWidth                  11004
  269. #define _fnum_graphicGetScreenHeight                 11005
  270. #define _fnum_graphicCalculateAreaBytes              11006
  271. #define _fnum_graphicClearScreen                     11007
  272. #define _fnum_graphicGetColor                        11008
  273. #define _fnum_graphicSetColor                        11009
  274. #define _fnum_graphicDrawPixel                       11010
  275. #define _fnum_graphicDrawLine                        11011
  276. #define _fnum_graphicDrawRect                        11012
  277. #define _fnum_graphicDrawOval                        11013
  278. #define _fnum_graphicDrawImage                       11014
  279. #define _fnum_graphicGetImage                        11015
  280. #define _fnum_graphicDrawText                        11016
  281. #define _fnum_graphicCopyArea                        11017
  282. #define _fnum_graphicClearArea                       11018
  283. #define _fnum_graphicRenderBuffer                    11019
  284.  
  285. // Windowing system functions.  All are in the 12000-12999 range
  286. #define _fnum_windowLogin                            12000
  287. #define _fnum_windowLogout                           12001
  288. #define _fnum_windowNew                              12002
  289. #define _fnum_windowNewDialog                        12003
  290. #define _fnum_windowDestroy                          12004
  291. #define _fnum_windowUpdateBuffer                     12005
  292. #define _fnum_windowSetTitle                         12006
  293. #define _fnum_windowGetSize                          12007
  294. #define _fnum_windowSetSize                          12008
  295. #define _fnum_windowGetLocation                      12009
  296. #define _fnum_windowSetLocation                      12010
  297. #define _fnum_windowCenter                           12011
  298. #define _fnum_windowSnapIcons                        12012
  299. #define _fnum_windowSetHasBorder                     12013
  300. #define _fnum_windowSetHasTitleBar                   12014
  301. #define _fnum_windowSetMovable                       12015
  302. #define _fnum_windowSetResizable                     12016
  303. #define _fnum_windowRemoveMinimizeButton             12017
  304. #define _fnum_windowRemoveCloseButton                12018
  305. #define _fnum_windowSetColors                        12019
  306. #define _fnum_windowSetVisible                       12020
  307. #define _fnum_windowSetMinimized                     12021 
  308. #define _fnum_windowAddConsoleTextArea               12022
  309. #define _fnum_windowRedrawArea                       12023
  310. #define _fnum_windowDrawAll                          12024
  311. #define _fnum_windowResetColors                      12025
  312. #define _fnum_windowProcessEvent                     12026
  313. #define _fnum_windowComponentEventGet                12027
  314. #define _fnum_windowTileBackground                   12028
  315. #define _fnum_windowCenterBackground                 12029
  316. #define _fnum_windowScreenShot                       12030
  317. #define _fnum_windowSaveScreenShot                   12031
  318. #define _fnum_windowSetTextOutput                    12032
  319. #define _fnum_windowLayout                           12033
  320. #define _fnum_windowDebugLayout                      12034
  321. #define _fnum_windowContextAdd                       12035
  322. #define _fnum_windowContextSet                       12036
  323. #define _fnum_windowSwitchPointer                    12037
  324. #define _fnum_windowComponentDestroy                 12038
  325. #define _fnum_windowComponentSetVisible              12039
  326. #define _fnum_windowComponentSetEnabled              12040
  327. #define _fnum_windowComponentGetWidth                12041
  328. #define _fnum_windowComponentSetWidth                12042
  329. #define _fnum_windowComponentGetHeight               12043
  330. #define _fnum_windowComponentSetHeight               12044
  331. #define _fnum_windowComponentFocus                   12045
  332. #define _fnum_windowComponentDraw                    12046
  333. #define _fnum_windowComponentGetData                 12047
  334. #define _fnum_windowComponentSetData                 12048
  335. #define _fnum_windowComponentGetSelected             12049
  336. #define _fnum_windowComponentSetSelected             12050
  337. #define _fnum_windowNewButton                        12051
  338. #define _fnum_windowNewCanvas                        12052
  339. #define _fnum_windowNewCheckbox                      12053
  340. #define _fnum_windowNewContainer                     12054
  341. #define _fnum_windowNewIcon                          12055
  342. #define _fnum_windowNewImage                         12056
  343. #define _fnum_windowNewList                          12057
  344. #define _fnum_windowNewListItem                      12058
  345. #define _fnum_windowNewMenu                          12059
  346. #define _fnum_windowNewMenuBar                       12060
  347. #define _fnum_windowNewMenuItem                      12061
  348. #define _fnum_windowNewPasswordField                 12062
  349. #define _fnum_windowNewProgressBar                   12063
  350. #define _fnum_windowNewRadioButton                   12064
  351. #define _fnum_windowNewScrollBar                     12065
  352. #define _fnum_windowNewSlider                        12066
  353. #define _fnum_windowNewTextArea                      12067
  354. #define _fnum_windowNewTextField                     12068
  355. #define _fnum_windowNewTextLabel                     12069
  356.  
  357. // User functions.  All are in the 13000-13999 range
  358. #define _fnum_userAuthenticate                       13000
  359. #define _fnum_userLogin                              13001
  360. #define _fnum_userLogout                             13002
  361. #define _fnum_userGetNames                           13003
  362. #define _fnum_userAdd                                13004
  363. #define _fnum_userDelete                             13005
  364. #define _fnum_userSetPassword                        13006
  365. #define _fnum_userGetPrivilege                       13007
  366. #define _fnum_userGetPid                             13008
  367. #define _fnum_userSetPid                             13009
  368. #define _fnum_userFileAdd                            13010
  369. #define _fnum_userFileDelete                         13011
  370. #define _fnum_userFileSetPassword                    13012
  371.  
  372. // Network functions.  All are in the 14000-14999 range
  373. #define _fnum_networkDeviceGetCount                  14000
  374. #define _fnum_networkDeviceGet                       14001
  375. #define _fnum_networkInitialized                     14002
  376. #define _fnum_networkInitialize                      14003
  377. #define _fnum_networkShutdown                        14004
  378. #define _fnum_networkOpen                            14005
  379. #define _fnum_networkClose                           14006
  380. #define _fnum_networkCount                           14007
  381. #define _fnum_networkRead                            14008
  382. #define _fnum_networkWrite                           14009
  383. #define _fnum_networkPing                            14010
  384. #define _fnum_networkGetHostName                     14011
  385. #define _fnum_networkSetHostName                     14012
  386. #define _fnum_networkGetDomainName                   14013
  387. #define _fnum_networkSetDomainName                   14014
  388.  
  389. // Miscellaneous functions.  All are in the 99000-99999 range
  390. #define _fnum_fontGetDefault                         99000
  391. #define _fnum_fontSetDefault                         99001
  392. #define _fnum_fontLoad                               99002
  393. #define _fnum_fontGetPrintedWidth                    99003
  394. #define _fnum_fontGetWidth                           99004
  395. #define _fnum_fontGetHeight                          99005
  396. #define _fnum_imageLoad                              99006
  397. #define _fnum_imageSave                              99007
  398. #define _fnum_shutdown                               99008
  399. #define _fnum_getVersion                             99009
  400. #define _fnum_systemInfo                             99010
  401. #define _fnum_encryptMD5                             99011
  402. #define _fnum_lockGet                                99012
  403. #define _fnum_lockRelease                            99013
  404. #define _fnum_lockVerify                             99014
  405. #define _fnum_variableListCreate                     99015
  406. #define _fnum_variableListDestroy                    99016
  407. #define _fnum_variableListGet                        99017
  408. #define _fnum_variableListSet                        99018
  409. #define _fnum_variableListUnset                      99019
  410. #define _fnum_configurationReader                    99020
  411. #define _fnum_configurationWriter                    99021
  412. #define _fnum_keyboardGetMaps                        99022
  413. #define _fnum_keyboardSetMap                         99023
  414. #define _fnum_deviceTreeGetCount                     99024
  415. #define _fnum_deviceTreeGetRoot                      99025
  416. #define _fnum_deviceTreeGetChild                     99026
  417. #define _fnum_deviceTreeGetNext                      99027
  418. #define _fnum_mouseLoadPointer                       99028
  419.  
  420. // For convenience
  421. #define syscall_0(fnum, arg...) _syscall(fnum, 0, ##arg)
  422. #define syscall_1(fnum, arg...) _syscall(fnum, 1, ##arg)
  423. #define syscall_2(fnum, arg...) _syscall(fnum, 2, ##arg)
  424. #define syscall_3(fnum, arg...) _syscall(fnum, 3, ##arg)
  425. #define syscall_4(fnum, arg...) _syscall(fnum, 4, ##arg)
  426. #define syscall_5(fnum, arg...) _syscall(fnum, 5, ##arg)
  427. #define syscall_6(fnum, arg...) _syscall(fnum, 6, ##arg)
  428. #define syscall_7(fnum, arg...) _syscall(fnum, 7, ##arg)
  429. #define syscall_8(fnum, arg...) _syscall(fnum, 8, ##arg)
  430. #define syscall_9(fnum, arg...) _syscall(fnum, 9, ##arg)
  431.  
  432.  
  433. // These inline functions are used to call specific kernel functions.  
  434. // There will be one of these for every API function.
  435.  
  436.  
  437. //
  438. // Text input/output functions
  439. //
  440.  
  441. _X_ static inline objectKey textGetConsoleInput(void)
  442. {
  443.   // Proto: kernelTextInputStream *kernelTextGetConsoleInput(void);
  444.   // Desc : Returns a reference to the console input stream.  This is where keyboard input goes by default.
  445.   return ((objectKey) syscall_0(_fnum_textGetConsoleInput));
  446. }
  447.  
  448. _X_ static inline int textSetConsoleInput(objectKey newStream)
  449. {
  450.   // Proto: int kernelTextSetConsoleInput(kernelTextInputStream *);
  451.   // Desc : Changes the console input stream.  GUI programs can use this function to redirect input to a text area or text field, for example.
  452.   return (syscall_1(_fnum_textSetConsoleInput, newStream));
  453. }
  454.  
  455. _X_ static inline objectKey textGetConsoleOutput(void)
  456. {
  457.   // Proto: kernelTextOutputStream *kernelTextGetConsoleOutput(void);
  458.   // Desc : Returns a reference to the console output stream.  This is where kernel logging output goes by default.
  459.   return ((objectKey) syscall_0(_fnum_textGetConsoleOutput));
  460. }
  461.  
  462. _X_ static inline int textSetConsoleOutput(objectKey newStream)
  463. {
  464.   // Proto: int kernelTextSetConsoleOutput(kernelTextOutputStream *);
  465.   // Desc : Changes the console output stream.  GUI programs can use this function to redirect output to a text area or text field, for example.
  466.   return (syscall_1(_fnum_textSetConsoleOutput, newStream));
  467. }
  468.  
  469. _X_ static inline objectKey textGetCurrentInput(void)
  470. {
  471.   // Proto: kernelTextInputStream *kernelTextGetCurrentInput(void);
  472.   // Desc : Returns a reference to the input stream of the current process.  This is where standard input (for example, from a getc() call) is received.
  473.   return ((objectKey) syscall_0(_fnum_textGetCurrentInput));
  474. }
  475.  
  476. _X_ static inline int textSetCurrentInput(objectKey newStream)
  477. {
  478.   // Proto: int kernelTextSetCurrentInput(kernelTextInputStream *);
  479.   // Desc : Changes the current input stream.  GUI programs can use this function to redirect input to a text area or text field, for example.
  480.   return (syscall_1(_fnum_textSetCurrentInput, newStream));
  481. }
  482.  
  483. _X_ static inline objectKey textGetCurrentOutput(void)
  484. {
  485.   // Proto: kernelTextOutputStream *kernelTextGetCurrentOutput(void);
  486.   // Desc : Returns a reference to the console output stream.
  487.   return ((objectKey) syscall_0(_fnum_textGetCurrentOutput));
  488. }
  489.  
  490. _X_ static inline int textSetCurrentOutput(objectKey newStream)
  491. {
  492.   // Proto: int kernelTextSetCurrentOutput(kernelTextOutputStream *);
  493.   // Desc : Changes the current output stream.  This is where standard output (for example, from a putc() call) goes.
  494.   return (syscall_1(_fnum_textSetCurrentOutput, newStream));
  495. }
  496.  
  497. _X_ static inline int textGetForeground(color *foreground)
  498. {
  499.   // Proto: int kernelTextGetForeground(color *);
  500.   // Desc : Return the current foreground color in the color structure 'foreground'.
  501.   return (syscall_1(_fnum_textGetForeground, foreground));
  502. }
  503.  
  504. _X_ static inline int textSetForeground(color *foreground)
  505. {
  506.   // Proto: int kernelTextSetForeground(color *);
  507.   // Desc : Set the current foreground color to the one represented in the color structure 'foreground'.  Some standard color values (as in PC text-mode values) can be found in <sys/color.h>.
  508.   return (syscall_1(_fnum_textSetForeground, foreground));
  509. }
  510.  
  511. _X_ static inline int textGetBackground(color *background)
  512. {
  513.   // Proto: int kernelTextGetBackground(color *);
  514.   // Desc : Return the current background color in the color structure 'background'.
  515.   return (syscall_1(_fnum_textGetBackground, background));
  516. }
  517.  
  518. _X_ static inline int textSetBackground(color *background)
  519. {
  520.   // Proto: int kernelTextSetBackground(color *);
  521.   // Desc : Set the current background color to the one represented in the color structure 'background'.  Some standard color values (as in PC text-mode values) can be found in <sys/color.h>.
  522.   return (syscall_1(_fnum_textSetBackground, background));
  523. }
  524.  
  525. _X_ static inline int textPutc(int ascii)
  526. {
  527.   // Proto: int kernelTextPutc(int);
  528.   // Desc : Print a single character
  529.   return (syscall_1(_fnum_textPutc, (void*)ascii));
  530. }
  531.  
  532. _X_ static inline int textPrint(const char *str)
  533. {
  534.   // Proto: int kernelTextPrint(const char *);
  535.   // Desc : Print a string
  536.   return (syscall_1(_fnum_textPrint, (void *) str));
  537. }
  538.  
  539. _X_ static inline int textPrintAttrs(textAttrs *attrs, const char *str)
  540. {
  541.   // Proto: int kernelTextPrintAttrs(textAttrs *, const char *, ...);
  542.   // Desc : Print a string, with attributes.  See <sys/text.h> for the definition of the textAttrs structure.
  543.   return (syscall_2(_fnum_textPrintAttrs, attrs, (void *) str));
  544. }
  545.  
  546. _X_ static inline int textPrintLine(const char *str)
  547. {
  548.   // Proto: int kernelTextPrintLine(const char *);
  549.   // Desc : Print a string with a newline at the end
  550.   return (syscall_1(_fnum_textPrintLine, (void *) str));
  551. }
  552.  
  553. _X_ static inline void textNewline(void)
  554. {
  555.   // Proto: void kernelTextNewline(void);
  556.   // Desc : Print a newline
  557.   syscall_0(_fnum_textNewline);
  558. }
  559.  
  560. _X_ static inline int textBackSpace(void)
  561. {
  562.   // Proto: void kernelTextBackSpace(void);
  563.   // Desc : Backspace the cursor, deleting any character there
  564.   return (syscall_0(_fnum_textBackSpace));
  565. }
  566.  
  567. _X_ static inline int textTab(void)
  568. {
  569.   // Proto: void kernelTextTab(void);
  570.   // Desc : Print a tab
  571.   return (syscall_0(_fnum_textTab));
  572. }
  573.  
  574. _X_ static inline int textCursorUp(void)
  575. {
  576.   // Proto: void kernelTextCursorUp(void);
  577.   // Desc : Move the cursor up one row.  Doesn't affect any characters there.
  578.   return (syscall_0(_fnum_textCursorUp));
  579. }
  580.  
  581. _X_ static inline int textCursorDown(void)
  582. {
  583.   // Proto: void kernelTextCursorDown(void);
  584.   // Desc : Move the cursor down one row.  Doesn't affect any characters there.
  585.   return (syscall_0(_fnum_textCursorDown));
  586. }
  587.  
  588. _X_ static inline int textCursorLeft(void)
  589. {
  590.   // Proto: void kernelTextCursorLeft(void);
  591.   // Desc : Move the cursor left one column.  Doesn't affect any characters there.
  592.   return (syscall_0(_fnum_ternelTextCursorLeft));
  593. }
  594.  
  595. _X_ static inline int textCursorRight(void)
  596. {
  597.   // Proto: void kernelTextCursorRight(void);
  598.   // Desc : Move the cursor right one column.  Doesn't affect any characters there.
  599.   return (syscall_0(_fnum_textCursorRight));
  600. }
  601.  
  602. _X_ static inline int textEnableScroll(int enable)
  603. {
  604.   // Proto: int kernelTextEnableScroll(int);
  605.   // Desc : Enable or disable screen scrolling for the current text output stream
  606.   return (syscall_1(_fnum_textEnableScroll, (void *) enable));
  607. }
  608.  
  609. _X_ static inline void textScroll(int upDown)
  610. {
  611.   // Proto: void kernelTextScroll(int upDown)
  612.   // Desc : Scroll the current text area up 'upDown' screenfulls, if negative, or down 'upDown' screenfulls, if positive.
  613.   syscall_1(_fnum_textScroll, (void *) upDown);
  614. }
  615.  
  616. _X_ static inline int textGetNumColumns(void)
  617. {
  618.   // Proto: int kernelTextGetNumColumns(void);
  619.   // Desc : Get the total number of columns in the text area.
  620.   return (syscall_0(_fnum_textGetNumColumns));
  621. }
  622.  
  623. _X_ static inline int textGetNumRows(void)
  624. {
  625.   // Proto: int kernelTextGetNumRows(void);
  626.   // Desc : Get the total number of rows in the text area.
  627.   return (syscall_0(_fnum_textGetNumRows));
  628. }
  629.  
  630. _X_ static inline int textGetColumn(void)
  631. {
  632.   // Proto: int kernelTextGetColumn(void);
  633.   // Desc : Get the number of the current column.  Zero-based.
  634.   return (syscall_0(_fnum_textGetColumn));
  635. }
  636.  
  637. _X_ static inline void textSetColumn(int c)
  638. {
  639.   // Proto: void kernelTextSetColumn(int);
  640.   // Desc : Set the number of the current column.  Zero-based.  Doesn't affect any characters there.
  641.   syscall_1(_fnum_textSetColumn, (void *) c);
  642. }
  643.  
  644. _X_ static inline int textGetRow(void)
  645. {
  646.   // Proto: int kernelTextGetRow(void);
  647.   // Desc : Get the number of the current row.  Zero-based.
  648.   return (syscall_0(_fnum_textGetRow));
  649. }
  650.  
  651. _X_ static inline void textSetRow(int r)
  652. {
  653.   // Proto: void kernelTextSetRow(int);
  654.   // Desc : Set the number of the current row.  Zero-based.  Doesn't affect any characters there.
  655.   syscall_1(_fnum_textSetRow, (void *) r);
  656. }
  657.  
  658. _X_ static inline void textSetCursor(int on)
  659. {
  660.   // Proto: void kernelTextSetCursor(int);
  661.   // Desc : Turn the cursor on (1) or off (0)
  662.   syscall_1(_fnum_textSetCursor, (void *) on);
  663. }
  664.  
  665. _X_ static inline int textScreenClear(void)
  666. {
  667.   // Proto: void kernelTextScreenClear(void);
  668.   // Desc : Erase all characters in the text area and set the row and column to (0, 0)
  669.   return (syscall_0(_fnum_textScreenClear));
  670. }
  671.  
  672. _X_ static inline int textScreenSave(textScreen *screen)
  673. {
  674.   // Proto: int kernelTextScreenSave(textScreen *);
  675.   // Desc : Save the current screen in the supplied structure.  Use with the textScreenRestore function.
  676.   return (syscall_1(_fnum_textScreenSave, screen));
  677. }
  678.  
  679. _X_ static inline int textScreenRestore(textScreen *screen)
  680. {
  681.   // Proto: int kernelTextScreenRestore(textScreen *);
  682.   // Desc : Restore the screen previously saved in the structure with the textScreenSave function
  683.   return (syscall_1(_fnum_textScreenRestore, screen));
  684. }
  685.  
  686. _X_ static inline int textInputStreamCount(objectKey strm)
  687. {
  688.   // Proto: int kernelTextInputStreamCount(kernelTextInputStream *);
  689.   // Desc : Get the number of characters currently waiting in the specified input stream
  690.   return (syscall_1(_fnum_textInputStreamCount, strm));
  691. }
  692.  
  693. _X_ static inline int textInputCount(void)
  694. {
  695.   // Proto: int kernelTextInputCount(void);
  696.   // Desc : Get the number of characters currently waiting in the current input stream
  697.   return (syscall_0(_fnum_textInputCount));
  698. }
  699.  
  700. _X_ static inline int textInputStreamGetc(objectKey strm, char *cp)
  701. {
  702.   // Proto: int kernelTextInputStreamGetc(kernelTextInputStream *, char *);
  703.   // Desc : Get one character from the specified input stream (as an integer value).
  704.   return (syscall_2(_fnum_textInputStreamGetc, strm, cp));
  705. }
  706.  
  707. _X_ static inline int textInputGetc(char *cp)
  708. {
  709.   // Proto: char kernelTextInputGetc(void);
  710.   // Desc : Get one character from the default input stream (as an integer value).
  711.   return (syscall_1(_fnum_textInputGetc, cp));
  712. }
  713.  
  714. _X_ static inline int textInputStreamReadN(objectKey strm, int num, char *buff)
  715. {
  716.   // Proto: int kernelTextInputStreamReadN(kernelTextInputStream *, int, char *);
  717.   // Desc : Read up to 'num' characters from the specified input stream into 'buff'
  718.   return (syscall_3(_fnum_textInputStreamReadN, strm, (void *) num, buff));
  719. }
  720.  
  721. _X_ static inline int textInputReadN(int num, char *buff)
  722. {
  723.   // Proto: int kernelTextInputReadN(int, char *);
  724.   // Desc : Read up to 'num' characters from the default input stream into 'buff'
  725.   return (syscall_2(_fnum_textInputReadN, (void *)num, buff));
  726. }
  727.  
  728. _X_ static inline int textInputStreamReadAll(objectKey strm, char *buff)
  729. {
  730.   // Proto: int kernelTextInputStreamReadAll(kernelTextInputStream *, char *);
  731.   // Desc : Read all of the characters from the specified input stream into 'buff'
  732.   return (syscall_2(_fnum_textInputStreamReadAll, strm, buff));
  733. }
  734.  
  735. _X_ static inline int textInputReadAll(char *buff)
  736. {
  737.   // Proto: int kernelTextInputReadAll(char *);
  738.   // Desc : Read all of the characters from the default input stream into 'buff'
  739.   return (syscall_1(_fnum_textInputReadAll, buff));
  740. }
  741.  
  742. _X_ static inline int textInputStreamAppend(objectKey strm, int ascii)
  743. {
  744.   // Proto: int kernelTextInputStreamAppend(kernelTextInputStream *, int);
  745.   // Desc : Append a character (as an integer value) to the end of the specified input stream.
  746.   return (syscall_2(_fnum_textInputStreamAppend, strm, (void *) ascii));
  747. }
  748.  
  749. _X_ static inline int textInputAppend(int ascii)
  750. {
  751.   // Proto: int kernelTextInputAppend(int);
  752.   // Desc : Append a character (as an integer value) to the end of the default input stream.
  753.   return (syscall_1(_fnum_textInputAppend, (void *) ascii));
  754. }
  755.  
  756. _X_ static inline int textInputStreamAppendN(objectKey strm, int num, char *str)
  757. {
  758.   // Proto: int kernelTextInputStreamAppendN(kernelTextInputStream *, int, char *);
  759.   // Desc : Append 'num' characters to the end of the specified input stream from 'str'
  760.   return (syscall_3(_fnum_textInputStreamAppendN, strm, (void *) num, str));
  761. }
  762.  
  763. _X_ static inline int textInputAppendN(int num, char *str)
  764. {
  765.   // Proto: int kernelTextInputAppendN(int, char *);
  766.   // Desc : Append 'num' characters to the end of the default input stream from 'str'
  767.   return (syscall_2(_fnum_textInputAppendN, (void *) num, str));
  768. }
  769.  
  770. _X_ static inline int textInputStreamRemove(objectKey strm)
  771. {
  772.   // Proto: int kernelTextInputStreamRemove(kernelTextInputStream *);
  773.   // Desc : Remove one character from the start of the specified input stream.
  774.   return (syscall_1(_fnum_textInputStreamRemove, strm));
  775. }
  776.  
  777. _X_ static inline int textInputRemove(void)
  778. {
  779.   // Proto: int kernelTextInputRemove(void);
  780.   // Desc : Remove one character from the start of the default input stream.
  781.   return (syscall_0(_fnum_textInputRemove));
  782. }
  783.  
  784. _X_ static inline int textInputStreamRemoveN(objectKey strm, int num)
  785. {
  786.   // Proto: int kernelTextInputStreamRemoveN(kernelTextInputStream *, int);
  787.   // Desc : Remove 'num' characters from the start of the specified input stream.
  788.   return (syscall_2(_fnum_textInputStreamRemoveN, strm, (void *) num));
  789. }
  790.  
  791. _X_ static inline int textInputRemoveN(int num)
  792. {
  793.   // Proto: int kernelTextInputRemoveN(int);
  794.   // Desc : Remove 'num' characters from the start of the default input stream.
  795.   return (syscall_1(_fnum_textInputRemoveN, (void *) num));
  796. }
  797.  
  798. _X_ static inline int textInputStreamRemoveAll(objectKey strm)
  799. {
  800.   // Proto: int kernelTextInputStreamRemoveAll(kernelTextInputStream *);
  801.   // Desc : Empty the specified input stream.
  802.   return (syscall_1(_fnum_textInputStreamRemoveAll, strm));
  803. }
  804.  
  805. _X_ static inline int textInputRemoveAll(void)
  806. {
  807.   // Proto: int kernelTextInputRemoveAll(void);
  808.   // Desc : Empty the default input stream.
  809.   return (syscall_0(_fnum_textInputRemoveAll));
  810. }
  811.  
  812. _X_ static inline void textInputStreamSetEcho(objectKey strm, int onOff)
  813. {
  814.   // Proto: void kernelTextInputStreamSetEcho(kernelTextInputStream *, int);
  815.   // Desc : Set echo on (1) or off (0) for the specified input stream.  When on, any characters typed will be automatically printed to the text area.  When off, they won't.
  816.   syscall_2(_fnum_textInputStreamSetEcho, strm, (void *) onOff);
  817. }
  818.  
  819. _X_ static inline void textInputSetEcho(int onOff)
  820. {
  821.   // Proto: void kernelTextInputSetEcho(int);
  822.   // Desc : Set echo on (1) or off (0) for the default input stream.  When on, any characters typed will be automatically printed to the text area.  When off, they won't.
  823.   syscall_1(_fnum_textInputSetEcho, (void *) onOff);
  824. }
  825.  
  826.  
  827. // 
  828. // Disk functions
  829. //
  830.  
  831. _X_ static inline int diskReadPartitions(const char *name)
  832. {
  833.   // Proto: int kernelDiskReadPartitions(const char *);
  834.   // Desc : Tells the kernel to (re)read the partition table of disk 'name'.
  835.   return (syscall_1(_fnum_diskReadPartitions, name));
  836. }
  837.  
  838. _X_ static inline int diskReadPartitionsAll(void)
  839. {
  840.   // Proto: int kernelDiskReadPartitionsAll(void);
  841.   // Desc : Tells the kernel to (re)read all the disks' partition tables.
  842.   return (syscall_0(_fnum_diskReadPartitionsAll));
  843. }
  844.  
  845. _X_ static inline int diskSync(const char *name)
  846. {
  847.   // Proto: int kernelDiskSync(const char *);
  848.   // Desc : Tells the kernel to synchronize  the named disk, flushing any output.
  849.     return (syscall_1(_fnum_diskSync, name));
  850. }
  851.  
  852. _X_ static inline int diskSyncAll(void)
  853. {
  854.   // Proto: int kernelDiskSyncAll(void);
  855.   // Desc : Tells the kernel to synchronize all the disks, flushing any output.
  856.   return (syscall_0(_fnum_diskSyncAll));
  857. }
  858.  
  859. _X_ static inline int diskGetBoot(char *name)
  860. {
  861.   // Proto: int kernelDiskGetBoot(char *)
  862.   // Desc : Get the disk name of the boot device.  Normally this will contain the root filesystem.
  863.   return (syscall_1(_fnum_diskGetBoot, name));
  864. }
  865.  
  866. _X_ static inline int diskGetCount(void)
  867. {
  868.   // Proto: int kernelDiskGetCount(void);
  869.   // Desc : Get the number of logical disk volumes recognized by the system
  870.   return (syscall_0(_fnum_diskGetCount));
  871. }
  872.  
  873. _X_ static inline int diskGetPhysicalCount(void)
  874. {
  875.   // Proto: int kernelDiskGetPhysicalCount(void);
  876.   // Desc : Get the number of physical disk devices recognized by the system
  877.   return (syscall_0(_fnum_diskGetPhysicalCount));
  878. }
  879.  
  880. _X_ static inline int diskGet(const char *name, disk *userDisk)
  881. {
  882.   // Proto: int kernelDiskGet(const char *, disk *);
  883.   // Desc : Given a disk name string 'name', fill in the corresponding user space disk structure 'userDisk.
  884.   return(syscall_2(_fnum_diskGet, (void *) name, userDisk));
  885. }
  886.  
  887. _X_ static inline int diskGetAll(disk *userDiskArray, unsigned buffSize)
  888. {
  889.   // Proto: int kernelDiskGetAll(disk *, unsigned);
  890.   // Desc : Return user space disk structures in 'userDiskArray' for each logical disk, up to 'buffSize' bytes.
  891.   return(syscall_2(_fnum_diskGetAll, userDiskArray, (void *) buffSize));
  892. }
  893.  
  894. _X_ static inline int diskGetAllPhysical(disk *userDiskArray, unsigned buffSize)
  895. {
  896.   // Proto: int kernelDiskGetAllPhysical(disk *, unsigned);
  897.   // Desc : Return user space disk structures in 'userDiskArray' for each physical disk, up to 'buffSize' bytes.
  898.   return(syscall_2(_fnum_diskGetAllPhysical, userDiskArray,
  899.            (void *) buffSize));
  900. }
  901.  
  902. _X_ static inline int diskGetFilesystemType(const char *name, char *buf, unsigned bufSize)
  903. {
  904.   // Proto: int kernelDiskGetFilesystemType(const char *, char *, unsigned);
  905.   // Desc : This function attempts to explicitly detect the filesystem type on disk 'name', and copy up to 'bufSize' bytes of the filesystem type name into 'buf'.  Particularly useful for things like removable media where the correct info may not be automatically provided in the disk structure.
  906.   return (syscall_3(_fnum_diskGetFilesystemType, (void *) name, buf,
  907.             (void *) bufSize));
  908. }
  909.  
  910. _X_ static inline int diskGetPartType(int code, partitionType *p)
  911. {
  912.   // Proto: int kernelDiskGetPartType(int, partitionType *);
  913.   // Desc : Gets the partition type data for the corresponding code.  This function was added specifically by use by programs such as 'fdisk' to get descriptions of different types known to the kernel.
  914.   return (syscall_2(_fnum_diskGetPartType, (void *) code, p));
  915. }
  916.  
  917. _X_ static inline partitionType *diskGetPartTypes(void)
  918. {
  919.   // Proto: partitionType *kernelDiskGetPartTypes(void);
  920.   // Desc : Like diskGetPartType(), but returns a pointer to a list of all known types.  The memory is allocated dynamically and should be deallocated with a call to memoryRelease()
  921.   return ((partitionType *) syscall_0(_fnum_diskGetPartTypes));
  922. }
  923.  
  924. _X_ static inline int diskSetFlags(const char *name, unsigned flags, int set)
  925. {
  926.   // Proto: int kernelDiskSetFlags(const char *, unsigned, int);
  927.   // Desc : Set or clear the (user-settable) disk flags bits in 'flags' of the disk 'name'.
  928.   return (syscall_3(_fnum_diskSetFlags, (void *) name, (void *) flags,
  929.             (void *) set));
  930. }
  931.  
  932. _X_ static inline int diskSetLockState(const char *name, int state)
  933. {
  934.   // Proto: int kernelDiskSetLockState(const char *diskName, int state);
  935.   // Desc : Set the locked state of the disk 'name' to either unlocked (0) or locked (1)
  936.   return (syscall_2(_fnum_diskSetLockState, (void *) name, (void *) state));
  937. }
  938.  
  939. _X_ static inline int diskSetDoorState(const char *name, int state)
  940. {
  941.   // Proto: int kernelDiskSetDoorState(const char *, int);
  942.   // Desc : Open (1) or close (0) the disk 'name'.  May require a unlocking the door first, see diskSetLockState().
  943.   return (syscall_2(_fnum_diskSetDoorState, (void *) name, (void *) state));
  944. }
  945.  
  946. _X_ static inline int diskGetMediaState(const char *diskName)
  947. {
  948.   // Proto: int kernelDiskGetMediaState(const char *diskName)
  949.   // Desc : Returns 1 if the removable disk 'diskName' is known to have media present.
  950.   return (syscall_1(_fnum_diskGetMediaState, (void *) diskName));
  951. }
  952.  
  953. _X_ static inline int diskReadSectors(const char *name, unsigned sect, unsigned count, void *buf)
  954. {
  955.   // Proto: int kernelDiskReadSectors(const char *, unsigned, unsigned, void *)
  956.   // Desc : Read 'count' sectors from disk 'name', starting at (zero-based) logical sector number 'sect'.  Put the data in memory area 'buf'.  This function requires supervisor privilege.
  957.   return (syscall_4(_fnum_diskReadSectors, (void *) name, (void *) sect,
  958.             (void *) count, buf));
  959. }
  960.  
  961. _X_ static inline int diskWriteSectors(const char *name, unsigned sect, unsigned count, const void *buf)
  962. {
  963.   // Proto: int kernelDiskWriteSectors(const char *, unsigned, unsigned, const void *)
  964.   // Desc : Write 'count' sectors to disk 'name', starting at (zero-based) logical sector number 'sect'.  Get the data from memory area 'buf'.  This function requires supervisor privilege.
  965.   return (syscall_4(_fnum_diskWriteSectors, (void *) name, (void *) sect,
  966.             (void *) count, (void *) buf));
  967. }
  968.  
  969. _X_ static inline int diskEraseSectors(const char *name, unsigned sect, unsigned count, int passes)
  970. {
  971.   // Proto: int kernelDiskEraseSectors(const char *, unsigned, unsigned, int);
  972.   // Desc : Synchronously and securely erases disk sectors.  It writes ('passes' - 1) successive passes of random data followed by a final pass of NULLs, to disk 'name' starting at (zero-based) logical sector number 'sect'.  This function requires supervisor privilege.
  973.   return (syscall_4(_fnum_diskEraseSectors, (void *) name, (void *) sect,
  974.             (void *) count, (void *) passes));
  975. }
  976.  
  977. _X_ static inline int diskGetStats(const char *name, diskStats *stats)
  978. {
  979.   // Proto: int kernelDiskGetStats(const char *, diskStats *);
  980.   // Desc: Return performance stats about the disk 'name' (if non-NULL,
  981.   // otherwise about all the disks combined).
  982.   return (syscall_2(_fnum_diskGetStats, (void *) name, stats));
  983. }
  984.  
  985.  
  986. //
  987. // Filesystem functions
  988. //
  989.  
  990. _X_ static inline int filesystemFormat(const char *theDisk, const char *type, const char *label, int longFormat, progress *prog)
  991. {
  992.   // Proto: int kernelFilesystemFormat(const char *, const char *, const char *, int, progress *);
  993.   // Desc : Format the logical volume 'theDisk', with a string 'type' representing the preferred filesystem type (for example, "fat", "fat16", "fat32, etc).  Label it with 'label'.  'longFormat' will do a sector-by-sector format, if supported, and progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'.  It is optional for filesystem drivers to implement this function.
  994.   return (syscall_5(_fnum_filesystemFormat, (void *) theDisk, (void *) type,
  995.             (void *) label, (void *) longFormat, (void *) prog));
  996. }
  997.  
  998. _X_ static inline int filesystemClobber(const char *theDisk)
  999. {
  1000.   // Proto: int kernelFilesystemClobber(const char *);
  1001.   // Desc : Clobber all known filesystem types on the logical volume 'theDisk'.  It is optional for filesystem drivers to implement this function.
  1002.   return (syscall_1(_fnum_filesystemClobber, (void *) theDisk));
  1003. }
  1004.  
  1005. _X_ static inline int filesystemCheck(const char *name, int force, int repair, progress *prog)
  1006. {
  1007.   // Proto: int kernelFilesystemCheck(const char *, int, int, progress *)
  1008.   // Desc : Check the filesystem on disk 'name'.  If 'force' is non-zero, the filesystem will be checked regardless of whether the filesystem driver thinks it needs to be.  If 'repair' is non-zero, the filesystem driver will attempt to repair any errors found.  If 'repair' is zero, a non-zero return value may indicate that errors were found.  If 'repair' is non-zero, a non-zero return value may indicate that errors were found but could not be fixed.  Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'.  It is optional for filesystem drivers to implement this function.
  1009.   return (syscall_4(_fnum_filesystemCheck, (void *) name, (void *) force,
  1010.             (void *) repair, (void *) prog));
  1011. }
  1012.  
  1013. _X_ static inline int filesystemDefragment(const char *name, progress *prog)
  1014. {
  1015.   // Proto: int kernelFilesystemDefragment(const char *, progress *)
  1016.   // Desc : Defragment the filesystem on disk 'name'.  Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'.  It is optional for filesystem drivers to implement this function.
  1017.   return (syscall_2(_fnum_filesystemDefragment, (void *) name, (void *) prog));
  1018. }
  1019.  
  1020. _X_ static inline int filesystemResizeConstraints(const char *name, unsigned *minBlocks, unsigned *maxBlocks)
  1021. {
  1022.   // Proto: int kernelFilesystemResizeConstraints(const char *, unsigned *, unsigned *);
  1023.   // Desc : Get the minimum ('minBlocks') and maximum ('maxBlocks') number of blocks for a filesystem resize on disk 'name'.  It is optional for filesystem drivers to implement this function.
  1024.   return (syscall_3(_fnum_filesystemResizeConstraints, (void *) name,
  1025.             (void *) minBlocks, (void *) maxBlocks));
  1026. }
  1027.  
  1028. _X_ static inline int filesystemResize(const char *name, unsigned blocks, progress *prog)
  1029. {
  1030.   // Proto: int kernelFilesystemResize(const char *, unsigned, progress *);
  1031.   // Desc : Resize the filesystem on disk 'name' to the given number of blocks 'blocks'.  Progress can optionally be monitored by passing a non-NULL progress structure pointer 'prog'.  It is optional for filesystem drivers to implement this function.
  1032.   return (syscall_3(_fnum_filesystemResize, (void *) name, (void *) blocks,
  1033.             (void *) prog));
  1034. }
  1035.  
  1036. _X_ static inline int filesystemMount(const char *name, const char *mp)
  1037. {
  1038.   // Proto: int kernelFilesystemMount(const char *, const char *)
  1039.   // Desc : Mount the filesystem on disk 'name', using the mount point specified by the absolute pathname 'mp'.  Note that no file or directory called 'mp' should exist, as the mount function will expect to be able to create it.
  1040.   return (syscall_2(_fnum_filesystemMount, (void *) name, (void *) mp));
  1041. }
  1042.  
  1043. _X_ static inline int filesystemUnmount(const char *mp)
  1044. {
  1045.   // Proto: int kernelFilesystemUnmount(const char *);
  1046.   // Desc : Unmount the filesystem mounted represented by the mount point 'fs'.
  1047.   return (syscall_1(_fnum_filesystemUnmount, (void *)mp));
  1048. }
  1049.  
  1050. _X_ static inline int filesystemGetFree(const char *fs)
  1051. {
  1052.   // Proto: unsigned kernelFilesystemGetFree(const char *);
  1053.   // Desc : Returns the amount of free space on the filesystem represented by the mount point 'fs'.
  1054.   return (syscall_1(_fnum_filesystemGetFree, (void *) fs));
  1055. }
  1056.  
  1057. _X_ static inline unsigned filesystemGetBlockSize(const char *fs)
  1058. {
  1059.   // Proto: unsigned kernelFilesystemGetBlockSize(const char *);
  1060.   // Desc : Returns the block size (for example, 512 or 1024) of the filesystem represented by the mount point 'fs'.
  1061.   return (syscall_1(_fnum_filesystemGetBlockSize, (void *) fs));
  1062. }
  1063.  
  1064.  
  1065. //
  1066. // File functions
  1067. //
  1068.  
  1069. _X_ static inline int fileFixupPath(const char *orig, char *new)
  1070. {
  1071.   // Proto: int kernelFileFixupPath(const char *, char *);
  1072.   // Desc : Take the absolute pathname in 'orig' and fix it up.  This means eliminating extra file separator characters (for example) and resolving links or '.' or '..' components in the pathname.
  1073.   return (syscall_2(_fnum_fileFixupPath, (void *) orig, new));
  1074. }
  1075.  
  1076. _X_ static inline int fileGetDisk(const char *path, disk *d)
  1077. {
  1078.   // Proto: int kernelFileGetDisk(const char *, disk *);
  1079.   // Desc : Given the file name 'path', return the user space structure for the logical disk that the file resides on.
  1080.   return (syscall_2(_fnum_fileGetDisk, (void *) path, (void *) d));
  1081. }
  1082.  
  1083. _X_ static inline int fileCount(const char *path)
  1084. {
  1085.   // Proto: int kernelFileCount(const char *);
  1086.   // Desc : Get the count of file entries from the directory referenced by 'path'.
  1087.   return (syscall_1(_fnum_fileCount, (void *) path));
  1088. }
  1089.  
  1090. _X_ static inline int fileFirst(const char *path, file *f)
  1091. {
  1092.   // Proto: int kernelFileFirst(const char *, file *);
  1093.   // Desc : Get the first file from the directory referenced by 'path'.  Put the information in the file structure 'f'.
  1094.   return (syscall_2(_fnum_fileFirst, (void *) path, (void *) f));
  1095. }
  1096.  
  1097. _X_ static inline int fileNext(const char *path, file *f)
  1098. {
  1099.   // Proto: int kernelFileNext(const char *, file *);
  1100.   // Desc : Get the next file from the directory referenced by 'path'.  'f' should be a file structure previously filled by a call to either fileFirst() or fileNext().
  1101.   return (syscall_2(_fnum_fileNext, (void *) path, (void *) f));
  1102. }
  1103.  
  1104. _X_ static inline int fileFind(const char *name, file *f)
  1105. {
  1106.   // Proto: int kernelFileFind(const char *, kernelFile *);
  1107.   // Desc : Find the file referenced by 'name', and fill the file data structure 'f' with the results if successful.
  1108.   return (syscall_2(_fnum_fileFind, (void *) name, (void *) f));
  1109. }
  1110.  
  1111. _X_ static inline int fileOpen(const char *name, int mode, file *f)
  1112. {
  1113.   // Proto: int kernelFileOpen(const char *, int, file *);
  1114.   // Desc : Open the file referenced by 'name' using the file open mode 'mode' (defined in <sys/file.h>).  Update the file data structure 'f' if successful.
  1115.   return (syscall_3(_fnum_fileOpen, (void *) name, (void *) mode, 
  1116.             (void *) f));
  1117. }
  1118.  
  1119. _X_ static inline int fileClose(file *f)
  1120. {
  1121.   // Proto: int kernelFileClose(const char *, file *);
  1122.   // Desc : Close the previously opened file 'f'.
  1123.   return (syscall_1(_fnum_fileClose, (void *) f));
  1124. }
  1125.  
  1126. _X_ static inline int fileRead(file *f, unsigned blocknum, unsigned blocks, void *buff)
  1127. {
  1128.   // Proto: int kernelFileRead(file *, unsigned int, unsigned int, void *);
  1129.   // Desc : Read data from the previously opened file 'f'.  'f' should have been opened in a read or read/write mode.  Read 'blocks' blocks (see the filesystem functions for information about getting the block size of a given filesystem) and put them in buffer 'buff'.
  1130.   return (syscall_4(_fnum_fileRead, (void *) f, (void *) blocknum, 
  1131.             (void *) blocks, buff));
  1132. }
  1133.  
  1134. _X_ static inline int fileWrite(file *f, unsigned blocknum, unsigned blocks, void *buff)
  1135. {
  1136.   // Proto: int kernelFileWrite(file *, unsigned, unsigned, void *);
  1137.   // Desc : Write data to the previously opened file 'f'.  'f' should have been opened in a write or read/write mode.  Write 'blocks' blocks (see the filesystem functions for information about getting the block size of a given filesystem) from the buffer 'buff'.
  1138.   return (syscall_4(_fnum_fileWrite, (void *) f, (void *) blocknum, 
  1139.             (void *) blocks, buff));
  1140. }
  1141.  
  1142. _X_ static inline int fileDelete(const char *name)
  1143. {
  1144.   // Proto: int kernelFileDelete(const char *);
  1145.   // Desc : Delete the file referenced by the pathname 'name'.
  1146.   return (syscall_1(_fnum_fileDelete, (void *) name));
  1147. }
  1148.  
  1149. _X_ static inline int fileDeleteRecursive(const char *name)
  1150. {
  1151.   // Proto: int kernelFileDeleteRecursive(const char *);
  1152.   // Desc : Recursively delete filesystem items, starting with the one referenced by the pathname 'name'.
  1153.   return (syscall_1(_fnum_fileDeleteRecursive, (void *) name));
  1154. }
  1155.  
  1156. _X_ static inline int fileDeleteSecure(const char *name, int passes)
  1157. {
  1158.   // Proto: int kernelFileDeleteSecure(const char *);
  1159.   // Desc : Securely delete the file referenced by the pathname 'name'.  'passes' indicates the number of times to overwrite the file.  The file is overwritten (number - 1) times with random data, and then NULLs.  A larger number of passes is more secure but takes longer.
  1160.   return (syscall_2(_fnum_fileDeleteSecure, (void *) name, (void *) passes));
  1161. }
  1162.  
  1163. _X_ static inline int fileMakeDir(const char *name)
  1164. {
  1165.   // Proto: int kernelFileMakeDir(const char *);
  1166.   // Desc : Create a directory to be referenced by the pathname 'name'.
  1167.   return (syscall_1(_fnum_fileMakeDir, (void *)name));
  1168. }
  1169.  
  1170. _X_ static inline int fileRemoveDir(const char *name)
  1171. {
  1172.   // Proto: int kernelFileRemoveDir(const char *);
  1173.   // Desc : Remove the directory referenced by the pathname 'name'.
  1174.   return (syscall_1(_fnum_fileRemoveDir, (void *)name));
  1175. }
  1176.  
  1177. _X_ static inline int fileCopy(const char *src, const char *dest)
  1178. {
  1179.   // Proto: int kernelFileCopy(const char *, const char *);
  1180.   // Desc : Copy the file referenced by the pathname 'src' to the pathname 'dest'.  This will overwrite 'dest' if it already exists.
  1181.   return (syscall_2(_fnum_fileCopy, (void *) src, (void *) dest));
  1182. }
  1183.  
  1184. _X_ static inline int fileCopyRecursive(const char *src, const char *dest)
  1185. {
  1186.   // Proto: int kernelFileCopyRecursive(const char *, const char *);
  1187.   // Desc : Recursively copy the file referenced by the pathname 'src' to the pathname 'dest'.  If 'src' is a regular file, the result will be the same as using the non-recursive call.  However if it is a directory, all contents of the directory and its subdirectories will be copied.  This will overwrite any files in the 'dest' tree if they already exist.
  1188.   return (syscall_2(_fnum_fileCopyRecursive, (void *) src, (void *) dest));
  1189. }
  1190.  
  1191. _X_ static inline int fileMove(const char *src, const char *dest)
  1192. {
  1193.   // Proto: int kernelFileMove(const char *, const char *);
  1194.   // Desc : Move (rename) a file referenced by the pathname 'src' to the pathname 'dest'.
  1195.   return (syscall_2(_fnum_fileMove, (void *) src, (void *) dest));
  1196. }
  1197.  
  1198. _X_ static inline int fileTimestamp(const char *name)
  1199. {
  1200.   // Proto: int kernelFileTimestamp(const char *);
  1201.   // Desc : Update the time stamp on the file referenced by the pathname 'name'
  1202.   return (syscall_1(_fnum_fileTimestamp, (void *) name));
  1203. }
  1204.  
  1205. _X_ static inline int fileGetTemp(file *f)
  1206. {
  1207.   // Proto: int kernelFileGetTemp(void);
  1208.   // Desc : Create and open a temporary file in write mode.
  1209.   return (syscall_1(_fnum_fileGetTemp, f));
  1210. }
  1211.  
  1212. _X_ static inline int fileStreamOpen(const char *name, int mode, fileStream *f)
  1213. {
  1214.   // Proto: int kernelFileStreamOpen(const char *, int, fileStream *);
  1215.   // Desc : Open the file referenced by the pathname 'name' for streaming operations, using the open mode 'mode' (defined in <sys/file.h>).  Fills the fileStream data structure 'f' with information needed for subsequent filestream operations.
  1216.   return (syscall_3(_fnum_fileStreamOpen, (char *) name, (void *) mode,
  1217.             (void *) f));
  1218. }
  1219.  
  1220. _X_ static inline int fileStreamSeek(fileStream *f, int offset)
  1221. {
  1222.   // Proto: int kernelFileStreamSeek(fileStream *, int);
  1223.   // Desc : Seek the filestream 'f' to the absolute position 'offset'
  1224.   return (syscall_2(_fnum_fileStreamSeek, (void *) f, (void *) offset));
  1225. }
  1226.  
  1227. _X_ static inline int fileStreamRead(fileStream *f, unsigned bytes, char *buff)
  1228. {
  1229.   // Proto: int kernelFileStreamRead(fileStream *, unsigned, char *);
  1230.   // Desc : Read 'bytes' bytes from the filestream 'f' and put them into 'buff'.
  1231.   return (syscall_3(_fnum_fileStreamRead, (void *) f, (void *) bytes, buff));
  1232. }
  1233.  
  1234. _X_ static inline int fileStreamReadLine(fileStream *f, unsigned bytes, char *buff)
  1235. {
  1236.   // Proto: int kernelFileStreamReadLine(fileStream *, unsigned, char *);
  1237.   // Desc : Read a complete line of text from the filestream 'f', and put up to 'bytes' characters into 'buff'
  1238.   return (syscall_3(_fnum_fileStreamReadLine, (void *) f, (void *) bytes,
  1239.             buff));
  1240. }
  1241.  
  1242. _X_ static inline int fileStreamWrite(fileStream *f, unsigned bytes, char *buff)
  1243. {
  1244.   // Proto: int kernelFileStreamWrite(fileStream *, unsigned, char *);
  1245.   // Desc : Write 'bytes' bytes from the buffer 'buff' to the filestream 'f'.
  1246.   return (syscall_3(_fnum_fileStreamWrite, (void *) f, (void *) bytes, buff));
  1247. }
  1248.  
  1249. _X_ static inline int fileStreamWriteStr(fileStream *f, char *buff)
  1250. {
  1251.   // Proto: int kernelFileStreamWriteStr(fileStream *, char *);
  1252.   // Desc : Write the string in 'buff' to the filestream 'f'
  1253.   return (syscall_2(_fnum_fileStreamWriteStr, (void *) f, buff));
  1254. }
  1255.  
  1256. _X_ static inline int fileStreamWriteLine(fileStream *f, char *buff)
  1257. {
  1258.   // Proto: int kernelFileStreamWriteLine(fileStream *, char *);
  1259.   // Desc : Write the string in 'buff' to the filestream 'f', and add a newline at the end
  1260.   return (syscall_2(_fnum_fileStreamWriteLine, (void *) f, buff));
  1261. }
  1262.  
  1263. _X_ static inline int fileStreamFlush(fileStream *f)
  1264. {
  1265.   // Proto: int kernelFileStreamFlush(fileStream *);
  1266.   // Desc : Flush filestream 'f'.
  1267.   return (syscall_1(_fnum_fileStreamFlush, (void *) f));
  1268. }
  1269.  
  1270. _X_ static inline int fileStreamClose(fileStream *f)
  1271. {
  1272.   // Proto: int kernelFileStreamClose(fileStream *);
  1273.   // Desc : [Flush and] close the filestream 'f'.
  1274.   return (syscall_1(_fnum_fileStreamClose, (void *) f));
  1275. }
  1276.  
  1277.  
  1278. //
  1279. // Memory functions
  1280. //
  1281.  
  1282. _X_ static inline void *memoryGet(unsigned size, const char *desc)
  1283. {
  1284.   // Proto: void *kernelMemoryGet(unsigned, const char *);
  1285.   // Desc : Return a pointer to a new block of memory of size 'size' and (optional) physical alignment 'align', adding the (optional) description 'desc'.  If no specific alignment is required, use '0'.  Memory allocated using this function is automatically cleared (like 'calloc').
  1286.   return ((void *) syscall_2(_fnum_memoryGet, (void *) size, (void *) desc));
  1287. }
  1288.  
  1289. _X_ static inline void *memoryGetPhysical(unsigned size, unsigned align, const char *desc)
  1290. {
  1291.   // Proto: void *kernelMemoryGetPhysical(unsigned, unsigned, const char *);
  1292.   // Desc : Return a pointer to a new physical block of memory of size 'size' and (optional) physical alignment 'align', adding the (optional) description 'desc'.  If no specific alignment is required, use '0'.  Memory allocated using this function is NOT automatically cleared.  'Physical' refers to an actual physical memory address, and is not necessarily useful to external programs.
  1293.   return ((void *) syscall_3(_fnum_memoryGetPhysical, (void *) size,
  1294.                  (void *) align, (void *) desc));
  1295. }
  1296.  
  1297. _X_ static inline int memoryRelease(void *p)
  1298. {
  1299.   // Proto: int kernelMemoryRelease(void *);
  1300.   // Desc : Release the memory block starting at the address 'p'.  Must have been previously allocated using the memoryRequestBlock() function.
  1301.   return (syscall_1(_fnum_memoryRelease, p));
  1302. }
  1303.  
  1304. _X_ static inline int memoryReleaseAllByProcId(int pid)
  1305. {
  1306.   // Proto: int kernelMemoryReleaseAllByProcId(int);
  1307.   // Desc : Release all memory allocated to/by the process referenced by process ID 'pid'.  Only privileged functions can release memory owned by other processes.
  1308.   return (syscall_1(_fnum_memoryReleaseAllByProcId, (void *) pid));
  1309. }
  1310.  
  1311. _X_ static inline int memoryChangeOwner(int opid, int npid, void *addr, void **naddr)
  1312. {
  1313.   // Proto: int kernelMemoryChangeOwner(int, int, void *, void **);
  1314.   // Desc : Change the ownership of an allocated block of memory beginning at address 'addr'.  'opid' is the process ID of the currently owning process, and 'npid' is the process ID of the intended new owner.  'naddr' is filled with the new address of the memory (since it changes address spaces in the process).  Note that only a privileged process can change memory ownership.
  1315.   return (syscall_4(_fnum_memoryChangeOwner, (void *) opid, (void *) npid, 
  1316.             addr, (void *) naddr));
  1317. }
  1318.  
  1319. _X_ static inline int memoryGetStats(memoryStats *stats, int kernel)
  1320. {
  1321.   // Proto: int kernelMemoryGetStats(memoryStats *, int);
  1322.   // Desc : Returns the current memory totals and usage values to the current output stream.  If non-zero, the flag 'kernel' will return kernel heap statistics instead of overall system statistics.
  1323.   return (syscall_2(_fnum_memoryGetStats, stats, (void *) kernel));
  1324. }
  1325.  
  1326. _X_ static inline int memoryGetBlocks(memoryBlock *blocksArray, unsigned buffSize, int kernel)
  1327. {
  1328.   // Proto: int kernelMemoryGetBlocks(memoryBlock *, unsigned, int);
  1329.   // Desc : Returns a copy of the array of used memory blocks in 'blocksArray', up to 'buffSize' bytes.  If non-zero, the flag 'kernel' will return kernel heap blocks instead of overall heap allocations.
  1330.   return (syscall_3(_fnum_memoryGetBlocks, blocksArray, (void *) buffSize,
  1331.             (void *) kernel));
  1332. }
  1333.  
  1334. _X_ static inline int memoryBlockInfo(void *p, memoryBlock *block)
  1335. {
  1336.   // Proto: int kernelMemoryBlockInfo(void *, memoryBlock *);
  1337.   // Desc : Fills in the structure 'block' with information about the allocated memory block starting at virtual address 'p'
  1338.   return (syscall_2(_fnum_memoryBlockInfo, p, block));
  1339. }
  1340.  
  1341.  
  1342. //
  1343. // Multitasker functions
  1344. //
  1345.  
  1346. _X_ static inline int multitaskerCreateProcess(const char *name, int privilege, processImage *execImage)
  1347. {
  1348.   // Proto: int kernelMultitaskerCreateProcess(const char *, int, processImage *);
  1349.   // Desc : Create a new process.  'name' will be the new process' name.  'privilege' is the privilege level.  'execImage' is a processImage structure that describes the loaded location of the file, the program's desired virtual address, entry point, size, etc.  If the value returned by the call is a positive integer, the call was successful and the value is the new process' process ID.  New processes are created and left in a stopped state, so if you want it to run you will need to set it to a running state ('ready', actually) using the function call multitaskerSetProcessState().
  1350.   return (syscall_3(_fnum_multitaskerCreateProcess, (void *) name,
  1351.             (void *) privilege, execImage));
  1352. }
  1353.  
  1354. _X_ static inline int multitaskerSpawn(void *addr, const char *name, int numargs, void *args[])
  1355. {
  1356.   // Proto: int kernelMultitaskerSpawn(void *, const char *, int, void *[]);
  1357.   // Desc : Spawn a thread from the current process.  The starting point of the code (for example, a function address) should be specified as 'addr'.  'name' will be the new thread's name.  'numargs' and 'args' will be passed as the "int argc, char *argv[]) parameters of the new thread.  If there are no arguments, these should be 0 and NULL, respectively.  If the value returned by the call is a positive integer, the call was successful and the value is the new thread's process ID.  New threads are created and made runnable, so there is no need to change its state to activate it.
  1358.   return (syscall_4(_fnum_multitaskerSpawn, addr, (void *) name, 
  1359.             (void *) numargs, args));
  1360. }
  1361.  
  1362. _X_ static inline int multitaskerGetCurrentProcessId(void)
  1363. {
  1364.   // Proto: int kernelMultitaskerGetCurrentProcessId(void);
  1365.   // Desc : Returns the process ID of the calling program.
  1366.   return (syscall_0(_fnum_multitaskerGetCurrentProcessId));
  1367. }
  1368.  
  1369. _X_ static inline int multitaskerGetProcess(int pid, process *proc)
  1370. {
  1371.   // Proto: int kernelMultitaskerGetProcess(int, process *);
  1372.   // Desc : Returns the process structure for the supplied process ID.
  1373.   return (syscall_2(_fnum_multitaskerGetProcess, (void *) pid, proc));
  1374. }
  1375.  
  1376. _X_ static inline int multitaskerGetProcessByName(const char *name, process *proc)
  1377. {
  1378.   // Proto: int kernelMultitaskerGetProcessByName(const char *, process *);
  1379.   // Desc : Returns the process structure for the supplied process name
  1380.   return (syscall_2(_fnum_multitaskerGetProcessByName, (void *) name, proc));
  1381. }
  1382.  
  1383. _X_ static inline int multitaskerGetProcesses(void *buffer, unsigned buffSize)
  1384. {
  1385.   // Proto: int kernelMultitaskerGetProcesses(void *, unsigned);
  1386.   // Desc : Fills 'buffer' with up to 'buffSize' bytes' worth of process structures, and returns the number of structures copied.
  1387.   return (syscall_2(_fnum_multitaskerGetProcesses, buffer, (void *) buffSize));
  1388. }
  1389.  
  1390. _X_ static inline int multitaskerSetProcessState(int pid, int state)
  1391. {
  1392.   // Proto: int kernelMultitaskerSetProcessState(int, kernelProcessState);
  1393.   // Desc : Sets the state of the process referenced by process ID 'pid' to the new state 'state'.
  1394.   return (syscall_2(_fnum_multitaskerSetProcessState, (void *) pid,
  1395.             (void *) state));
  1396. }
  1397.  
  1398. _X_ static inline int multitaskerProcessIsAlive(int pid)
  1399. {
  1400.   // Proto: int kernelMultitaskerProcessIsAlive(int);
  1401.   // Desc : Returns 1 if the process with the id 'pid' still exists and is in a 'runnable' (viable) state.  Returns 0 if the process does not exist or is in a 'finished' state.
  1402.   return (syscall_1(_fnum_multitaskerProcessIsAlive, (void *) pid));
  1403. }
  1404.  
  1405. _X_ static inline int multitaskerSetProcessPriority(int pid, int priority)
  1406. {
  1407.   // Proto: int kernelMultitaskerSetProcessPriority(int, int);
  1408.   // Desc : Sets the priority of the process referenced by process ID 'pid' to 'priority'.
  1409.   return (syscall_2(_fnum_multitaskerSetProcessPriority, (void *) pid, 
  1410.             (void *) priority));
  1411. }
  1412.  
  1413. _X_ static inline int multitaskerGetProcessPrivilege(int pid)
  1414. {
  1415.   // Proto: kernelMultitaskerGetProcessPrivilege(int);
  1416.   // Desc : Gets the privilege level of the process referenced by process ID 'pid'.
  1417.   return (syscall_1(_fnum_multitaskerGetProcessPrivilege, (void *) pid));
  1418. }
  1419.  
  1420. _X_ static inline int multitaskerGetCurrentDirectory(char *buff, int buffsz)
  1421. {
  1422.   // Proto: int kernelMultitaskerGetCurrentDirectory(char *, int);
  1423.   // Desc : Returns the absolute pathname of the calling process' current directory.  Puts the value in the buffer 'buff' which is of size 'buffsz'.
  1424.   return (syscall_2(_fnum_multitaskerGetCurrentDirectory, buff,
  1425.             (void *) buffsz));
  1426. }
  1427.  
  1428. _X_ static inline int multitaskerSetCurrentDirectory(const char *buff)
  1429. {
  1430.   // Proto: int kernelMultitaskerSetCurrentDirectory(const char *);
  1431.   // Desc : Sets the current directory of the calling process to the absolute pathname 'buff'.
  1432.   return (syscall_1(_fnum_multitaskerSetCurrentDirectory, (void *) buff));
  1433. }
  1434.  
  1435. _X_ static inline objectKey multitaskerGetTextInput(void)
  1436. {
  1437.   // Proto: kernelTextInputStream *kernelMultitaskerGetTextInput(void);
  1438.   // Desc : Get an object key to refer to the current text input stream of the calling process.
  1439.   return((objectKey) syscall_0(_fnum_multitaskerGetTextInput));
  1440. }
  1441.  
  1442. _X_ static inline int multitaskerSetTextInput(int processId, objectKey key)
  1443. {
  1444.   // Proto: int kernelMultitaskerSetTextInput(int, kernelTextInputStream *);
  1445.   // Desc : Set the text input stream of the process referenced by process ID 'processId' to a text stream referenced by the object key 'key'.
  1446.   return (syscall_2(_fnum_multitaskerSetTextInput, (void *) processId, key));
  1447. }
  1448.  
  1449. _X_ static inline objectKey multitaskerGetTextOutput(void)
  1450. {
  1451.   // Proto: kernelTextOutputStream *kernelMultitaskerGetTextOutput(void);
  1452.   // Desc : Get an object key to refer to the current text output stream of the calling process.
  1453.   return((objectKey) syscall_0(_fnum_multitaskerGetTextOutput));
  1454. }
  1455.  
  1456. _X_ static inline int multitaskerSetTextOutput(int processId, objectKey key)
  1457. {
  1458.   // Proto: int kernelMultitaskerSetTextOutput(int, kernelTextOutputStream *);
  1459.   // Desc : Set the text output stream of the process referenced by process ID 'processId' to a text stream referenced by the object key 'key'.
  1460.   return (syscall_2(_fnum_multitaskerSetTextOutput, (void *) processId, key));
  1461. }
  1462.  
  1463. _X_ static inline int multitaskerDuplicateIO(int pid1, int pid2, int clear)
  1464. {
  1465.   // Proto: int kernelMultitaskerDuplicateIO(int, int, int);
  1466.   // Desc : Set 'pid2' to use the same input and output streams as 'pid1', and if 'clear' is non-zero, clear any pending input or output.
  1467.   return (syscall_3(_fnum_multitaskerDuplicateIO, (void *) pid1, (void *) pid2,
  1468.             (void *) clear));
  1469. }
  1470.  
  1471. _X_ static inline int multitaskerGetProcessorTime(clock_t *clk)
  1472. {
  1473.   // Proto: int kernelMultitaskerGetProcessorTime(clock_t *);
  1474.   // Desc : Fill the clock_t structure with the amount of processor time consumed by the calling process.
  1475.   return (syscall_1(_fnum_multitaskerGetProcessorTime, clk));
  1476. }
  1477.  
  1478. _X_ static inline void multitaskerYield(void)
  1479. {
  1480.   // Proto: void kernelMultitaskerYield(void);
  1481.   // Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler.  It's nice to do this when you are waiting for some event, so that your process is not 'hungry' (i.e. hogging processor cycles unnecessarily).
  1482.   syscall_0(_fnum_multitaskerYield);
  1483. }
  1484.  
  1485. _X_ static inline void multitaskerWait(unsigned ticks)
  1486. {
  1487.   // Proto: void kernelMultitaskerWait(unsigned int);
  1488.   // Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler, and wait at least 'ticks' timer ticks before running the calling process again.  On the PC, one second is approximately 20 system timer ticks.
  1489.   syscall_1(_fnum_multitaskerWait, (void *) ticks);
  1490. }
  1491.  
  1492. _X_ static inline int multitaskerBlock(int pid)
  1493. {
  1494.   // Proto: int kernelMultitaskerBlock(int);
  1495.   // Desc : Yield the remainder of the current processor timeslice back to the multitasker's scheduler, and block on the process referenced by process ID 'pid'.  This means that the calling process will not run again until process 'pid' has terminated.  The return value of this function is the return value of process 'pid'.
  1496.   return (syscall_1(_fnum_multitaskerBlock, (void *) pid));
  1497. }
  1498.  
  1499. _X_ static inline int multitaskerDetach(void)
  1500. {
  1501.   // Proto: int kernelMultitaskerDetach(void);
  1502.   // Desc : This allows a program to 'daemonize', detaching from the IO streams of its parent and, if applicable, the parent stops blocking.  Useful for a process that want to operate in the background, or that doesn't want to be killed if its parent is killed.
  1503.   return (syscall_0(_fnum_multitaskerDetach));
  1504. }
  1505.  
  1506. _X_ static inline int multitaskerKillProcess(int pid, int force)
  1507. {
  1508.   // Proto: int kernelMultitaskerKillProcess(int);
  1509.   // Desc : Terminate the process referenced by process ID 'pid'.  If 'force' is non-zero, the multitasker will attempt to ignore any errors and dismantle the process with extreme prejudice.  The 'force' flag also has the necessary side effect of killing any child threads spawned by process 'pid'.  (Otherwise, 'pid' is left in a stopped state until its threads have terminated normally).
  1510.   return (syscall_2(_fnum_multitaskerKillProcess, (void *) pid,
  1511.             (void *) force));
  1512. }
  1513.  
  1514. _X_ static inline int multitaskerKillByName(const char *name, int force)
  1515. {
  1516.   // Proto: int kernelMultitaskerKillByName(const char *name, int force)
  1517.   // Desc : Like multitaskerKillProcess, except that it attempts to kill all instances of processes whose names match 'name'
  1518.   return (syscall_2(_fnum_multitaskerKillByName, (void *) name,
  1519.             (void *) force));
  1520. }
  1521.  
  1522. _X_ static inline int multitaskerTerminate(int code)
  1523. {
  1524.   // Proto: int kernelMultitaskerTerminate(int);
  1525.   // Desc : Terminate the calling process, returning the exit code 'code'
  1526.   return (syscall_1(_fnum_multitaskerTerminate, (void *) code));
  1527. }
  1528.  
  1529. _X_ static inline int multitaskerSignalSet(int processId, int sig, int on)
  1530. {
  1531.   // Proto: int kernelMultitaskerSignalSet(int, int, int);
  1532.   // Desc : Set the current process' signal handling enabled (on) or disabled for the specified signal number 'sig'
  1533.   return (syscall_3(_fnum_multitaskerSignalSet, (void *) processId,
  1534.             (void *) sig, (void *) on));
  1535. }
  1536.  
  1537. _X_ static inline int multitaskerSignal(int processId, int sig)
  1538. {
  1539.   // Proto: int kernelMultitaskerSignal(int, int);
  1540.   // Desc : Send the requested signal 'sig' to the process 'processId'
  1541.   return (syscall_2(_fnum_multitaskerSignal, (void *) processId,
  1542.             (void *) sig));
  1543. }
  1544.  
  1545. _X_ static inline int multitaskerSignalRead(int processId)
  1546. {
  1547.   // Proto: int kernelMultitaskerSignalRead(int);
  1548.   // Desc : Returns the number code of the next pending signal for the current process, or 0 if no signals are pending.
  1549.   return (syscall_1(_fnum_multitaskerSignalRead, (void *) processId));
  1550. }
  1551.  
  1552. _X_ static inline int multitaskerGetIOPerm(int processId, int portNum)
  1553. {
  1554.   // Proto: int kernelMultitaskerGetIOPerm(int, int);
  1555.   // Desc : Returns 1 if the process with process ID 'processId' can do I/O on port 'portNum'
  1556.   return (syscall_2(_fnum_multitaskerGetIOPerm, (void *) processId,
  1557.             (void *) portNum));
  1558. }
  1559.  
  1560. _X_ static inline int multitaskerSetIOPerm(int processId, int portNum, int yesNo)
  1561. {
  1562.   // Proto: int kernelMultitaskerSetIOPerm(int, int, int);
  1563.   // Desc : Set I/O permission port 'portNum' for the process with process ID 'processId'.  If 'yesNo' is non-zero, permission will be granted.
  1564.   return (syscall_3(_fnum_multitaskerSetIOPerm, (void *) processId,
  1565.             (void *) portNum, (void *) yesNo));
  1566. }
  1567.  
  1568.  
  1569. //
  1570. // Loader functions
  1571. //
  1572.  
  1573. _X_ static inline void *loaderLoad(const char *filename, file *theFile)
  1574. {
  1575.   // Proto: void *kernelLoaderLoad(const char *, file *);
  1576.   // Desc : Load a file referenced by the pathname 'filename', and fill the file data structure 'theFile' with the details.  The pointer returned points to the resulting file data.
  1577.   return ((void *) syscall_2(_fnum_loaderLoad, (void *) filename,
  1578.                  (void *) theFile));
  1579. }
  1580.  
  1581. _X_ static inline objectKey loaderClassify(const char *fileName, void *fileData, int size, loaderFileClass *class)
  1582. {
  1583.   // Proto: kernelFileClass *kernelLoaderClassify(const char *, void *, int, loaderFileClass *);
  1584.   // Desc : Given a file by the name 'fileName', the contents 'fileData', of size 'size', get the kernel loader's idea of the file type.  If successful, the return  value is non-NULL and the loaderFileClass structure 'class' is filled out with the known information.
  1585.   return ((objectKey) syscall_4(_fnum_loaderClassify, (char *) fileName,
  1586.                 fileData, (void *) size, class));
  1587. }
  1588.  
  1589. _X_ static inline objectKey loaderClassifyFile(const char *fileName, loaderFileClass *class)
  1590. {
  1591.   // Proto: kernelFileClass *kernelLoaderClassifyFile(const char *, loaderFileClass *);
  1592.   // Desc : Like loaderClassify(), except the first argument 'fileName' is a file name to classify.  Returns the kernel loader's idea of the file type.  If successful, the return value is non-NULL and the loaderFileClass structure 'class' is filled out with the known information.
  1593.   return ((objectKey) syscall_2(_fnum_loaderClassifyFile, (void *) fileName,
  1594.                 class));
  1595. }
  1596.  
  1597. _X_ static inline loaderSymbolTable *loaderGetSymbols(const char *fileName, int dynamic)
  1598. {
  1599.   // Proto: loaderSymbolTable *kernelLoaderGetSymbols(const char *, int);
  1600.   // Desc : Given a binary executable, library, or object file 'fileName' and a flag 'dynamic', return a loaderSymbolTable structure filled out with the loader symbols from the file.  If 'dynamic' is non-zero, only symbols used in dynamic linking will be returned (if the file is not a dynamic library or executable, NULL will be returned).  If 'dynamic' is zero, return all symbols found in the file.
  1601.   return ((loaderSymbolTable *) syscall_2(_fnum_loaderGetSymbols,
  1602.                   (void *) fileName, (void *) dynamic));
  1603. }
  1604.  
  1605. _X_ static inline int loaderCheckCommand(const char *command)
  1606. {
  1607.   // Proto: int kernelLoaderCheckCommand(const char *);
  1608.   // Desc : Takes a command line string 'command' and ensures that the program (the first part of the string) exists.
  1609.   return (syscall_1(_fnum_loaderCheckCommand, (void *) command));
  1610. }
  1611.  
  1612. _X_ static inline int loaderLoadProgram(const char *command, int privilege)
  1613. {
  1614.   // Proto: int kernelLoaderLoadProgram(const char *, int);
  1615.   // Desc : Run 'command' as a process with the privilege level 'privilege'.  If successful, the call's return value is the process ID of the new process.  The process is left in a stopped state and must be set to a running state explicitly using the multitasker function multitaskerSetProcessState() or the loader function loaderExecProgram().
  1616.   return (syscall_2(_fnum_loaderLoadProgram, (void *) command,
  1617.             (void *) privilege));
  1618. }
  1619.  
  1620. _X_ static inline int loaderLoadLibrary(const char *libraryName)
  1621. {
  1622.   // Proto: int kernelLoaderLoadLibrary(const char *);
  1623.   // Desc : This takes the name of a library file 'libraryName' to load and creates a shared library in the kernel.  This function is not especially useful to user programs, since normal shared library loading happens automatically as part of the 'loaderLoadProgram' process.
  1624.   return (syscall_1(_fnum_loaderLoadLibrary, (void *) libraryName));
  1625. }
  1626.  
  1627. _X_ static inline int loaderExecProgram(int processId, int block)
  1628. {
  1629.   // Proto: int kernelLoaderExecProgram(int, int);
  1630.   // Desc : Execute the process referenced by process ID 'processId'.  If 'block' is non-zero, the calling process will block until process 'pid' has terminated, and the return value of the call is the return value of process 'pid'.
  1631.   return (syscall_2(_fnum_loaderExecProgram, (void *) processId,
  1632.             (void *) block));
  1633. }
  1634.  
  1635. _X_ static inline int loaderLoadAndExec(const char *command, int privilege, int block)
  1636. {
  1637.   // Proto: int kernelLoaderLoadAndExec(const char *, int, int);
  1638.   // Desc : This function is just for convenience, and is an amalgamation of the loader functions loaderLoadProgram() and  loaderExecProgram().
  1639.   return (syscall_3(_fnum_loaderLoadAndExec, (void *) command,
  1640.             (void *) privilege, (void *) block));
  1641. }
  1642.  
  1643.  
  1644. //
  1645. // Real-time clock functions
  1646. //
  1647.  
  1648. _X_ static inline int rtcReadSeconds(void)
  1649. {
  1650.   // Proto: int kernelRtcReadSeconds(void);
  1651.   // Desc : Get the current seconds value.
  1652.   return (syscall_0(_fnum_rtcReadSeconds));
  1653. }
  1654.  
  1655. _X_ static inline int rtcReadMinutes(void)
  1656. {
  1657.   // Proto: int kernelRtcReadMinutes(void);
  1658.   // Desc : Get the current minutes value.
  1659.   return (syscall_0(_fnum_rtcReadMinutes));
  1660. }
  1661.  
  1662. _X_ static inline int rtcReadHours(void)
  1663. {
  1664.   // Proto: int kernelRtcReadHours(void);
  1665.   // Desc : Get the current hours value.
  1666.   return (syscall_0(_fnum_rtcReadHours));
  1667. }
  1668.  
  1669. _X_ static inline int rtcDayOfWeek(unsigned day, unsigned month, unsigned year)
  1670. {
  1671.   // Proto: int kernelRtcDayOfWeek(unsigned, unsigned, unsigned);
  1672.   // Desc : Get the current day of the week value.
  1673.   return (syscall_3(_fnum_rtcDayOfWeek, (void *) day, (void *) month,
  1674.             (void *) year));
  1675. }
  1676.  
  1677. _X_ static inline int rtcReadDayOfMonth(void)
  1678. {
  1679.   // Proto: int kernelRtcReadDayOfMonth(void);
  1680.   // Desc : Get the current day of the month value.
  1681.   return (syscall_0(_fnum_rtcReadDayOfMonth));
  1682. }
  1683.  
  1684. _X_ static inline int rtcReadMonth(void)
  1685. {
  1686.   // Proto: int kernelRtcReadMonth(void);
  1687.   // Desc : Get the current month value.
  1688.   return (syscall_0(_fnum_rtcReadMonth));
  1689. }
  1690.  
  1691. _X_ static inline int rtcReadYear(void)
  1692. {
  1693.   // Proto: int kernelRtcReadYear(void);
  1694.   // Desc : Get the current year value.
  1695.   return (syscall_0(_fnum_rtcReadYear));
  1696. }
  1697.  
  1698. _X_ static inline unsigned rtcUptimeSeconds(void)
  1699. {
  1700.   // Proto: unsigned kernelRtcUptimeSeconds(void);
  1701.   // Desc : Get the number of seconds the system has been running.
  1702.   return (syscall_0(_fnum_rtcUptimeSeconds));
  1703. }
  1704.  
  1705.  
  1706. _X_ static inline int rtcDateTime(struct tm *theTime)
  1707. {
  1708.   // Proto: int kernelRtcDateTime(struct tm *);
  1709.   // Desc : Get the current data and time as a tm data structure in 'theTime'.
  1710.   return (syscall_1(_fnum_rtcDateTime, (void *) theTime));
  1711. }
  1712.  
  1713.  
  1714. //
  1715. // Random number functions
  1716. //
  1717.  
  1718. _X_ static inline unsigned randomUnformatted(void)
  1719. {
  1720.   // Proto: unsigned kernelRandomUnformatted(void);
  1721.   // Desc : Get an unformatted random unsigned number.  Just any unsigned number.
  1722.   return (syscall_0(_fnum_randomUnformatted));
  1723. }
  1724.  
  1725. _X_ static inline unsigned randomFormatted(unsigned start, unsigned end)
  1726. {
  1727.   // Proto: unsigned kernelRandomFormatted(unsigned int, unsigned int);
  1728.   // Desc : Get a random unsigned number between the start value 'start' and the end value 'end', inclusive.
  1729.   return (syscall_2(_fnum_randomFormatted, (void *) start, (void *) end));
  1730. }
  1731.  
  1732. _X_ static inline unsigned randomSeededUnformatted(unsigned seed)
  1733. {
  1734.   // Proto: unsigned kernelRandomSeededUnformatted(unsigned int);
  1735.   // Desc : Get an unformatted random unsigned number, using the random seed 'seed' instead of the kernel's default random seed.
  1736.   return (syscall_1(_fnum_randomSeededUnformatted, (void *) seed));
  1737. }
  1738.  
  1739. _X_ static inline unsigned randomSeededFormatted(unsigned seed, unsigned start, unsigned end)
  1740. {
  1741.   // Proto: unsigned kernelRandomSeededFormatted(unsigned int, unsigned int, unsigned int);
  1742.   // Desc : Get a random unsigned number between the start value 'start' and the end value 'end', inclusive, using the random seed 'seed' instead of the kernel's default random seed.
  1743.   return (syscall_3(_fnum_randomSeededFormatted, (void *) seed,
  1744.             (void *) start, (void *) end));
  1745. }
  1746.  
  1747.  
  1748. //
  1749. // Environment functions
  1750. //
  1751.  
  1752. _X_ static inline int environmentGet(const char *var, char *buf, unsigned bufsz)
  1753. {
  1754.   // Proto: int kernelEnvironmentGet(const char *, char *, unsigned int);
  1755.   // Desc : Get the value of the environment variable named 'var', and put it into the buffer 'buf' of size 'bufsz' if successful.
  1756.   return (syscall_3(_fnum_environmentGet, (void *) var, buf, (void *) bufsz));
  1757. }
  1758.  
  1759. _X_ static inline int environmentSet(const char *var, const char *val)
  1760. {
  1761.   // Proto: int kernelEnvironmentSet(const char *, const char *);
  1762.   // Desc : Set the environment variable 'var' to the value 'val', overwriting any old value that might have been previously set.
  1763.   return (syscall_2(_fnum_environmentSet, (void *) var, (void *) val));
  1764. }
  1765.  
  1766. _X_ static inline int environmentUnset(const char *var)
  1767. {
  1768.   // Proto: int kernelEnvironmentUnset(const char *);
  1769.   // Desc : Delete the environment variable 'var'.
  1770.   return (syscall_1(_fnum_environmentUnset, (void *) var));
  1771. }
  1772.  
  1773. _X_ static inline void environmentDump(void)
  1774. {
  1775.   // Proto: void kernelEnvironmentDump(void);
  1776.   // Desc : Print a listing of all the currently set environment variables in the calling process' environment space to the current text output stream.
  1777.   syscall_0(_fnum_environmentDump);
  1778. }
  1779.  
  1780.  
  1781. //
  1782. // Raw graphics functions
  1783. //
  1784.  
  1785. _X_ static inline int graphicsAreEnabled(void)
  1786. {
  1787.   // Proto: int kernelGraphicsAreEnabled(void);
  1788.   // Desc : Returns 1 if the kernel is operating in graphics mode.
  1789.   return (syscall_0(_fnum_graphicsAreEnabled));
  1790. }
  1791.  
  1792. _X_ static inline int graphicGetModes(videoMode *buffer, unsigned size)
  1793. {
  1794.   // Proto: int kernelGraphicGetModes(videoMode *, unsigned);
  1795.   // Desc : Get up to 'size' bytes worth of videoMode structures in 'buffer' for the supported video modes of the current hardware.
  1796.   return (syscall_2(_fnum_graphicGetModes, buffer, (void *) size));
  1797. }
  1798.  
  1799. _X_ static inline int graphicGetMode(videoMode *mode)
  1800. {
  1801.   // Proto: int kernelGraphicGetMode(videoMode *);
  1802.   // Desc : Get the current video mode in 'mode'
  1803.   return (syscall_1(_fnum_graphicGetMode, mode));
  1804. }
  1805.  
  1806. _X_ static inline int graphicSetMode(videoMode *mode)
  1807. {
  1808.   // Proto: int kernelGraphicSetMode(videoMode *);
  1809.   // Desc : Set the video mode in 'mode'.  Generally this will require a reboot in order to take effect.
  1810.   return (syscall_1(_fnum_graphicSetMode, mode));
  1811. }
  1812.  
  1813. _X_ static inline int graphicGetScreenWidth(void)
  1814. {
  1815.   // Proto: int kernelGraphicGetScreenWidth(void);
  1816.   // Desc : Returns the width of the graphics screen.
  1817.   return (syscall_0(_fnum_graphicGetScreenWidth));
  1818. }
  1819.  
  1820. _X_ static inline int graphicGetScreenHeight(void)
  1821. {
  1822.   // Proto: int kernelGraphicGetScreenHeight(void);
  1823.   // Desc : Returns the height of the graphics screen.
  1824.   return (syscall_0(_fnum_graphicGetScreenHeight));
  1825. }
  1826.  
  1827. _X_ static inline int graphicCalculateAreaBytes(int width, int height)
  1828. {
  1829.   // Proto: int kernelGraphicCalculateAreaBytes(int, int);
  1830.   // Desc : Returns the number of bytes required to allocate a graphic buffer of width 'width' and height 'height'.  This is a function of the screen resolution, etc.
  1831.   return (syscall_2(_fnum_graphicCalculateAreaBytes, (void *) width,
  1832.             (void *) height));
  1833. }
  1834.  
  1835. _X_ static inline int graphicClearScreen(color *background)
  1836. {
  1837.   // Proto: int kernelGraphicClearScreen(color *);
  1838.   // Desc : Clear the screen to the background color 'background'.
  1839.   return (syscall_1(_fnum_graphicClearScreen, background));
  1840. }
  1841.  
  1842. _X_ static inline int graphicGetColor(const char *colorName, color *getColor)
  1843. {
  1844.   // Proto: int kernelGraphicGetColor(const char *, color *);
  1845.   // Desc : Get the system color 'colorName' and place its values in the color structure 'getColor'.  Examples of system color names include 'foreground', 'background', and 'desktop'.
  1846.   return (syscall_2(_fnum_graphicGetColor, (void *) colorName, getColor));
  1847. }
  1848.  
  1849. _X_ static inline int graphicSetColor(const char *colorName, color *setColor)
  1850. {
  1851.   // Proto: int kernelGraphicSetColor(const char *, color *);
  1852.   // Desc : Set the system color 'colorName' to the values in the color structure 'getColor'.  Examples of system color names include 'foreground', 'background', and 'desktop'.
  1853.   return (syscall_2(_fnum_graphicSetColor, (void *) colorName, setColor));
  1854. }
  1855.  
  1856. _X_ static inline int graphicDrawPixel(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord)
  1857. {
  1858.   // Proto: int kernelGraphicDrawPixel(kernelGraphicBuffer *, color *, drawMode, int, int);
  1859.   // Desc : Draw a single pixel into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the X coordinate 'xCoord' and the Y coordinate 'yCoord'.  If 'buffer' is NULL, draw directly onto the screen.
  1860.   return (syscall_5(_fnum_graphicDrawPixel, buffer, foreground, (void *) mode,
  1861.             (void *) xCoord, (void *) yCoord));
  1862. }
  1863.  
  1864. _X_ static inline int graphicDrawLine(objectKey buffer, color *foreground, drawMode mode, int startX, int startY, int endX, int endY)
  1865. {
  1866.   // Proto: int kernelGraphicDrawLine(kernelGraphicBuffer *, color *, drawMode, int, int, int, int);
  1867.   // Desc : Draw a line into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'startX', the starting Y coordinate 'startY', the ending X coordinate 'endX' and the ending Y coordinate 'endY'.  At the time of writing, only horizontal and vertical lines are supported by the linear framebuffer graphic driver.  If 'buffer' is NULL, draw directly onto the screen.
  1868.   return (syscall_7(_fnum_graphicDrawLine, buffer, foreground, (void *) mode,
  1869.             (void *) startX, (void *) startY, (void *) endX,
  1870.             (void *) endY));
  1871. }
  1872.  
  1873. _X_ static inline int graphicDrawRect(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord, int width, int height, int thickness, int fill)
  1874. {
  1875.   // Proto: int kernelGraphicDrawRect(kernelGraphicBuffer *, color *, drawMode, int, int, int, int, int, int);
  1876.   // Desc : Draw a rectangle into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width', the height 'height', the line thickness 'thickness' and the fill value 'fill'.  Non-zero fill value means fill the rectangle.   If 'buffer' is NULL, draw directly onto the screen.
  1877.   return (syscall_9(_fnum_graphicDrawRect, buffer, foreground, (void *) mode,
  1878.             (void *) xCoord, (void *) yCoord, (void *) width,
  1879.             (void *) height, (void *) thickness, (void *) fill));
  1880. }
  1881.  
  1882. _X_ static inline int graphicDrawOval(objectKey buffer, color *foreground, drawMode mode, int xCoord, int yCoord, int width, int height, int thickness, int fill)
  1883. {
  1884.   // Proto: int kernelGraphicDrawOval(kernelGraphicBuffer *, color *, drawMode, int, int, int, int, int, int);
  1885.   // Desc : Draw an oval (circle, whatever) into the graphic buffer 'buffer', using the color 'foreground', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width', the height 'height', the line thickness 'thickness' and the fill value 'fill'.  Non-zero fill value means fill the oval.   If 'buffer' is NULL, draw directly onto the screen.  Currently not supported by the linear framebuffer graphic driver.
  1886.   return (syscall_9(_fnum_graphicDrawOval, buffer, foreground, (void *) mode,
  1887.             (void *) xCoord, (void *) yCoord, (void *) width,
  1888.             (void *) height, (void *) thickness, (void *) fill));
  1889. }
  1890.  
  1891. _X_ static inline int graphicDrawImage(objectKey buffer, image *drawImage, drawMode mode, int xCoord, int yCoord, int xOffset, int yOffset, int width, int height)
  1892. {
  1893.   // Proto: int kernelGraphicDrawImage(kernelGraphicBuffer *, image *, drawMode, int, int, int, int, int, int);
  1894.   // Desc : Draw the image 'drawImage' into the graphic buffer 'buffer', using the drawing mode 'mode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord' and the starting Y coordinate 'yCoord'.   The 'xOffset' and 'yOffset' parameters specify an offset into the image to start the drawing (0, 0 to draw the whole image).  Similarly the 'width' and 'height' parameters allow you to specify a portion of the image (0, 0 to draw the whole image -- minus any X or Y offsets from the previous parameters).  So, for example, to draw only the middle pixel of a 3x3 image, you would specify xOffset=1, yOffset=1, width=1, height=1.  If 'buffer' is NULL, draw directly onto the screen.
  1895.   return (syscall_9(_fnum_graphicDrawImage, buffer, drawImage, (void *) mode,
  1896.             (void *) xCoord, (void *) yCoord, (void *) xOffset,
  1897.             (void *) yOffset, (void *) width, (void *) height));
  1898. }
  1899.  
  1900. _X_ static inline int graphicGetImage(objectKey buffer, image *getImage, int xCoord, int yCoord, int width, int height)
  1901. {
  1902.   // Proto: int kernelGraphicGetImage(kernelGraphicBuffer *, image *, int, int, int, int);
  1903.   // Desc : Grab a new image 'getImage' from the graphic buffer 'buffer', using the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width' and the height 'height'.   If 'buffer' is NULL, grab the image directly from the screen.
  1904.   return (syscall_6(_fnum_graphicGetImage, buffer, getImage, (void *) xCoord,
  1905.             (void *) yCoord, (void *) width, (void *) height));
  1906. }
  1907.  
  1908. _X_ static inline int graphicDrawText(objectKey buffer, color *foreground, color *background, objectKey font, const char *text, drawMode mode, int xCoord, int yCoord)
  1909. {
  1910.   // Proto: int kernelGraphicDrawText(kernelGraphicBuffer *, color *, color *, kernelAsciiFont *, const char *, drawMode, int, int);
  1911.   // Desc : Draw the text string 'text' into the graphic buffer 'buffer', using the colors 'foreground' and 'background', the font 'font', the drawing mode 'drawMode' (for example, 'draw_normal' or 'draw_xor'), the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord'.   If 'buffer' is NULL, draw directly onto the screen.  If 'font' is NULL, use the default font.
  1912.   return (syscall_8(_fnum_graphicDrawText, buffer, foreground, background,
  1913.             font, (void *) text, (void *) mode, (void *) xCoord,
  1914.             (void *) yCoord));
  1915. }
  1916.  
  1917. _X_ static inline int graphicCopyArea(objectKey buffer, int xCoord1, int yCoord1, int width, int height, int xCoord2, int yCoord2)
  1918. {
  1919.   // Proto: int kernelGraphicCopyArea(kernelGraphicBuffer *, int, int, int, int, int, int);
  1920.   // Desc : Within the graphic buffer 'buffer', copy the area bounded by ('xCoord1', 'yCoord1'), width 'width' and height 'height' to the starting X coordinate 'xCoord2' and the starting Y coordinate 'yCoord2'.  If 'buffer' is NULL, copy directly to and from the screen.
  1921.   return (syscall_7(_fnum_graphicCopyArea, buffer, (void *) xCoord1,
  1922.             (void *) yCoord1, (void *) width, (void *) height,
  1923.             (void *) xCoord2, (void *) yCoord2));
  1924. }
  1925.  
  1926. _X_ static inline int graphicClearArea(objectKey buffer, color *background, int xCoord, int yCoord, int width, int height)
  1927. {
  1928.   // Proto: int kernelGraphicClearArea(kernelGraphicBuffer *, color *, int, int, int, int);
  1929.   // Desc : Clear the area of the graphic buffer 'buffer' using the background color 'background', using the starting X coordinate 'xCoord', the starting Y coordinate 'yCoord', the width 'width' and the height 'height'.  If 'buffer' is NULL, clear the area directly on the screen.
  1930.   return (syscall_6(_fnum_graphicClearArea, buffer, background,
  1931.             (void *) xCoord, (void *) yCoord, (void *) width,
  1932.             (void *) height));
  1933. }
  1934.  
  1935. _X_ static inline int graphicRenderBuffer(objectKey buffer, int drawX, int drawY, int clipX, int clipY, int clipWidth, int clipHeight)
  1936. {
  1937.   // Proto: int kernelGraphicRenderBuffer(kernelGraphicBuffer *, int, int, int, int, int, int); 
  1938.   // Desc : Draw the clip of the buffer 'buffer' onto the screen.  Draw it on the screen at starting X coordinate 'drawX' and starting Y coordinate 'drawY'.  The buffer clip is bounded by the starting X coordinate 'clipX', the starting Y coordinate 'clipY', the width 'clipWidth' and the height 'clipHeight'.  It is not legal for 'buffer' to be NULL in this case.
  1939.   return (syscall_7(_fnum_graphicRenderBuffer, buffer, (void *) drawX,
  1940.             (void *) drawY, (void *) clipX, (void *) clipY,
  1941.             (void *) clipWidth, (void *) clipHeight));
  1942. }
  1943.  
  1944.  
  1945. //
  1946. // Windowing system functions
  1947. //
  1948.  
  1949. _X_ static inline int windowLogin(const char *userName)
  1950. {
  1951.   // Proto: kernelWindowLogin(const char *, const char *);
  1952.   // Desc : Log the user into the window environment with 'userName'.  The return value is the PID of the window shell for this session.  The calling program must have supervisor privilege in order to use this function.
  1953.   return (syscall_1(_fnum_windowLogin, (void *) userName));
  1954. }
  1955.  
  1956. _X_ static inline int windowLogout(void)
  1957. {
  1958.   // Proto: kernelWindowLogout(void);
  1959.   // Desc : Log the current user out of the windowing system.  This kills the window shell process returned by windowLogin() call.
  1960.   return (syscall_0(_fnum_windowLogout));
  1961. }
  1962.  
  1963. _X_ static inline objectKey windowNew(int processId, const char *title)
  1964. {
  1965.   // Proto: kernelWindow *kernelWindowNew(int, const char *);
  1966.   // Desc : Create a new window, owned by the process 'processId', and with the title 'title'.  Returns an object key to reference the window, needed by most other window functions below (such as adding components to the window)
  1967.   return ((objectKey) syscall_2(_fnum_windowNew, (void *) processId,
  1968.                 (void *) title));
  1969. }
  1970.  
  1971. _X_ static inline objectKey windowNewDialog(objectKey parent, const char *title)
  1972. {
  1973.   // Proto: kernelWindow *kernelWindowNewDialog(kernelWindow *, const char *);
  1974.   // Desc : Create a dialog window to associate with the parent window 'parent', using the supplied title.  In the current implementation, dialog windows are modal, which is the main characteristic distinguishing them from regular windows.
  1975.   return ((objectKey) syscall_2(_fnum_windowNewDialog, parent,
  1976.                 (void *) title));
  1977. }
  1978.  
  1979. _X_ static inline int windowDestroy(objectKey window)
  1980. {
  1981.   // Proto: int kernelWindowDestroy(kernelWindow *);
  1982.   // Desc : Destroy the window referenced by the object key 'window'
  1983.   return (syscall_1(_fnum_windowDestroy, window));
  1984. }
  1985.  
  1986. _X_ static inline int windowUpdateBuffer(void *buffer, int xCoord, int yCoord, int width, int height)
  1987. {
  1988.   // Proto: kernelWindowUpdateBuffer(kernelGraphicBuffer *, int, int, int, int);
  1989.   // Desc : Tells the windowing system to redraw the visible portions of the graphic buffer 'buffer', using the given clip coordinates/size.
  1990.   return (syscall_5(_fnum_windowUpdateBuffer, buffer, (void *) xCoord,
  1991.             (void *) yCoord, (void *) width, (void *) height));
  1992. }
  1993.  
  1994. _X_ static inline int windowSetTitle(objectKey window, const char *title)
  1995. {
  1996.   // Proto: int kernelWindowSetTitle(kernelWindow *, const char *);
  1997.   // Desc : Set the new title of window 'window' to be 'title'.
  1998.   return (syscall_2(_fnum_windowSetTitle, window, (void *) title));
  1999. }
  2000.  
  2001.  
  2002. _X_ static inline int windowGetSize(objectKey window, int *width, int *height)
  2003. {
  2004.   // Proto: int kernelWindowGetSize(kernelWindow *, int *, int *);
  2005.   // Desc : Get the size of the window 'window', and put the results in 'width' and 'height'.
  2006.   return (syscall_3(_fnum_windowGetSize, window, width, height));
  2007. }
  2008.  
  2009. _X_ static inline int windowSetSize(objectKey window, int width, int height)
  2010. {
  2011.   // Proto: int kernelWindowSetSize(kernelWindow *, int, int);
  2012.   // Desc : Resize the window 'window' to the width 'width' and the height 'height'.
  2013.   return (syscall_3(_fnum_windowSetSize, window, (void *) width,
  2014.             (void *) height));
  2015. }
  2016.  
  2017. _X_ static inline int windowGetLocation(objectKey window, int *xCoord, int *yCoord)
  2018. {
  2019.   // Proto: int kernelWindowGetLocation(kernelWindow *, int *, int *);
  2020.   // Desc : Get the current screen location of the window 'window' and put it into the coordinate variables 'xCoord' and 'yCoord'.
  2021.   return (syscall_3(_fnum_windowGetLocation, window, xCoord, yCoord));
  2022. }
  2023.  
  2024. _X_ static inline int windowSetLocation(objectKey window, int xCoord, int yCoord)
  2025. {
  2026.   // Proto: int kernelWindowSetLocation(kernelWindow *, int, int);
  2027.   // Desc : Set the screen location of the window 'window' using the coordinate variables 'xCoord' and 'yCoord'.
  2028.   return (syscall_3(_fnum_windowSetLocation, window, (void *) xCoord,
  2029.             (void *) yCoord));
  2030. }
  2031.  
  2032. _X_ static inline int windowCenter(objectKey window)
  2033. {
  2034.   // Proto: int kernelWindowCenter(kernelWindow *);
  2035.   // Desc : Center 'window' on the screen.
  2036.   return (syscall_1(_fnum_windowCenter, window));
  2037. }
  2038.  
  2039. _X_ static inline int windowSnapIcons(objectKey parent)
  2040. {
  2041.   // Proto: void kernelWindowSnapIcons(void *);
  2042.   // Desc : If 'parent' (either a window or a windowContainer) has icon components inside it, this will snap them to a grid.
  2043.   return (syscall_1(_fnum_windowSnapIcons, parent));
  2044. }
  2045.  
  2046. _X_ static inline int windowSetHasBorder(objectKey window, int trueFalse)
  2047. {
  2048.   // Proto: int kernelWindowSetHasBorder(kernelWindow *, int);
  2049.   // Desc : Tells the windowing system whether to draw a border around the window 'window'.  'trueFalse' being non-zero means draw a border.  Windows have borders by default.
  2050.   return (syscall_2(_fnum_windowSetHasBorder, window, (void *) trueFalse));
  2051. }
  2052.  
  2053. _X_ static inline int windowSetHasTitleBar(objectKey window, int trueFalse)
  2054. {
  2055.   // Proto: int kernelWindowSetHasTitleBar(kernelWindow *, int);
  2056.   // Desc : Tells the windowing system whether to draw a title bar on the window 'window'.  'trueFalse' being non-zero means draw a title bar.  Windows have title bars by default.
  2057.   return (syscall_2(_fnum_windowSetHasTitleBar, window, (void *) trueFalse));
  2058. }
  2059.  
  2060. _X_ static inline int windowSetMovable(objectKey window, int trueFalse)
  2061. {
  2062.   // Proto: int kernelWindowSetMovable(kernelWindow *, int);
  2063.   // Desc : Tells the windowing system whether the window 'window' should be movable by the user (i.e. clicking and dragging it).  'trueFalse' being non-zero means the window is movable.  Windows are movable by default.
  2064.   return (syscall_2(_fnum_windowSetMovable, window, (void *) trueFalse));
  2065. }
  2066.  
  2067. _X_ static inline int windowSetResizable(objectKey window, int trueFalse)
  2068. {
  2069.   // Proto: int kernelWindowSetResizable(kernelWindow *, int);
  2070.   // Desc : Tells the windowing system whether to allow 'window' to be resized by the user.  'trueFalse' being non-zero means the window is resizable.  Windows are resizable by default.
  2071.   return (syscall_2(_fnum_windowSetResizable, window, (void *) trueFalse));
  2072. }
  2073.  
  2074. _X_ static inline int windowRemoveMinimizeButton(objectKey window)
  2075. {
  2076.   // Proto: int kernelWindowRemoveMinimizeButton(kernelWindow *);
  2077.   // Desc : Tells the windowing system not to draw a minimize button on the title bar of the window 'window'.  Windows have minimize buttons by default, as long as they have a title bar.  If there is no title bar, then this function has no effect.
  2078.   return (syscall_1(_fnum_windowRemoveMinimizeButton, window));
  2079. }  
  2080.  
  2081. _X_ static inline int windowRemoveCloseButton(objectKey window)
  2082. {
  2083.   // Proto: int kernelWindowRemoveCloseButton(kernelWindow *);
  2084.   // Desc : Tells the windowing system not to draw a close button on the title bar of the window 'window'.  Windows have close buttons by default, as long as they have a title bar.  If there is no title bar, then this function has no effect.
  2085.   return (syscall_1(_fnum_windowRemoveCloseButton, window));
  2086. }
  2087.  
  2088. _X_ static inline int windowSetColors(objectKey window, color *background)
  2089. {
  2090.   // Proto: int kernelWindowSetColors(kernelWindow *, color *);
  2091.   // Desc : Set the background color of 'window'.  If 'color' is NULL, use the default.
  2092.   return (syscall_2(_fnum_windowSetColors, window, background));
  2093. }
  2094.  
  2095. _X_ static inline int windowSetVisible(objectKey window, int visible)
  2096. {
  2097.   // Proto: int kernelWindowSetVisible(kernelWindow *, int);
  2098.   // Desc : Tell the windowing system whether to make 'window' visible or not.  Non-zero 'visible' means make the window visible.  When windows are created, they are not visible by default so you can add components, do layout, set the size, etc.
  2099.   return (syscall_2(_fnum_windowSetVisible, window, (void *) visible));
  2100. }
  2101.  
  2102. _X_ static inline void windowSetMinimized(objectKey window, int minimized)
  2103. {
  2104.   // Proto: void kernelWindowSetMinimized(kernelWindow *, int);
  2105.   // Desc : Tell the windowing system whether to make 'window' minimized or not.  Non-zero 'minimized' means make the window non-visible, but accessible via the task bar.  Zero 'minimized' means restore a minimized window to its normal, visible size.
  2106.   syscall_2(_fnum_windowSetMinimized, window, (void *) minimized);
  2107. }
  2108.  
  2109. _X_ static inline int windowAddConsoleTextArea(objectKey window)
  2110. {
  2111.   // Proto: int kernelWindowAddConsoleTextArea(kernelWindow *);
  2112.   // Desc : Add a console text area component to 'window'.  The console text area is where most kernel logging and error messages are sent, particularly at boot time.  Note that there is only one instance of the console text area, and thus it can only exist in one window at a time.  Destroying the window is one way to free the console area to be used in another window.
  2113.   return (syscall_1(_fnum_windowAddConsoleTextArea, window));
  2114. }
  2115.  
  2116. _X_ static inline void windowRedrawArea(int xCoord, int yCoord, int width, int height)
  2117. {
  2118.   // Proto: void kernelWindowRedrawArea(int, int, int, int);
  2119.   // Desc : Tells the windowing system to redraw whatever is supposed to be in the screen area bounded by the supplied coordinates.  This might be useful if you were drawing non-window-based things (i.e., things without their own independent graphics buffer) directly onto the screen and you wanted to restore an area to its original contents.  For example, the mouse driver uses this method to erase the pointer from its previous position.
  2120.   syscall_4(_fnum_windowRedrawArea, (void *) xCoord, (void *) yCoord,
  2121.         (void *) width, (void *) height);
  2122. }
  2123.  
  2124. _X_ static inline void windowDrawAll(void)
  2125. {
  2126.   // Proto: void kernelWindowDrawAll(void);
  2127.   // Desc : Tells the windowing system to (re)draw all the windows.
  2128.   syscall_0(_fnum_windowDrawAll);
  2129. }
  2130.  
  2131. _X_ static inline void windowResetColors(void)
  2132. {
  2133.   // Proto: void kernelWindowResetColors(void);
  2134.   // Desc : Tells the windowing system to reset the colors of all the windows and their components, and then re-draw all the windows.  Useful for example when the user has changed the color scheme.
  2135.   syscall_0(_fnum_windowResetColors);
  2136. }
  2137.  
  2138. _X_ static inline void windowProcessEvent(objectKey event)
  2139. {
  2140.   // Proto: void kernelWindowProcessEvent(windowEvent *);
  2141.   // Desc : Creates a window event using the supplied event structure.  This function is most often used within the kernel, particularly in the mouse and keyboard functions, to signify clicks or key presses.  It can, however, be used by external programs to create 'artificial' events.  The windowEvent structure specifies the target component and event type.
  2142.   syscall_1(_fnum_windowProcessEvent, event);
  2143. }
  2144.  
  2145. _X_ static inline int windowComponentEventGet(objectKey key, windowEvent *event)
  2146. {
  2147.   // Proto: int kernelWindowComponentEventGet(objectKey, windowEvent *);
  2148.   // Desc : Gets a pending window event, if any, applicable to component 'key', and puts the data into the windowEvent structure 'event'.  If an event was received, the function returns a positive, non-zero value (the actual value reflects the amount of raw data read from the component's event stream -- not particularly useful to an application).  If the return value is zero, no event was pending.
  2149.   return(syscall_2(_fnum_windowComponentEventGet, key, event));
  2150. }
  2151.  
  2152. _X_ static inline int windowTileBackground(const char *theFile)
  2153. {
  2154.   // Proto: int kernelWindowTileBackground(const char *);
  2155.   // Desc : Load the image file specified by the pathname 'theFile', and if successful, tile the image on the background root window.
  2156.   return (syscall_1(_fnum_windowTileBackground, (void *) theFile));
  2157. }
  2158.  
  2159. _X_ static inline int windowCenterBackground(const char *theFile)
  2160. {
  2161.   // Proto: int kernelWindowCenterBackground(const char *);
  2162.   // Desc : Load the image file specified by the pathname 'theFile', and if successful, center the image on the background root window.
  2163.   return (syscall_1(_fnum_windowCenterBackground, (void *) theFile));
  2164. }
  2165.  
  2166. _X_ static inline int windowScreenShot(image *saveImage)
  2167. {
  2168.   // Proto: int kernelWindowScreenShot(image *);
  2169.   // Desc : Get an image representation of the entire screen in the image data structure 'saveImage'.  Note that it is not necessary to allocate memory for the data pointer of the image structure beforehand, as this is done automatically.  You should, however, deallocate the data field of the image structure when you are finished with it.
  2170.   return (syscall_1(_fnum_windowScreenShot, saveImage));
  2171. }
  2172.  
  2173. _X_ static inline int windowSaveScreenShot(const char *filename)
  2174. {
  2175.   // Proto: int kernelWindowSaveScreenShot(const char *);
  2176.   // Desc : Save a screenshot of the entire screen to the file specified by the pathname 'filename'.
  2177.   return (syscall_1(_fnum_windowSaveScreenShot, (void *) filename));
  2178. }
  2179.  
  2180. _X_ static inline int windowSetTextOutput(objectKey key)
  2181. {
  2182.   // Proto: int kernelWindowSetTextOutput(kernelWindowComponent *);
  2183.   // Desc : Set the text output (and input) of the calling process to the object key of some window component, such as a TextArea or TextField component.  You'll need to use this if you want to output text to one of these components or receive input from one.
  2184.   return (syscall_1(_fnum_windowSetTextOutput, key));
  2185. }
  2186.  
  2187. _X_ static inline int windowLayout(objectKey window)
  2188. {
  2189.   // Proto: int kernelWindowLayout(kernelWindow *);
  2190.   // Desc : Layout, or re-layout, the requested window 'window'.  This function can be used when components are added to or removed from and already laid-out window.
  2191.   return (syscall_1(_fnum_windowLayout, window));
  2192. }
  2193.  
  2194. _X_ static inline void windowDebugLayout(objectKey window)
  2195. {
  2196.   // Proto: void kernelWindowDebugLayout(kernelWindow *);
  2197.   // Desc : This function draws grid boxes around all the grid cells containing components (or parts thereof).
  2198.   syscall_1(_fnum_windowDebugLayout, window);
  2199. }
  2200.  
  2201. _X_ static inline int windowContextAdd(objectKey parent, windowMenuContents *contents)
  2202. {
  2203.   // Proto: int kernelWindowContextAdd(objectKey, windowMenuContents *);
  2204.   // Desc : This function allows the caller to add context menu items in the 'content' structure to the supplied parent object 'parent' (can be a window or a component).  The function supplies the pointers to the new menu items in the caller's structure, which can then be manipulated to some extent (enable/disable, destroy, etc) using regular component functions.
  2205.   return (syscall_2(_fnum_windowContextAdd, parent, contents));
  2206. }
  2207.  
  2208. _X_ static inline int windowContextSet(objectKey parent, objectKey menu)
  2209. {
  2210.   // Proto: int kernelWindowContextSet(objectKey, kernelWindowComponent *);
  2211.   // Desc : This function allows the caller to set the context menu of the the supplied parent object 'parent' (can be a window or a component).
  2212.   return (syscall_2(_fnum_windowContextSet, parent, menu));
  2213. }
  2214.  
  2215. _X_ static inline int windowSwitchPointer(objectKey parent, const char *pointerName)
  2216. {
  2217.   // Proto: int kernelWinowSwitchPointer(objectKey, const char *)
  2218.   // Desc : Switch the mouse pointer for the parent window or component object 'parent' to the pointer represented by the name 'pointerName'.  Examples of pointer names are "default" and "busy".
  2219.   return (syscall_2(_fnum_windowSwitchPointer, parent, (char *) pointerName));
  2220. }
  2221.  
  2222. _X_ static inline void windowComponentDestroy(objectKey component)
  2223. {
  2224.   // Proto: void kernelWindowComponentDestroy(kernelWindowComponent *);
  2225.   // Desc : Deallocate and destroy a window component.
  2226.   syscall_1(_fnum_windowComponentDestroy, component);
  2227. }
  2228.  
  2229. _X_ static inline int windowComponentSetVisible(objectKey component, int visible)
  2230. {
  2231.   // Proto: int kernelWindowComponentSetVisible(kernelWindowComponent *, int);
  2232.   // Desc : Set 'component' visible or non-visible.
  2233.   return (syscall_2(_fnum_windowComponentSetVisible, component,
  2234.             (void *) visible));
  2235. }
  2236.  
  2237. _X_ static inline int windowComponentSetEnabled(objectKey component, int enabled)
  2238. {
  2239.   // Proto: int kernelWindowComponentSetEnabled(kernelWindowComponent *, int);
  2240.   // Desc : Set 'component' enabled or non-enabled; non-enabled components appear greyed-out.
  2241.   return (syscall_2(_fnum_windowComponentSetEnabled, component,
  2242.             (void *) enabled));
  2243. }
  2244.  
  2245. _X_ static inline int windowComponentGetWidth(objectKey component)
  2246. {
  2247.   // Proto: int kernelWindowComponentGetWidth(kernelWindowComponent *);
  2248.   // Desc : Get the pixel width of the window component 'component'.
  2249.   return (syscall_1(_fnum_windowComponentGetWidth, component));
  2250. }
  2251.  
  2252. _X_ static inline int windowComponentSetWidth(objectKey component, int width)
  2253. {
  2254.   // Proto: int kernelWindowComponentSetWidth(kernelWindowComponent *, int);
  2255.   // Desc : Set the pixel width of the window component 'component'
  2256.   return (syscall_2(_fnum_windowComponentSetWidth, component, (void *) width));
  2257. }
  2258.  
  2259. _X_ static inline int windowComponentGetHeight(objectKey component)
  2260. {
  2261.   // Proto: int kernelWindowComponentGetHeight(kernelWindowComponent *);
  2262.   // Desc : Get the pixel height of the window component 'component'.
  2263.   return (syscall_1(_fnum_windowComponentGetHeight, component));
  2264. }
  2265.  
  2266. _X_ static inline int windowComponentSetHeight(objectKey component, int height)
  2267. {
  2268.   // Proto: int kernelWindowComponentSetHeight(kernelWindowComponent *, int);
  2269.   // Desc : Set the pixel height of the window component 'component'.
  2270.   return (syscall_2(_fnum_windowComponentSetHeight, component,
  2271.             (void *) height));
  2272. }
  2273.  
  2274. _X_ static inline int windowComponentFocus(objectKey component)
  2275. {
  2276.   // Proto: int kernelWindowComponentFocus(kernelWindowComponent *);
  2277.   // Desc : Give window component 'component' the focus of its window.
  2278.   return (syscall_1(_fnum_windowComponentFocus, component));
  2279. }
  2280.  
  2281. _X_ static inline int windowComponentDraw(objectKey component)
  2282. {
  2283.   // Proto: int kernelWindowComponentDraw(kernelWindowComponent *)
  2284.   // Desc : Calls the window component 'component' to redraw itself.
  2285.   return (syscall_1(_fnum_windowComponentDraw, component));
  2286. }
  2287.  
  2288. _X_ static inline int windowComponentGetData(objectKey component, void *buffer, int size)
  2289. {
  2290.   // Proto: int kernelWindowComponentGetData(kernelWindowComponent *, void *, int);
  2291.   // Desc : This is a generic call to get data from the window component 'component', up to 'size' bytes, in the buffer 'buffer'.  The size and type of data that a given component will return is totally dependent upon the type and implementation of the component.
  2292.   return (syscall_3(_fnum_windowComponentGetData, component, buffer,
  2293.             (void *) size));
  2294. }
  2295.  
  2296. _X_ static inline int windowComponentSetData(objectKey component, void *buffer, int size)
  2297. {
  2298.   // Proto: int kernelWindowComponentSetData(kernelWindowComponent *, void *, int);
  2299.   // Desc : This is a generic call to set data in the window component 'component', up to 'size' bytes, in the buffer 'buffer'.  The size and type of data that a given component will use or accept is totally dependent upon the type and implementation of the component.
  2300.   return (syscall_3(_fnum_windowComponentSetData, component, buffer,
  2301.             (void *) size));
  2302. }
  2303.  
  2304. _X_ static inline int windowComponentGetSelected(objectKey component, int *selection)
  2305. {
  2306.   // Proto: int kernelWindowComponentGetSelected(kernelWindowComponent *);
  2307.   // Desc : This is a call to get the 'selected' value of the window component 'component'.  The type of value returned depends upon the type of component; a list component, for example, will return the 0-based number(s) of its selected item(s).  On the other hand, a boolean component such as a checkbox will return 1 if it is currently selected.
  2308.   return (syscall_2(_fnum_windowComponentGetSelected, component, selection));
  2309. }
  2310.  
  2311. _X_ static inline int windowComponentSetSelected(objectKey component, int selected)
  2312. {
  2313.   // Proto: int kernelWindowComponentSetSelected(kernelWindowComponent *, int);
  2314.   // Desc : This is a call to set the 'selected' value of the window component 'component'.  The type of value accepted depends upon the type of component; a list component, for example, will use the 0-based number to select one of its items.  On the other hand, a boolean component such as a checkbox will clear itself if 'selected' is 0, and set itself otherwise.
  2315.   return (syscall_2(_fnum_windowComponentSetSelected, component,
  2316.             (void *) selected));
  2317. }
  2318.  
  2319. _X_ static inline objectKey windowNewButton(objectKey parent, const char *label, image *buttonImage, componentParameters *params)
  2320. {
  2321.   // Proto: kernelWindowComponent *kernelWindowNewButton(objectKey, const char *, image *, componentParameters *);
  2322.   // Desc : Get a new button component to be placed inside the parent object 'parent', with the given component parameters, and with the (optional) label 'label', or the (optional) image 'buttonImage'.  Either 'label' or 'buttonImage' can be used, but not both.
  2323.   return ((objectKey) syscall_4(_fnum_windowNewButton, parent, (void *) label,
  2324.                 buttonImage, params));
  2325. }
  2326.  
  2327. _X_ static inline objectKey windowNewCanvas(objectKey parent, int width, int height, componentParameters *params)
  2328. {
  2329.   // Proto: kernelWindowComponent *kernelWindowNewCanvas(objectKey, int, int, componentParameters *);
  2330.   // Desc : Get a new canvas component, to be placed inside the parent object 'parent', using the supplied width and height, with the given component parameters.  Canvas components are areas which will allow drawing operations, for example to show line drawings or unique graphical elements.
  2331.   return ((objectKey) syscall_4(_fnum_windowNewCanvas, parent,
  2332.                 (void *) width, (void *) height, params));
  2333. }
  2334.  
  2335. _X_ static inline objectKey windowNewCheckbox(objectKey parent, const char *text, componentParameters *params)
  2336. {
  2337.   // Proto: kernelWindowComponent *kernelWindowNewCheckbox(objectKey, const char *, componentParameters *);
  2338.   // Desc : Get a new checkbox component, to be placed inside the parent object 'parent', using the accompanying text 'text', and with the given component parameters.
  2339.   return ((objectKey) syscall_3(_fnum_windowNewCheckbox, parent, (void *) text,
  2340.                 params));
  2341. }
  2342.  
  2343. _X_ static inline objectKey windowNewContainer(objectKey parent, const char *name, componentParameters *params)
  2344. {
  2345.   // Proto: kernelWindowComponent *kernelWindowNewContainer(objectKey, const char *, componentParameters *);
  2346.   // Desc : Get a new container component, to be placed inside the parent object 'parent', using the name 'name', and with the given component parameters.  Containers are useful for layout when a simple grid is not sufficient.  Each container has its own internal grid layout (for components it contains) and external grid parameters for placing it inside a window or another container.  Containers can be nested arbitrarily.  This allows limitless control over a complex window layout.
  2347.   return ((objectKey) syscall_3(_fnum_windowNewContainer, parent,
  2348.                 (void *) name, params));
  2349. }
  2350.  
  2351. _X_ static inline objectKey windowNewIcon(objectKey parent, image *iconImage, const char *label, componentParameters *params)
  2352. {
  2353.   // Proto: kernelWindowComponent *kernelWindowNewIcon(objectKey, image *, const char *, const char *, componentParameters *);
  2354.   // Desc : Get a new icon component to be placed inside the parent object 'parent', using the image data structure 'iconImage' and the label 'label', and with the given component parameters 'params'.
  2355.   return ((objectKey) syscall_4(_fnum_windowNewIcon, parent, iconImage,
  2356.                 (void *) label, params));
  2357. }
  2358.  
  2359. _X_ static inline objectKey windowNewImage(objectKey parent, image *baseImage, drawMode mode, componentParameters *params)
  2360. {
  2361.   // Proto: kernelWindowComponent *kernelWindowNewImage(objectKey, image *, drawMode, componentParameters *);
  2362.   // Desc : Get a new image component to be placed inside the parent object 'parent', using the image data structure 'baseImage', and with the given component parameters 'params'.
  2363.   return ((objectKey) syscall_4(_fnum_windowNewImage, parent, baseImage,
  2364.                 (void *) mode, params));
  2365. }
  2366.  
  2367. _X_ static inline objectKey windowNewList(objectKey parent, windowListType type, int rows, int columns, int multiple, listItemParameters *items, int numItems, componentParameters *params)
  2368. {
  2369.   // Proto: kernelWindowComponent *kernelWindowNewList(objectKey, windowListType, int, int, int, listItemParameters *, int, componentParameters *);
  2370.   // Desc : Get a new window list component to be placed inside the parent object 'parent', using the component parameters 'params'.  'type' specifies the type of list (see <sys/window.h> for possibilities), 'rows' and 'columns' specify the size of the list and layout of the list items, 'multiple' allows multiple selections if non-zero, and 'items' is an array of 'numItems' list item parameters.
  2371.   return ((objectKey) syscall_8(_fnum_windowNewList, parent, (void *) type,
  2372.                 (void *) rows, (void *) columns,
  2373.                 (void *) multiple, items, (void *) numItems,
  2374.                 params));
  2375. }
  2376.  
  2377. _X_ static inline objectKey windowNewListItem(objectKey parent, listItemParameters *item, componentParameters *params)
  2378. {
  2379.   // Proto: kernelWindowComponent *kernelWindowNewListItem(objectKey, windowListType, listItemParameters *, componentParameters *);
  2380.   // Desc : Get a new list item component to be placed inside the parent object 'parent', using the list item parameters 'item', and the component parameters 'params'.
  2381.   return ((objectKey) syscall_3(_fnum_windowNewListItem, parent, item,
  2382.                 params));
  2383. }
  2384.  
  2385. _X_ static inline objectKey windowNewMenu(objectKey parent, const char *name, windowMenuContents *contents, componentParameters *params)
  2386. {
  2387.   // Proto: kernelWindowComponent *kernelWindowNewMenu(objectKey, const char *, windowMenuContents *, componentParameters *);
  2388.   // Desc : Get a new menu component to be placed inside the parent object 'parent', using the name 'name' (which will be the header of the menu in a menu bar, for example), the menu contents structure 'contents', and the component parameters 'params'.  A menu component is an instance of a container, typically contains menu item components, and is typically added to a menu bar component.
  2389.   return ((objectKey) syscall_4(_fnum_windowNewMenu, parent, (void *) name,
  2390.                 contents, params));
  2391. }
  2392.  
  2393. _X_ static inline objectKey windowNewMenuBar(objectKey window, componentParameters *params)
  2394. {
  2395.   // Proto: kernelWindowComponent *kernelWindowNewMenuBar(kernelWindow *, componentParameters *);
  2396.   // Desc : Get a new menu bar component to be placed inside the window 'window', using the component parameters 'params'.  A menu bar component is an instance of a container, and typically contains menu components.
  2397.   return ((objectKey) syscall_2(_fnum_windowNewMenuBar, window, params));
  2398. }
  2399.  
  2400. _X_ static inline objectKey windowNewMenuItem(objectKey parent, const char *text, componentParameters *params)
  2401. {
  2402.   // Proto: kernelWindowComponent *kernelWindowNewMenuItem(objectKey, const char *, componentParameters *);
  2403.   // Desc : Get a new menu item component to be placed inside the parent object 'parent', using the string 'text' and the component parameters 'params'.  A menu item  component is typically added to menu components, which are in turn added to menu bar components.
  2404.   return ((objectKey) syscall_3(_fnum_windowNewMenuItem, parent, (void *) text,
  2405.                 params));
  2406. }
  2407.  
  2408. _X_ static inline objectKey windowNewPasswordField(objectKey parent, int columns, componentParameters *params)
  2409. {
  2410.   // Proto: kernelWindowComponent *kernelWindowNewPasswordField(objectKey, int, componentParameters *);
  2411.   // Desc : Get a new password field component to be placed inside the parent object 'parent', using 'columns' columns and the component parameters 'params'.  A password field component is a special case of a text field component, and behaves the same way except that typed characters are shown as asterisks (*).
  2412.   return ((objectKey) syscall_3(_fnum_windowNewPasswordField, parent,
  2413.                 (void *) columns, params));
  2414. }
  2415.  
  2416. _X_ static inline objectKey windowNewProgressBar(objectKey parent, componentParameters *params)
  2417. {
  2418.   // Proto: kernelWindowComponent *kernelWindowNewProgressBar(objectKey, componentParameters *);
  2419.   // Desc : Get a new progress bar component to be placed inside the parent object 'parent', using the component parameters 'params'.  Use the windowComponentSetData() function to set the percentage of progress.
  2420.   return ((objectKey) syscall_2(_fnum_windowNewProgressBar, parent, params));
  2421. }
  2422.  
  2423. _X_ static inline objectKey windowNewRadioButton(objectKey parent, int rows, int columns, char *items[], int numItems, componentParameters *params)
  2424. {
  2425.   // Proto: kernelWindowComponent *kernelWindowNewRadioButton(objectKey, int, int, const char **, int, componentParameters *);
  2426.   // Desc : Get a new radio button component to be placed inside the parent object 'parent', using the component parameters 'params'.  'rows' and 'columns' specify the size and layout of the items, and 'numItems' specifies the number of strings in the array 'items', which specifies the different radio button choices.  The windowComponentSetSelected() and windowComponentGetSelected() functions can be used to get and set the selected item (numbered from zero, in the order they were supplied in 'items').
  2427.   return ((objectKey) syscall_6(_fnum_windowNewRadioButton, parent,
  2428.                 (void *) rows, (void *) columns,
  2429.                 items, (void *) numItems, params));
  2430. }
  2431.  
  2432. _X_ static inline objectKey windowNewScrollBar(objectKey parent, scrollBarType type, int width, int height, componentParameters *params)
  2433. {
  2434.   // Proto: kernelWindowComponent *kernelWindowNewScrollBar(objectKey, scrollBarType, int, int, componentParameters *);
  2435.   // Desc : Get a new scroll bar component to be placed inside the parent object 'parent', with the scroll bar type 'type', and the given component parameters 'params'.
  2436.   return ((objectKey) syscall_5(_fnum_windowNewScrollBar, parent,
  2437.                 (void *) type, (void *) width, (void *) height,
  2438.                 params));
  2439. }
  2440.  
  2441. _X_ static inline objectKey windowNewSlider(objectKey parent, scrollBarType type, int width, int height, componentParameters *params)
  2442. {
  2443.   // Proto: kernelWindowComponent *kernelWindowNewSlider(objectKey, scrollBarType, int, int, componentParameters *);
  2444.   // Desc : Get a new slider component to be placed inside the parent object 'parent', with the scroll bar type 'type', and the given component parameters 'params'.
  2445.   return ((objectKey) syscall_5(_fnum_windowNewSlider, parent, (void *) type,
  2446.                 (void *) width, (void *) height, params));
  2447. }
  2448.  
  2449. _X_ static inline objectKey windowNewTextArea(objectKey parent, int columns, int rows, int bufferLines, componentParameters *params)
  2450. {
  2451.   // Proto: kernelWindowComponent *kernelWindowNewTextArea(objectKey, int, int, int, componentParameters *);
  2452.   // Desc : Get a new text area component to be placed inside the parent object 'parent', with the given component parameters 'params'.  The 'columns' and 'rows' are the visible portion, and 'bufferLines' is the number of extra lines of scrollback memory.  If 'font' is NULL, the default font will be used.
  2453.   return ((objectKey) syscall_5(_fnum_windowNewTextArea, parent,
  2454.                 (void *) columns, (void *) rows,
  2455.                 (void *) bufferLines, params));
  2456. }
  2457.  
  2458. _X_ static inline objectKey windowNewTextField(objectKey parent, int columns, componentParameters *params)
  2459. {
  2460.   // Proto: kernelWindowComponent *kernelWindowNewTextField(objectKey, int, componentParameters *);
  2461.   // Desc : Get a new text field component to be placed inside the parent object 'parent', using the number of columns 'columns' and with the given component parameters 'params'.  Text field components are essentially 1-line 'text area' components.  If the params 'font' is NULL, the default font will be used.
  2462.   return ((objectKey) syscall_3(_fnum_windowNewTextField, parent,
  2463.                 (void *) columns, params));
  2464. }
  2465.  
  2466. _X_ static inline objectKey windowNewTextLabel(objectKey parent, const char *text, componentParameters *params)
  2467. {
  2468.   // Proto: kernelWindowComponent *kernelWindowNewTextLabel(objectKey, const char *, componentParameters *);
  2469.   // Desc : Get a new text labelComponent to be placed inside the parent object 'parent', with the given component parameters 'params', and using the text string 'text'.  If the params 'font' is NULL, the default font will be used.
  2470.   return ((objectKey) syscall_3(_fnum_windowNewTextLabel, parent,
  2471.                 (void *) text, params));
  2472. }
  2473.  
  2474.  
  2475. //
  2476. // User functions
  2477. //
  2478.  
  2479. _X_ static inline int userAuthenticate(const char *name, const char *password)
  2480. {
  2481.   // Proto: int kernelUserAuthenticate(const char *, const char *);
  2482.   // Desc : Given the user 'name', return 0 if 'password' is the correct password.
  2483.   return (syscall_2(_fnum_userAuthenticate, (void *) name, (void *) password));
  2484. }
  2485.  
  2486. _X_ static inline int userLogin(const char *name, const char *password)
  2487. {
  2488.   // Proto: int kernelUserLogin(const char *, const char *);
  2489.   // Desc : Log the user 'name' into the system, using the password 'password'.  Calling this function requires supervisor privilege level.
  2490.   return (syscall_2(_fnum_userLogin, (void *) name, (void *) password));
  2491. }
  2492.  
  2493. _X_ static inline int userLogout(const char *name)
  2494. {
  2495.   // Proto: int kernelUserLogout(const char *);
  2496.   // Desc : Log the user 'name' out of the system.  This can only be called by a process with supervisor privilege, or one running as the same user being logged out.
  2497.   return (syscall_1(_fnum_userLogout, (void *) name));
  2498. }
  2499.  
  2500. _X_ static inline int userGetNames(char *buffer, unsigned bufferSize)
  2501. {
  2502.   // Proto: int kernelUserGetNames(char *, unsigned);
  2503.   // Desc : Fill the buffer 'buffer' with the names of all users, up to 'bufferSize' bytes.
  2504.   return (syscall_2(_fnum_userGetNames, buffer, (void *) bufferSize));
  2505. }
  2506.  
  2507. _X_ static inline int userAdd(const char *name, const char *password)
  2508. {
  2509.   // Proto: int kernelUserAdd(const char *, const char *);
  2510.   // Desc : Add the user 'name' with the password 'password'
  2511.   return (syscall_2(_fnum_userAdd, (void *) name, (void *) password));
  2512. }
  2513.  
  2514. _X_ static inline int userDelete(const char *name)
  2515. {
  2516.   // Proto: int kernelUserDelete(const char *);
  2517.   // Desc : Delete the user 'name'
  2518.   return (syscall_1(_fnum_userDelete, (void *) name));
  2519. }
  2520.  
  2521. _X_ static inline int userSetPassword(const char *name, const char *oldPass, const char *newPass)
  2522. {
  2523.   // Proto: int kernelUserSetPassword(const char *, const char *, const char *);
  2524.   // Desc : Set the password of user 'name'.  If the calling program is not supervisor privilege, the correct old password must be supplied in 'oldPass'.  The new password is supplied in 'newPass'.
  2525.   return (syscall_3(_fnum_userSetPassword, (void *) name, (void *) oldPass,
  2526.             (void *) newPass));
  2527. }
  2528.  
  2529. _X_ static inline int userGetPrivilege(const char *name)
  2530. {
  2531.   // Proto: int kernelUserGetPrivilege(const char *);
  2532.   // Desc : Get the privilege level of the user represented by 'name'.
  2533.   return (syscall_1(_fnum_userGetPrivilege, (void *) name));
  2534. }
  2535.  
  2536. _X_ static inline int userGetPid(void)
  2537. {
  2538.   // Proto: int kernelUserGetPid(void);
  2539.   // Desc : Get the process ID of the current user's 'login process'.
  2540.   return (syscall_0(_fnum_userGetPid));
  2541. }
  2542.  
  2543. _X_ static inline int userSetPid(const char *name, int pid)
  2544. {
  2545.   // Proto: int kernelUserSetPid(const char *, int);
  2546.   // Desc : Set the login PID of user 'name' to 'pid'.  This is the process that gets killed when the user indicates that they want to logout.  In graphical mode this will typically be the PID of the window shell pid, and in text mode it will be the PID of the login VSH shell.
  2547.   return (syscall_2(_fnum_userSetPid, (void *) name, (void *) pid));
  2548. }
  2549.  
  2550. _X_ static inline int userFileAdd(const char *passFile, const char *userName, const char *password)
  2551. {
  2552.   // Proto: int kernelUserFileAdd(const char *, const char *, const char *);
  2553.   // Desc : Add a user to the designated password file, with the given name and password.  This can only be done by a privileged user.
  2554.   return (syscall_3(_fnum_userFileAdd, (void *) passFile, (void *) userName,
  2555.             (void *) password));
  2556. }
  2557.  
  2558. _X_ static inline int userFileDelete(const char *passFile, const char *userName)
  2559. {
  2560.   // Proto: int kernelUserFileDelete(const char *, const char *);
  2561.   // Desc : Remove a user from the designated password file.  This can only be done by a privileged user
  2562.   return (syscall_2(_fnum_userFileDelete, (void *) passFile,
  2563.             (void *) userName));
  2564. }
  2565.  
  2566. _X_ static inline int userFileSetPassword(const char *passFile, const char *userName, const char *oldPass, const char *newPass)
  2567. {
  2568.   // Proto: int kernelUserFileSetPassword(const char *, const char *, const char *, const char *);
  2569.   // Desc : Set the password of user 'userName' in the designated password file.  If the calling program is not supervisor privilege, the correct old password must be supplied in 'oldPass'.  The new password is supplied in 'newPass'.
  2570.   return (syscall_4(_fnum_userFileSetPassword, (void *) passFile,
  2571.             (void *) userName, (void *) oldPass, (void *) newPass));
  2572. }
  2573.  
  2574.  
  2575. //
  2576. // Network functions
  2577. //
  2578.  
  2579. _X_ static inline int networkDeviceGetCount(void)
  2580. {
  2581.   // Proto: int kernelNetworkDeviceGetCount(void);
  2582.   // Desc: Returns the count of network devices
  2583.   return (syscall_0(_fnum_networkDeviceGetCount));
  2584. }
  2585.  
  2586. _X_ static inline int networkDeviceGet(const char *name, networkDevice *dev)
  2587. {
  2588.   // Proto: int kernelNetworkDeviceGet(int, networkDevice *);
  2589.   // Desc: Returns the user-space portion of the requested (by 'name') network device in 'dev'.
  2590.   return (syscall_2(_fnum_networkDeviceGet, (char *) name, dev));
  2591. }
  2592.  
  2593. _X_ static inline int networkInitialized(void)
  2594. {
  2595.   // Proto: int kernelNetworkInitialized(void);
  2596.   // Desc: Returns 1 if networking is currently enabled.
  2597.   return (syscall_0(_fnum_networkInitialized));
  2598. }
  2599.  
  2600. _X_ static inline int networkInitialize(void)
  2601. {
  2602.   // Proto: int kernelNetworkInitialize(void);
  2603.   // Desc: Initialize and start networking.
  2604.   return (syscall_0(_fnum_networkInitialize));
  2605. }
  2606.  
  2607. _X_ static inline int networkShutdown(void)
  2608. {
  2609.   // Proto: int kernelNetworkShutdown(void);
  2610.   // Desc: Shut down networking.
  2611.   return (syscall_0(_fnum_networkShutdown));
  2612. }
  2613.  
  2614. _X_ static inline objectKey networkOpen(int mode, networkAddress *address, networkFilter *filter)
  2615. {
  2616.   // Proto: kernelNetworkConnection *kernelNetworkOpen(int, networkAddress *, networkFilter *);
  2617.   // Desc: Opens a connection for network communication.  The 'type' and 'mode' arguments describe the kind of connection to make (see possiblilities in the file <sys/network.h>.  If applicable, 'address' specifies the network address of the remote host to connect to.  If applicable, the 'localPort' and 'remotePort' arguments specify the TCP/UDP ports to use.
  2618.   return ((objectKey) syscall_3(_fnum_networkOpen, (void *) mode, address,
  2619.                 filter));
  2620. }
  2621.  
  2622. _X_ static inline int networkClose(objectKey connection)
  2623. {
  2624.   // Proto: int kernelNetworkClose(kernelNetworkConnection *);
  2625.   // Desc: Close the specified, previously-opened network connection.
  2626.   return (syscall_1(_fnum_networkClose, connection));
  2627. }
  2628.  
  2629. _X_ static inline int networkCount(objectKey connection)
  2630. {
  2631.   // Proto: int kernelNetworkCount(kernelNetworkConnection *connection);
  2632.   // Desc: Given a network connection, return the number of bytes currently pending in the input stream
  2633.   return (syscall_1(_fnum_networkCount, connection));
  2634. }
  2635.  
  2636. _X_ static inline int networkRead(objectKey connection, unsigned char *buffer, unsigned bufferSize)
  2637. {
  2638.   // Proto: int kernelNetworkRead(kernelNetworkConnection *, unsigned char *, unsigned);
  2639.   // Desc: Given a network connection, a buffer, and a buffer size, read up to 'bufferSize' bytes (or the number of bytes available in the connection's input stream) and return the number read.  The connection must be initiated using the networkConnectionOpen() function.
  2640.   return (syscall_3(_fnum_networkRead, connection, buffer,
  2641.             (void *) bufferSize));
  2642. }
  2643.  
  2644. _X_ static inline int networkWrite(objectKey connection, unsigned char *buffer, unsigned bufferSize)
  2645. {
  2646.   // Proto: int kernelNetworkWrite(kernelNetworkConnection *, unsigned char *, unsigned);
  2647.   // Desc: Given a network connection, a buffer, and a buffer size, write up to 'bufferSize' bytes from 'buffer' to the connection's output.  The connection must be initiated using the networkConnectionOpen() function.
  2648.   return (syscall_3(_fnum_networkWrite, connection, buffer,
  2649.             (void *) bufferSize));
  2650. }
  2651.  
  2652. _X_ static inline int networkPing(objectKey connection, int seqNum, unsigned char *buffer, unsigned bufferSize)
  2653. {
  2654.   // Proto: int kernelNetworkPing(kernelNetworkConnection *, int, unsigned char *, unsigned);
  2655.   // Desc: Send an ICMP "echo request" packet to the host at the network address 'destAddress', with the (optional) sequence number 'seqNum'.  The 'buffer' and 'bufferSize' arguments point to the location of data to send in the ping packet.  The content of the data is mostly irrelevant, except that it can be checked to ensure the same data is returned by the ping reply from the remote host.
  2656.   return (syscall_4(_fnum_networkPing, connection, (void *) seqNum, buffer,
  2657.             (void *) bufferSize));
  2658. }
  2659.  
  2660. _X_ static inline int networkGetHostName(char *buffer, int bufferSize)
  2661. {
  2662.   // Proto: int kernelNetworkGetHostName(char *, int);
  2663.   // Desc: Returns up to 'bufferSize' bytes of the system's network hostname in 'buffer' 
  2664.   return (syscall_2(_fnum_networkGetHostName, buffer, (void *) bufferSize));
  2665. }
  2666.  
  2667. _X_ static inline int networkSetHostName(const char *buffer, int bufferSize)
  2668. {
  2669.   // Proto: int kernelNetworkSetHostName(const char *, int);
  2670.   // Desc: Sets the system's network hostname using up to 'bufferSize' bytes from 'buffer'
  2671.   return (syscall_2(_fnum_networkSetHostName, (char *) buffer,
  2672.             (void *) bufferSize));
  2673. }
  2674.  
  2675. _X_ static inline int networkGetDomainName(char *buffer, int bufferSize)
  2676. {
  2677.   // Proto: int kernelNetworkGetDomainName(char *, int);
  2678.   // Desc: Returns up to 'bufferSize' bytes of the system's network domain name in 'buffer' 
  2679.   return (syscall_2(_fnum_networkGetDomainName, buffer, (void *) bufferSize));
  2680. }
  2681.  
  2682. _X_ static inline int networkSetDomainName(const char *buffer, int bufferSize)
  2683. {
  2684.   // Proto: int kernelNetworkSetDomainName(const char *, int);
  2685.   // Desc: Sets the system's network domain name using up to 'bufferSize' bytes from 'buffer'
  2686.   return (syscall_2(_fnum_networkSetDomainName, (char *) buffer,
  2687.             (void *) bufferSize));
  2688. }
  2689.  
  2690.  
  2691. //
  2692. // Miscellaneous functions
  2693. //
  2694.  
  2695. _X_ static inline int fontGetDefault(objectKey *pointer)
  2696. {
  2697.   // Proto: int kernelFontGetDefault(kernelAsciiFont **);
  2698.   // Desc : Get an object key in 'pointer' to refer to the current default font.
  2699.   return (syscall_1(_fnum_fontGetDefault, pointer));
  2700. }
  2701.  
  2702. _X_ static inline int fontSetDefault(const char *name)
  2703. {
  2704.   // Proto: int kernelFontSetDefault(const char *);
  2705.   // Desc : Set the default font for the system to the font with the name 'name'.  The font must previously have been loaded by the system, for example using the fontLoad()  function.
  2706.   return (syscall_1(_fnum_fontSetDefault, (void *) name));
  2707. }
  2708.  
  2709. _X_ static inline int fontLoad(const char* filename, const char *fontname, objectKey *pointer, int fixedWidth)
  2710. {
  2711.   // Proto: int kernelFontLoad(const char*, const char*, kernelAsciiFont **, int);
  2712.   // Desc : Load the font from the font file 'filename', give it the font name 'fontname' for future reference, and return an object key for the font in 'pointer' if successful.  The integer 'fixedWidth' argument should be non-zero if you want each character of the font to have uniform width (i.e. an 'i' character will be padded with empty space so that it takes up the same width as, for example, a 'W' character).
  2713.   return (syscall_4(_fnum_fontLoad, (void *) filename, (void *) fontname,
  2714.             pointer, (void *) fixedWidth));
  2715. }
  2716.  
  2717. _X_ static inline int fontGetPrintedWidth(objectKey font, const char *string)
  2718. {
  2719.   // Proto: int kernelFontGetPrintedWidth(kernelAsciiFont *, const char *);
  2720.   // Desc : Given the supplied string, return the screen width that the text will consume given the font 'font'.  Useful for placing text when using a variable-width font, but not very useful otherwise.
  2721.   return (syscall_2(_fnum_fontGetPrintedWidth, font, (void *) string));
  2722. }
  2723.  
  2724. _X_ static inline int fontGetWidth(objectKey font)
  2725. {
  2726.   // Proto: int kernelFontGetWidth(kernelAsciiFont *font)
  2727.   // Desc : Returns the character width of the supplied font.  Only useful when the font is fixed-width.
  2728.   return (syscall_1(_fnum_fontGetWidth, font));
  2729. }
  2730.  
  2731. _X_ static inline int fontGetHeight(objectKey font)
  2732. {
  2733.   // Proto: int kernelFontGetHeight(kernelAsciiFont *font)
  2734.   // Desc : Returns the character height of the supplied font.
  2735.   return (syscall_1(_fnum_fontGetHeight, font));
  2736. }
  2737.  
  2738. _X_ static inline int imageLoad(const char *filename, int width, int height, image *loadImage)
  2739. {
  2740.   // Proto: int imageLoad(const char *, int, int, image *);
  2741.   // Desc : Try to load the bitmap image file 'filename' (with the specified 'width' and 'height' if possible -- zeros indicate no preference), and if successful, save the data in the image data structure 'loadImage'.
  2742.   return (syscall_4(_fnum_imageLoad, (void *) filename,(void *) width,
  2743.             (void *) height, loadImage));
  2744. }
  2745.  
  2746. _X_ static inline int imageSave(const char *filename, int format, image *saveImage)
  2747. {
  2748.   // Proto: int imageSave(const char *, int, image *);
  2749.   // Desc : Save the image data structure 'saveImage' using the image format 'format' to the file 'fileName'.  Image format codes are found in the file <sys/image.h>
  2750.   return (syscall_3(_fnum_imageSave, (void *) filename, (void *) format,
  2751.             saveImage));
  2752. }
  2753.  
  2754. _X_ static inline int shutdown(int reboot, int nice)
  2755. {
  2756.   // Proto: int kernelShutdown(int, int);
  2757.   // Desc : Shut down the system.  If 'reboot' is non-zero, the system will reboot.  If 'nice' is zero, the shutdown will be orderly and will abort if serious errors are detected.  If 'nice' is non-zero, the system will go down like a kamikaze regardless of errors.
  2758.   return (syscall_2(_fnum_shutdown, (void *) reboot, (void *) nice));
  2759. }
  2760.  
  2761. _X_ static inline void getVersion(char *buff, int buffSize)
  2762. {
  2763.   // Proto: void kernelGetVersion(char *, int);
  2764.   // Desc : Get the kernel's version string int the buffer 'buff', up to 'buffSize' bytes
  2765.   syscall_2(_fnum_getVersion, buff, (void *) buffSize);
  2766. }
  2767.  
  2768. _X_ static inline int systemInfo(struct utsname *uname)
  2769. {
  2770.   // Proto: int kernelSystemInfo(void *);
  2771.   // Desc : Gathers some info about the system and puts it into the utsname structure 'uname', just like the one returned by the system call 'uname' in Unix.
  2772.   return (syscall_1(_fnum_systemInfo, uname));
  2773. }
  2774.  
  2775. _X_ static inline int encryptMD5(const char *in, char *out)
  2776. {
  2777.   // Proto: int kernelEncryptMD5(const char *, char *);
  2778.   // Desc : Given the input string 'in', return the encrypted numerical message digest in the buffer 'out'.
  2779.   return (syscall_2(_fnum_encryptMD5, (void *) in, out));
  2780. }
  2781.  
  2782. _X_ static inline int lockGet(lock *getLock)
  2783. {
  2784.   // Proto: int kernelLockGet(lock *);
  2785.   // Desc : Get an exclusive lock based on the lock structure 'getLock'.
  2786.   return (syscall_1(_fnum_lockGet, (void *) getLock));
  2787. }
  2788.  
  2789. _X_ static inline int lockRelease(lock *relLock)
  2790. {
  2791.   // Proto: int kernelLockRelease(lock *);
  2792.   // Desc : Release a lock on the lock structure 'lock' previously obtained with a call to the lockGet() function.
  2793.   return (syscall_1(_fnum_lockRelease, (void *) relLock));
  2794. }
  2795.  
  2796. _X_ static inline int lockVerify(lock *verLock)
  2797. {
  2798.   // Proto: int kernelLockVerify(lock *);
  2799.   // Desc : Verify that a lock on the lock structure 'verLock' is still valid.  This can be useful for retrying a lock attempt if a previous one failed; if the process that was previously holding the lock has failed, this will release the lock.
  2800.   return (syscall_1(_fnum_lockVerify, (void *) verLock));
  2801. }
  2802.  
  2803. _X_ static inline int variableListCreate(variableList *list)
  2804. {
  2805.   // Proto: int kernelVariableListCreate(variableList *);
  2806.   // Desc : Set up a new variable list structure.
  2807.   return (syscall_1(_fnum_variableListCreate, list));
  2808. }
  2809.   
  2810. _X_ static inline int variableListDestroy(variableList *list)
  2811. {
  2812.   // Proto: int kernelVariableListDestroy(variableList *);
  2813.   // Desc : Deallocate a variable list structure previously allocated by a call to variableListCreate() or configurationReader()
  2814.   return (syscall_1(_fnum_variableListDestroy, list));
  2815. }
  2816.  
  2817. _X_ static inline int variableListGet(variableList *list, const char *var, char *buffer, unsigned buffSize)
  2818. {
  2819.   // Proto: int kernelVariableListGet(variableList *, const char *, char *, unsigned);
  2820.   // Desc : Get the value of the variable 'var' from the variable list 'list' in the buffer 'buffer', up to 'buffSize' bytes.
  2821.   return (syscall_4(_fnum_variableListGet, list, (void *) var, buffer,
  2822.             (void *) buffSize));
  2823. }
  2824.  
  2825. _X_ static inline int variableListSet(variableList *list, const char *var, const char *value)
  2826. {
  2827.   // Proto: int kernelVariableListSet(variableList *, const char *, const char *);
  2828.   // Desc : Set the value of the variable 'var' to the value 'value'.
  2829.   return (syscall_3(_fnum_variableListSet, list, (void *) var,
  2830.             (void *) value));
  2831. }
  2832.  
  2833. _X_ static inline int variableListUnset(variableList *list, const char *var)
  2834. {
  2835.   // Proto: int kernelVariableListUnset(variableList *, const char *);
  2836.   // Desc : Remove the variable 'var' from the variable list 'list'.
  2837.   return (syscall_2(_fnum_variableListUnset, list, (void *) var));
  2838. }
  2839.  
  2840. _X_ static inline int configurationReader(const char *fileName, variableList *list)
  2841. {
  2842.   // Proto: int kernelConfigurationReader(const char *, variableList *);
  2843.   // Desc : Read the contents of the configuration file 'fileName', and return the data in the variable list structure 'list'.  Configuration files are simple properties files, consisting of lines of the format "variable=value"
  2844.   return (syscall_2(_fnum_configurationReader, (void *) fileName, list));
  2845. }
  2846.  
  2847. _X_ static inline int configurationWriter(const char *fileName, variableList *list)
  2848. {
  2849.   // Proto: int kernelConfigurationWriter(const char *, variableList *);
  2850.   // Desc : Write the contents of the variable list 'list' to the configuration file 'fileName'.  Configuration files are simple properties files, consisting of lines of the format "variable=value".  If the configuration file already exists, the configuration writer will attempt to preserve comment lines (beginning with '#') and formatting whitespace.
  2851.   return (syscall_2(_fnum_configurationWriter, (void *) fileName, list));
  2852. }
  2853.  
  2854. _X_ static inline int keyboardGetMaps(char *buffer, unsigned size)
  2855. {
  2856.   // Proto: int kernelKeyboardGetMaps(char *, unsigned);
  2857.   // Desc : Get a listing of the names of all available keyboard mappings.  The buffer is filled up to 'size' bytes with descriptive names, such as "English (UK)".  Each string is NULL-terminated, and the return value of the call is the number of strings copied.  The first string returned is the current map.
  2858.   return (syscall_2(_fnum_keyboardGetMaps, buffer, (void *) size));
  2859. }
  2860.  
  2861. _X_ static inline int keyboardSetMap(const char *name)
  2862. {
  2863.   // Proto: int kernelKeyboardSetMap(const char *);
  2864.   // Desc : Set the keyboard mapping to the supplied 'name'.  The normal procedure would be to first call the keyboardGetMaps() function, get the list of supported mappings, and then call this function with one of those names.  Only a name returned by the keyboardGetMaps function is valid in this scenario.
  2865.   return (syscall_1(_fnum_keyboardSetMap, (void *) name));
  2866. }
  2867.  
  2868. _X_ static inline int deviceTreeGetCount(void)
  2869. {
  2870.   // Proto: int kernelDeviceTreeGetCount(void);
  2871.   // Desc : Returns the number of devices in the kernel's device tree.
  2872.   return (syscall_0(_fnum_deviceTreeGetCount));
  2873. }
  2874.  
  2875. _X_ static inline int deviceTreeGetRoot(device *rootDev)
  2876. {
  2877.   // Proto: int kernelDeviceTreeGetRoot(device *);
  2878.   // Desc : Returns the user-space portion of the device tree root device in the structure 'rootDev'.
  2879.   return (syscall_1(_fnum_deviceTreeGetRoot, rootDev));
  2880. }
  2881.  
  2882. _X_ static inline int deviceTreeGetChild(device *parentDev, device *childDev)
  2883. {
  2884.   // Proto: int kernelDeviceTreeGetChild(device *, device *);
  2885.   // Desc : Returns the user-space portion of the first child device of 'parentDev' in the structure 'childDev'.
  2886.   return (syscall_2(_fnum_deviceTreeGetChild, parentDev, childDev));
  2887. }
  2888.  
  2889. _X_ static inline int deviceTreeGetNext(device *siblingDev)
  2890. {
  2891.   // Proto: int kernelDeviceTreeGetNext(device *);
  2892.   // Desc : Returns the user-space portion of the next sibling device of the supplied device 'siblingDev' in the same data structure.
  2893.   return (syscall_1(_fnum_deviceTreeGetNext, siblingDev));
  2894. }
  2895.  
  2896. _X_ static inline int mouseLoadPointer(const char *pointerName, const char *fileName)
  2897. {
  2898.   // Proto: int kernelMouseLoadPointer(const char *, const char *)
  2899.   // Desc : Tells the mouse driver code to load the mouse pointer 'pointerName' from the file 'fileName'.
  2900.   return (syscall_2(_fnum_mouseLoadPointer, (char *) pointerName,
  2901.             (char *) fileName));
  2902. }
  2903.  
  2904. #define _API_H
  2905. #endif
  2906.