🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

623 lines
20 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_system.h
  20. *
  21. * Include file for platform specific SDL API functions
  22. */
  23. #ifndef SDL_system_h_
  24. #define SDL_system_h_
  25. #include "SDL_stdinc.h"
  26. #include "SDL_keyboard.h"
  27. #include "SDL_render.h"
  28. #include "SDL_video.h"
  29. #include "begin_code.h"
  30. /* Set up for C function definitions, even when using C++ */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Platform specific functions for Windows */
  35. #if defined(__WIN32__) || defined(__GDK__)
  36. typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
  37. /**
  38. * Set a callback for every Windows message, run before TranslateMessage().
  39. *
  40. * \param callback The SDL_WindowsMessageHook function to call.
  41. * \param userdata a pointer to pass to every iteration of `callback`
  42. *
  43. * \since This function is available since SDL 2.0.4.
  44. */
  45. extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
  46. #endif /* defined(__WIN32__) || defined(__GDK__) */
  47. #if defined(__WIN32__) || defined(__WINGDK__)
  48. /**
  49. * Get the D3D9 adapter index that matches the specified display index.
  50. *
  51. * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and
  52. * controls on which monitor a full screen application will appear.
  53. *
  54. * \param displayIndex the display index for which to get the D3D9 adapter
  55. * index
  56. * \returns the D3D9 adapter index on success or a negative error code on
  57. * failure; call SDL_GetError() for more information.
  58. *
  59. * \since This function is available since SDL 2.0.1.
  60. */
  61. extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
  62. typedef struct IDirect3DDevice9 IDirect3DDevice9;
  63. /**
  64. * Get the D3D9 device associated with a renderer.
  65. *
  66. * Once you are done using the device, you should release it to avoid a
  67. * resource leak.
  68. *
  69. * \param renderer the renderer from which to get the associated D3D device
  70. * \returns the D3D9 device associated with given renderer or NULL if it is
  71. * not a D3D9 renderer; call SDL_GetError() for more information.
  72. *
  73. * \since This function is available since SDL 2.0.1.
  74. */
  75. extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
  76. typedef struct ID3D11Device ID3D11Device;
  77. /**
  78. * Get the D3D11 device associated with a renderer.
  79. *
  80. * Once you are done using the device, you should release it to avoid a
  81. * resource leak.
  82. *
  83. * \param renderer the renderer from which to get the associated D3D11 device
  84. * \returns the D3D11 device associated with given renderer or NULL if it is
  85. * not a D3D11 renderer; call SDL_GetError() for more information.
  86. *
  87. * \since This function is available since SDL 2.0.16.
  88. */
  89. extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer);
  90. #endif /* defined(__WIN32__) || defined(__WINGDK__) */
  91. #if defined(__WIN32__) || defined(__GDK__)
  92. typedef struct ID3D12Device ID3D12Device;
  93. /**
  94. * Get the D3D12 device associated with a renderer.
  95. *
  96. * Once you are done using the device, you should release it to avoid a
  97. * resource leak.
  98. *
  99. * \param renderer the renderer from which to get the associated D3D12 device
  100. * \returns the D3D12 device associated with given renderer or NULL if it is
  101. * not a D3D12 renderer; call SDL_GetError() for more information.
  102. *
  103. * \since This function is available since SDL 2.24.0.
  104. */
  105. extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* renderer);
  106. #endif /* defined(__WIN32__) || defined(__GDK__) */
  107. #if defined(__WIN32__) || defined(__WINGDK__)
  108. /**
  109. * Get the DXGI Adapter and Output indices for the specified display index.
  110. *
  111. * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and
  112. * `EnumOutputs` respectively to get the objects required to create a DX10 or
  113. * DX11 device and swap chain.
  114. *
  115. * Before SDL 2.0.4 this function did not return a value. Since SDL 2.0.4 it
  116. * returns an SDL_bool.
  117. *
  118. * \param displayIndex the display index for which to get both indices
  119. * \param adapterIndex a pointer to be filled in with the adapter index
  120. * \param outputIndex a pointer to be filled in with the output index
  121. * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
  122. * for more information.
  123. *
  124. * \since This function is available since SDL 2.0.2.
  125. */
  126. extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
  127. #endif /* defined(__WIN32__) || defined(__WINGDK__) */
  128. /* Platform specific functions for Linux */
  129. #ifdef __LINUX__
  130. /**
  131. * Sets the UNIX nice value for a thread.
  132. *
  133. * This uses setpriority() if possible, and RealtimeKit if available.
  134. *
  135. * \param threadID the Unix thread ID to change priority of.
  136. * \param priority The new, Unix-specific, priority value.
  137. * \returns 0 on success, or -1 on error.
  138. *
  139. * \since This function is available since SDL 2.0.9.
  140. */
  141. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
  142. /**
  143. * Sets the priority (not nice level) and scheduling policy for a thread.
  144. *
  145. * This uses setpriority() if possible, and RealtimeKit if available.
  146. *
  147. * \param threadID The Unix thread ID to change priority of.
  148. * \param sdlPriority The new SDL_ThreadPriority value.
  149. * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR,
  150. * SCHED_OTHER, etc...)
  151. * \returns 0 on success, or -1 on error.
  152. *
  153. * \since This function is available since SDL 2.0.18.
  154. */
  155. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
  156. #endif /* __LINUX__ */
  157. /* Platform specific functions for iOS */
  158. #ifdef __IPHONEOS__
  159. #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
  160. /**
  161. * Use this function to set the animation callback on Apple iOS.
  162. *
  163. * The function prototype for `callback` is:
  164. *
  165. * ```c
  166. * void callback(void* callbackParam);
  167. * ```
  168. *
  169. * Where its parameter, `callbackParam`, is what was passed as `callbackParam`
  170. * to SDL_iPhoneSetAnimationCallback().
  171. *
  172. * This function is only available on Apple iOS.
  173. *
  174. * For more information see:
  175. * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md
  176. *
  177. * This functions is also accessible using the macro
  178. * SDL_iOSSetAnimationCallback() since SDL 2.0.4.
  179. *
  180. * \param window the window for which the animation callback should be set
  181. * \param interval the number of frames after which **callback** will be
  182. * called
  183. * \param callback the function to call for every frame.
  184. * \param callbackParam a pointer that is passed to `callback`.
  185. * \returns 0 on success or a negative error code on failure; call
  186. * SDL_GetError() for more information.
  187. *
  188. * \since This function is available since SDL 2.0.0.
  189. *
  190. * \sa SDL_iPhoneSetEventPump
  191. */
  192. extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
  193. #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
  194. /**
  195. * Use this function to enable or disable the SDL event pump on Apple iOS.
  196. *
  197. * This function is only available on Apple iOS.
  198. *
  199. * This functions is also accessible using the macro SDL_iOSSetEventPump()
  200. * since SDL 2.0.4.
  201. *
  202. * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it
  203. *
  204. * \since This function is available since SDL 2.0.0.
  205. *
  206. * \sa SDL_iPhoneSetAnimationCallback
  207. */
  208. extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
  209. #endif /* __IPHONEOS__ */
  210. /* Platform specific functions for Android */
  211. #ifdef __ANDROID__
  212. /**
  213. * Get the Android Java Native Interface Environment of the current thread.
  214. *
  215. * This is the JNIEnv one needs to access the Java virtual machine from native
  216. * code, and is needed for many Android APIs to be usable from C.
  217. *
  218. * The prototype of the function in SDL's code actually declare a void* return
  219. * type, even if the implementation returns a pointer to a JNIEnv. The
  220. * rationale being that the SDL headers can avoid including jni.h.
  221. *
  222. * \returns a pointer to Java native interface object (JNIEnv) to which the
  223. * current thread is attached, or 0 on error.
  224. *
  225. * \since This function is available since SDL 2.0.0.
  226. *
  227. * \sa SDL_AndroidGetActivity
  228. */
  229. extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
  230. /**
  231. * Retrieve the Java instance of the Android activity class.
  232. *
  233. * The prototype of the function in SDL's code actually declares a void*
  234. * return type, even if the implementation returns a jobject. The rationale
  235. * being that the SDL headers can avoid including jni.h.
  236. *
  237. * The jobject returned by the function is a local reference and must be
  238. * released by the caller. See the PushLocalFrame() and PopLocalFrame() or
  239. * DeleteLocalRef() functions of the Java native interface:
  240. *
  241. * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
  242. *
  243. * \returns the jobject representing the instance of the Activity class of the
  244. * Android application, or NULL on error.
  245. *
  246. * \since This function is available since SDL 2.0.0.
  247. *
  248. * \sa SDL_AndroidGetJNIEnv
  249. */
  250. extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
  251. /**
  252. * Query Android API level of the current device.
  253. *
  254. * - API level 31: Android 12
  255. * - API level 30: Android 11
  256. * - API level 29: Android 10
  257. * - API level 28: Android 9
  258. * - API level 27: Android 8.1
  259. * - API level 26: Android 8.0
  260. * - API level 25: Android 7.1
  261. * - API level 24: Android 7.0
  262. * - API level 23: Android 6.0
  263. * - API level 22: Android 5.1
  264. * - API level 21: Android 5.0
  265. * - API level 20: Android 4.4W
  266. * - API level 19: Android 4.4
  267. * - API level 18: Android 4.3
  268. * - API level 17: Android 4.2
  269. * - API level 16: Android 4.1
  270. * - API level 15: Android 4.0.3
  271. * - API level 14: Android 4.0
  272. * - API level 13: Android 3.2
  273. * - API level 12: Android 3.1
  274. * - API level 11: Android 3.0
  275. * - API level 10: Android 2.3.3
  276. *
  277. * \returns the Android API level.
  278. *
  279. * \since This function is available since SDL 2.0.12.
  280. */
  281. extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
  282. /**
  283. * Query if the application is running on Android TV.
  284. *
  285. * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise.
  286. *
  287. * \since This function is available since SDL 2.0.8.
  288. */
  289. extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
  290. /**
  291. * Query if the application is running on a Chromebook.
  292. *
  293. * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise.
  294. *
  295. * \since This function is available since SDL 2.0.9.
  296. */
  297. extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
  298. /**
  299. * Query if the application is running on a Samsung DeX docking station.
  300. *
  301. * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise.
  302. *
  303. * \since This function is available since SDL 2.0.9.
  304. */
  305. extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
  306. /**
  307. * Trigger the Android system back button behavior.
  308. *
  309. * \since This function is available since SDL 2.0.9.
  310. */
  311. extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
  312. /**
  313. See the official Android developer guide for more information:
  314. http://developer.android.com/guide/topics/data/data-storage.html
  315. */
  316. #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
  317. #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
  318. /**
  319. * Get the path used for internal storage for this application.
  320. *
  321. * This path is unique to your application and cannot be written to by other
  322. * applications.
  323. *
  324. * Your internal storage path is typically:
  325. * `/data/data/your.app.package/files`.
  326. *
  327. * \returns the path used for internal storage or NULL on failure; call
  328. * SDL_GetError() for more information.
  329. *
  330. * \since This function is available since SDL 2.0.0.
  331. *
  332. * \sa SDL_AndroidGetExternalStorageState
  333. */
  334. extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
  335. /**
  336. * Get the current state of external storage.
  337. *
  338. * The current state of external storage, a bitmask of these values:
  339. * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`.
  340. *
  341. * If external storage is currently unavailable, this will return 0.
  342. *
  343. * \returns the current state of external storage on success or 0 on failure;
  344. * call SDL_GetError() for more information.
  345. *
  346. * \since This function is available since SDL 2.0.0.
  347. *
  348. * \sa SDL_AndroidGetExternalStoragePath
  349. */
  350. extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void);
  351. /**
  352. * Get the path used for external storage for this application.
  353. *
  354. * This path is unique to your application, but is public and can be written
  355. * to by other applications.
  356. *
  357. * Your external storage path is typically:
  358. * `/storage/sdcard0/Android/data/your.app.package/files`.
  359. *
  360. * \returns the path used for external storage for this application on success
  361. * or NULL on failure; call SDL_GetError() for more information.
  362. *
  363. * \since This function is available since SDL 2.0.0.
  364. *
  365. * \sa SDL_AndroidGetExternalStorageState
  366. */
  367. extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
  368. /**
  369. * Request permissions at runtime.
  370. *
  371. * This blocks the calling thread until the permission is granted or denied.
  372. *
  373. * \param permission The permission to request.
  374. * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise.
  375. *
  376. * \since This function is available since SDL 2.0.14.
  377. */
  378. extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
  379. /**
  380. * Shows an Android toast notification.
  381. *
  382. * Toasts are a sort of lightweight notification that are unique to Android.
  383. *
  384. * https://developer.android.com/guide/topics/ui/notifiers/toasts
  385. *
  386. * Shows toast in UI thread.
  387. *
  388. * For the `gravity` parameter, choose a value from here, or -1 if you don't
  389. * have a preference:
  390. *
  391. * https://developer.android.com/reference/android/view/Gravity
  392. *
  393. * \param message text message to be shown
  394. * \param duration 0=short, 1=long
  395. * \param gravity where the notification should appear on the screen.
  396. * \param xoffset set this parameter only when gravity >=0
  397. * \param yoffset set this parameter only when gravity >=0
  398. * \returns 0 if success, -1 if any error occurs.
  399. *
  400. * \since This function is available since SDL 2.0.16.
  401. */
  402. extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
  403. /**
  404. * Send a user command to SDLActivity.
  405. *
  406. * Override "boolean onUnhandledMessage(Message msg)" to handle the message.
  407. *
  408. * \param command user command that must be greater or equal to 0x8000
  409. * \param param user parameter
  410. *
  411. * \since This function is available since SDL 2.0.22.
  412. */
  413. extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
  414. #endif /* __ANDROID__ */
  415. /* Platform specific functions for WinRT */
  416. #ifdef __WINRT__
  417. /**
  418. * \brief WinRT / Windows Phone path types
  419. */
  420. typedef enum
  421. {
  422. /** \brief The installed app's root directory.
  423. Files here are likely to be read-only. */
  424. SDL_WINRT_PATH_INSTALLED_LOCATION,
  425. /** \brief The app's local data store. Files may be written here */
  426. SDL_WINRT_PATH_LOCAL_FOLDER,
  427. /** \brief The app's roaming data store. Unsupported on Windows Phone.
  428. Files written here may be copied to other machines via a network
  429. connection.
  430. */
  431. SDL_WINRT_PATH_ROAMING_FOLDER,
  432. /** \brief The app's temporary data store. Unsupported on Windows Phone.
  433. Files written here may be deleted at any time. */
  434. SDL_WINRT_PATH_TEMP_FOLDER
  435. } SDL_WinRT_Path;
  436. /**
  437. * \brief WinRT Device Family
  438. */
  439. typedef enum
  440. {
  441. /** \brief Unknown family */
  442. SDL_WINRT_DEVICEFAMILY_UNKNOWN,
  443. /** \brief Desktop family*/
  444. SDL_WINRT_DEVICEFAMILY_DESKTOP,
  445. /** \brief Mobile family (for example smartphone) */
  446. SDL_WINRT_DEVICEFAMILY_MOBILE,
  447. /** \brief XBox family */
  448. SDL_WINRT_DEVICEFAMILY_XBOX,
  449. } SDL_WinRT_DeviceFamily;
  450. /**
  451. * Retrieve a WinRT defined path on the local file system.
  452. *
  453. * Not all paths are available on all versions of Windows. This is especially
  454. * true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
  455. * for more information on which path types are supported where.
  456. *
  457. * Documentation on most app-specific path types on WinRT can be found on
  458. * MSDN, at the URL:
  459. *
  460. * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  461. *
  462. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
  463. * \returns a UCS-2 string (16-bit, wide-char) containing the path, or NULL if
  464. * the path is not available for any reason; call SDL_GetError() for
  465. * more information.
  466. *
  467. * \since This function is available since SDL 2.0.3.
  468. *
  469. * \sa SDL_WinRTGetFSPathUTF8
  470. */
  471. extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
  472. /**
  473. * Retrieve a WinRT defined path on the local file system.
  474. *
  475. * Not all paths are available on all versions of Windows. This is especially
  476. * true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
  477. * for more information on which path types are supported where.
  478. *
  479. * Documentation on most app-specific path types on WinRT can be found on
  480. * MSDN, at the URL:
  481. *
  482. * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  483. *
  484. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
  485. * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if
  486. * the path is not available for any reason; call SDL_GetError() for
  487. * more information.
  488. *
  489. * \since This function is available since SDL 2.0.3.
  490. *
  491. * \sa SDL_WinRTGetFSPathUNICODE
  492. */
  493. extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
  494. /**
  495. * Detects the device family of WinRT platform at runtime.
  496. *
  497. * \returns a value from the SDL_WinRT_DeviceFamily enum.
  498. *
  499. * \since This function is available since SDL 2.0.8.
  500. */
  501. extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
  502. #endif /* __WINRT__ */
  503. /**
  504. * Query if the current device is a tablet.
  505. *
  506. * If SDL can't determine this, it will return SDL_FALSE.
  507. *
  508. * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise.
  509. *
  510. * \since This function is available since SDL 2.0.9.
  511. */
  512. extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
  513. /* Functions used by iOS application delegates to notify SDL about state changes */
  514. extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
  515. extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
  516. extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
  517. extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
  518. extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
  519. extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
  520. #ifdef __IPHONEOS__
  521. extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
  522. #endif
  523. /* Functions used only by GDK */
  524. #if defined(__GDK__)
  525. typedef struct XTaskQueueObject * XTaskQueueHandle;
  526. /**
  527. * Gets a reference to the global async task queue handle for GDK,
  528. * initializing if needed.
  529. *
  530. * Once you are done with the task queue, you should call
  531. * XTaskQueueCloseHandle to reduce the reference count to avoid a resource
  532. * leak.
  533. *
  534. * \param outTaskQueue a pointer to be filled in with task queue handle.
  535. * \returns 0 if success, -1 if any error occurs.
  536. *
  537. * \since This function is available since SDL 2.24.0.
  538. */
  539. extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue);
  540. #endif
  541. /* Ends C function definitions when using C++ */
  542. #ifdef __cplusplus
  543. }
  544. #endif
  545. #include "close_code.h"
  546. #endif /* SDL_system_h_ */
  547. /* vi: set ts=4 sw=4 expandtab: */