🛠️🐜 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.

619 lines
21 KiB

  1. /*
  2. Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely.
  9. */
  10. /* Simple program: Move N sprites around on the screen as fast as possible */
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <time.h>
  14. #ifdef __EMSCRIPTEN__
  15. #include <emscripten/emscripten.h>
  16. #endif
  17. #include "SDL_test.h"
  18. #include "SDL_test_common.h"
  19. #define NUM_SPRITES 100
  20. #define MAX_SPEED 1
  21. static SDLTest_CommonState *state;
  22. static int num_sprites;
  23. static SDL_Texture **sprites;
  24. static SDL_bool cycle_color;
  25. static SDL_bool cycle_alpha;
  26. static int cycle_direction = 1;
  27. static int current_alpha = 0;
  28. static int current_color = 0;
  29. static SDL_Rect *positions;
  30. static SDL_Rect *velocities;
  31. static int sprite_w, sprite_h;
  32. static SDL_BlendMode blendMode = SDL_BLENDMODE_BLEND;
  33. static Uint32 next_fps_check, frames;
  34. static const Uint32 fps_check_delay = 5000;
  35. static int use_rendergeometry = 0;
  36. /* Number of iterations to move sprites - used for visual tests. */
  37. /* -1: infinite random moves (default); >=0: enables N deterministic moves */
  38. static int iterations = -1;
  39. int done;
  40. /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
  41. static void
  42. quit(int rc)
  43. {
  44. SDL_free(sprites);
  45. SDL_free(positions);
  46. SDL_free(velocities);
  47. SDLTest_CommonQuit(state);
  48. exit(rc);
  49. }
  50. int
  51. LoadSprite(const char *file)
  52. {
  53. int i;
  54. SDL_Surface *temp;
  55. /* Load the sprite image */
  56. temp = SDL_LoadBMP(file);
  57. if (temp == NULL) {
  58. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
  59. return (-1);
  60. }
  61. sprite_w = temp->w;
  62. sprite_h = temp->h;
  63. /* Set transparent pixel as the pixel at (0,0) */
  64. if (temp->format->palette) {
  65. SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels);
  66. } else {
  67. switch (temp->format->BitsPerPixel) {
  68. case 15:
  69. SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF);
  70. break;
  71. case 16:
  72. SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels);
  73. break;
  74. case 24:
  75. SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF);
  76. break;
  77. case 32:
  78. SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels);
  79. break;
  80. }
  81. }
  82. /* Create textures from the image */
  83. for (i = 0; i < state->num_windows; ++i) {
  84. SDL_Renderer *renderer = state->renderers[i];
  85. sprites[i] = SDL_CreateTextureFromSurface(renderer, temp);
  86. if (!sprites[i]) {
  87. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
  88. SDL_FreeSurface(temp);
  89. return (-1);
  90. }
  91. if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
  92. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
  93. SDL_FreeSurface(temp);
  94. SDL_DestroyTexture(sprites[i]);
  95. return (-1);
  96. }
  97. }
  98. SDL_FreeSurface(temp);
  99. /* We're ready to roll. :) */
  100. return (0);
  101. }
  102. void
  103. MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
  104. {
  105. int i;
  106. SDL_Rect viewport, temp;
  107. SDL_Rect *position, *velocity;
  108. /* Query the sizes */
  109. SDL_RenderGetViewport(renderer, &viewport);
  110. /* Cycle the color and alpha, if desired */
  111. if (cycle_color) {
  112. current_color += cycle_direction;
  113. if (current_color < 0) {
  114. current_color = 0;
  115. cycle_direction = -cycle_direction;
  116. }
  117. if (current_color > 255) {
  118. current_color = 255;
  119. cycle_direction = -cycle_direction;
  120. }
  121. SDL_SetTextureColorMod(sprite, 255, (Uint8) current_color,
  122. (Uint8) current_color);
  123. }
  124. if (cycle_alpha) {
  125. current_alpha += cycle_direction;
  126. if (current_alpha < 0) {
  127. current_alpha = 0;
  128. cycle_direction = -cycle_direction;
  129. }
  130. if (current_alpha > 255) {
  131. current_alpha = 255;
  132. cycle_direction = -cycle_direction;
  133. }
  134. SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha);
  135. }
  136. /* Draw a gray background */
  137. SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
  138. SDL_RenderClear(renderer);
  139. /* Test points */
  140. SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF);
  141. SDL_RenderDrawPoint(renderer, 0, 0);
  142. SDL_RenderDrawPoint(renderer, viewport.w-1, 0);
  143. SDL_RenderDrawPoint(renderer, 0, viewport.h-1);
  144. SDL_RenderDrawPoint(renderer, viewport.w-1, viewport.h-1);
  145. /* Test horizontal and vertical lines */
  146. SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
  147. SDL_RenderDrawLine(renderer, 1, 0, viewport.w-2, 0);
  148. SDL_RenderDrawLine(renderer, 1, viewport.h-1, viewport.w-2, viewport.h-1);
  149. SDL_RenderDrawLine(renderer, 0, 1, 0, viewport.h-2);
  150. SDL_RenderDrawLine(renderer, viewport.w-1, 1, viewport.w-1, viewport.h-2);
  151. /* Test fill and copy */
  152. SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
  153. temp.x = 1;
  154. temp.y = 1;
  155. temp.w = sprite_w;
  156. temp.h = sprite_h;
  157. if (use_rendergeometry == 0) {
  158. SDL_RenderFillRect(renderer, &temp);
  159. } else {
  160. /* Draw two triangles, filled, uniform */
  161. SDL_Color color;
  162. SDL_Vertex verts[3];
  163. SDL_zeroa(verts);
  164. color.r = 0xFF;
  165. color.g = 0xFF;
  166. color.b = 0xFF;
  167. color.a = 0xFF;
  168. verts[0].position.x = (float)temp.x;
  169. verts[0].position.y = (float)temp.y;
  170. verts[0].color = color;
  171. verts[1].position.x = (float)temp.x + temp.w;
  172. verts[1].position.y = (float)temp.y;
  173. verts[1].color = color;
  174. verts[2].position.x = (float)temp.x + temp.w;
  175. verts[2].position.y = (float)temp.y + temp.h;
  176. verts[2].color = color;
  177. SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0);
  178. verts[1].position.x = (float)temp.x;
  179. verts[1].position.y = (float)temp.y + temp.h;
  180. verts[1].color = color;
  181. SDL_RenderGeometry(renderer, NULL, verts, 3, NULL, 0);
  182. }
  183. SDL_RenderCopy(renderer, sprite, NULL, &temp);
  184. temp.x = viewport.w-sprite_w-1;
  185. temp.y = 1;
  186. temp.w = sprite_w;
  187. temp.h = sprite_h;
  188. SDL_RenderFillRect(renderer, &temp);
  189. SDL_RenderCopy(renderer, sprite, NULL, &temp);
  190. temp.x = 1;
  191. temp.y = viewport.h-sprite_h-1;
  192. temp.w = sprite_w;
  193. temp.h = sprite_h;
  194. SDL_RenderFillRect(renderer, &temp);
  195. SDL_RenderCopy(renderer, sprite, NULL, &temp);
  196. temp.x = viewport.w-sprite_w-1;
  197. temp.y = viewport.h-sprite_h-1;
  198. temp.w = sprite_w;
  199. temp.h = sprite_h;
  200. SDL_RenderFillRect(renderer, &temp);
  201. SDL_RenderCopy(renderer, sprite, NULL, &temp);
  202. /* Test diagonal lines */
  203. SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
  204. SDL_RenderDrawLine(renderer, sprite_w, sprite_h,
  205. viewport.w-sprite_w-2, viewport.h-sprite_h-2);
  206. SDL_RenderDrawLine(renderer, viewport.w-sprite_w-2, sprite_h,
  207. sprite_w, viewport.h-sprite_h-2);
  208. /* Conditionally move the sprites, bounce at the wall */
  209. if (iterations == -1 || iterations > 0) {
  210. for (i = 0; i < num_sprites; ++i) {
  211. position = &positions[i];
  212. velocity = &velocities[i];
  213. position->x += velocity->x;
  214. if ((position->x < 0) || (position->x >= (viewport.w - sprite_w))) {
  215. velocity->x = -velocity->x;
  216. position->x += velocity->x;
  217. }
  218. position->y += velocity->y;
  219. if ((position->y < 0) || (position->y >= (viewport.h - sprite_h))) {
  220. velocity->y = -velocity->y;
  221. position->y += velocity->y;
  222. }
  223. }
  224. /* Countdown sprite-move iterations and disable color changes at iteration end - used for visual tests. */
  225. if (iterations > 0) {
  226. iterations--;
  227. if (iterations == 0) {
  228. cycle_alpha = SDL_FALSE;
  229. cycle_color = SDL_FALSE;
  230. }
  231. }
  232. }
  233. /* Draw sprites */
  234. if (use_rendergeometry == 0) {
  235. for (i = 0; i < num_sprites; ++i) {
  236. position = &positions[i];
  237. /* Blit the sprite onto the screen */
  238. SDL_RenderCopy(renderer, sprite, NULL, position);
  239. }
  240. } else if (use_rendergeometry == 1) {
  241. /*
  242. * 0--1
  243. * | /|
  244. * |/ |
  245. * 3--2
  246. *
  247. * Draw sprite2 as triangles that can be recombined as rect by software renderer
  248. */
  249. SDL_Vertex *verts = (SDL_Vertex *) SDL_malloc(num_sprites * sizeof (SDL_Vertex) * 6);
  250. SDL_Vertex *verts2 = verts;
  251. if (verts) {
  252. SDL_Color color;
  253. SDL_GetTextureColorMod(sprite, &color.r, &color.g, &color.b);
  254. SDL_GetTextureAlphaMod(sprite, &color.a);
  255. for (i = 0; i < num_sprites; ++i) {
  256. position = &positions[i];
  257. /* 0 */
  258. verts->position.x = (float)position->x;
  259. verts->position.y = (float)position->y;
  260. verts->color = color;
  261. verts->tex_coord.x = 0.0f;
  262. verts->tex_coord.y = 0.0f;
  263. verts++;
  264. /* 1 */
  265. verts->position.x = (float)position->x + position->w;
  266. verts->position.y = (float)position->y;
  267. verts->color = color;
  268. verts->tex_coord.x = 1.0f;
  269. verts->tex_coord.y = 0.0f;
  270. verts++;
  271. /* 2 */
  272. verts->position.x = (float)position->x + position->w;
  273. verts->position.y = (float)position->y + position->h;
  274. verts->color = color;
  275. verts->tex_coord.x = 1.0f;
  276. verts->tex_coord.y = 1.0f;
  277. verts++;
  278. /* 0 */
  279. verts->position.x = (float)position->x;
  280. verts->position.y = (float)position->y;
  281. verts->color = color;
  282. verts->tex_coord.x = 0.0f;
  283. verts->tex_coord.y = 0.0f;
  284. verts++;
  285. /* 2 */
  286. verts->position.x = (float)position->x + position->w;
  287. verts->position.y = (float)position->y + position->h;
  288. verts->color = color;
  289. verts->tex_coord.x = 1.0f;
  290. verts->tex_coord.y = 1.0f;
  291. verts++;
  292. /* 3 */
  293. verts->position.x = (float)position->x;
  294. verts->position.y = (float)position->y + position->h;
  295. verts->color = color;
  296. verts->tex_coord.x = 0.0f;
  297. verts->tex_coord.y = 1.0f;
  298. verts++;
  299. }
  300. /* Blit sprites as triangles onto the screen */
  301. SDL_RenderGeometry(renderer, sprite, verts2, num_sprites * 6, NULL, 0);
  302. SDL_free(verts2);
  303. }
  304. } else if (use_rendergeometry == 2) {
  305. /* 0-----1
  306. * |\ A /|
  307. * | \ / |
  308. * |D 2 B|
  309. * | / \ |
  310. * |/ C \|
  311. * 3-----4
  312. *
  313. * Draw sprite2 as triangles that can *not* be recombined as rect by software renderer
  314. * Use an 'indices' array
  315. */
  316. SDL_Vertex *verts = (SDL_Vertex *) SDL_malloc(num_sprites * sizeof (SDL_Vertex) * 5);
  317. SDL_Vertex *verts2 = verts;
  318. int *indices = (int *) SDL_malloc(num_sprites * sizeof (int) * 4 * 3);
  319. int *indices2 = indices;
  320. if (verts && indices) {
  321. int pos = 0;
  322. SDL_Color color;
  323. SDL_GetTextureColorMod(sprite, &color.r, &color.g, &color.b);
  324. SDL_GetTextureAlphaMod(sprite, &color.a);
  325. for (i = 0; i < num_sprites; ++i) {
  326. position = &positions[i];
  327. /* 0 */
  328. verts->position.x = (float)position->x;
  329. verts->position.y = (float)position->y;
  330. verts->color = color;
  331. verts->tex_coord.x = 0.0f;
  332. verts->tex_coord.y = 0.0f;
  333. verts++;
  334. /* 1 */
  335. verts->position.x = (float)position->x + position->w;
  336. verts->position.y = (float)position->y;
  337. verts->color = color;
  338. verts->tex_coord.x = 1.0f;
  339. verts->tex_coord.y = 0.0f;
  340. verts++;
  341. /* 2 */
  342. verts->position.x = (float)position->x + position->w / 2.0f;
  343. verts->position.y = (float)position->y + position->h / 2.0f;
  344. verts->color = color;
  345. verts->tex_coord.x = 0.5f;
  346. verts->tex_coord.y = 0.5f;
  347. verts++;
  348. /* 3 */
  349. verts->position.x = (float)position->x;
  350. verts->position.y = (float)position->y + position->h;
  351. verts->color = color;
  352. verts->tex_coord.x = 0.0f;
  353. verts->tex_coord.y = 1.0f;
  354. verts++;
  355. /* 4 */
  356. verts->position.x = (float)position->x + position->w;
  357. verts->position.y = (float)position->y + position->h;
  358. verts->color = color;
  359. verts->tex_coord.x = 1.0f;
  360. verts->tex_coord.y = 1.0f;
  361. verts++;
  362. /* A */
  363. *indices++ = pos + 0;
  364. *indices++ = pos + 1;
  365. *indices++ = pos + 2;
  366. /* B */
  367. *indices++ = pos + 1;
  368. *indices++ = pos + 2;
  369. *indices++ = pos + 4;
  370. /* C */
  371. *indices++ = pos + 3;
  372. *indices++ = pos + 2;
  373. *indices++ = pos + 4;
  374. /* D */
  375. *indices++ = pos + 3;
  376. *indices++ = pos + 2;
  377. *indices++ = pos + 0;
  378. pos += 5;
  379. }
  380. }
  381. /* Blit sprites as triangles onto the screen */
  382. SDL_RenderGeometry(renderer, sprite, verts2, num_sprites * 5, indices2, num_sprites * 4 * 3);
  383. SDL_free(verts2);
  384. SDL_free(indices2);
  385. }
  386. /* Update the screen! */
  387. SDL_RenderPresent(renderer);
  388. }
  389. void
  390. loop()
  391. {
  392. Uint32 now;
  393. int i;
  394. SDL_Event event;
  395. /* Check for events */
  396. while (SDL_PollEvent(&event)) {
  397. SDLTest_CommonEvent(state, &event, &done);
  398. }
  399. for (i = 0; i < state->num_windows; ++i) {
  400. if (state->windows[i] == NULL)
  401. continue;
  402. MoveSprites(state->renderers[i], sprites[i]);
  403. }
  404. #ifdef __EMSCRIPTEN__
  405. if (done) {
  406. emscripten_cancel_main_loop();
  407. }
  408. #endif
  409. frames++;
  410. now = SDL_GetTicks();
  411. if (SDL_TICKS_PASSED(now, next_fps_check)) {
  412. /* Print out some timing information */
  413. const Uint32 then = next_fps_check - fps_check_delay;
  414. const double fps = ((double) frames * 1000) / (now - then);
  415. SDL_Log("%2.2f frames per second\n", fps);
  416. next_fps_check = now + fps_check_delay;
  417. frames = 0;
  418. }
  419. }
  420. int
  421. main(int argc, char *argv[])
  422. {
  423. int i;
  424. Uint64 seed;
  425. const char *icon = "icon.bmp";
  426. /* Initialize parameters */
  427. num_sprites = NUM_SPRITES;
  428. /* Initialize test framework */
  429. state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
  430. if (!state) {
  431. return 1;
  432. }
  433. for (i = 1; i < argc;) {
  434. int consumed;
  435. consumed = SDLTest_CommonArg(state, i);
  436. if (consumed == 0) {
  437. consumed = -1;
  438. if (SDL_strcasecmp(argv[i], "--blend") == 0) {
  439. if (argv[i + 1]) {
  440. if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
  441. blendMode = SDL_BLENDMODE_NONE;
  442. consumed = 2;
  443. } else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
  444. blendMode = SDL_BLENDMODE_BLEND;
  445. consumed = 2;
  446. } else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
  447. blendMode = SDL_BLENDMODE_ADD;
  448. consumed = 2;
  449. } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
  450. blendMode = SDL_BLENDMODE_MOD;
  451. consumed = 2;
  452. } else if (SDL_strcasecmp(argv[i + 1], "sub") == 0) {
  453. blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT);
  454. consumed = 2;
  455. }
  456. }
  457. } else if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
  458. if (argv[i + 1]) {
  459. iterations = SDL_atoi(argv[i + 1]);
  460. if (iterations < -1) iterations = -1;
  461. consumed = 2;
  462. }
  463. } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
  464. cycle_color = SDL_TRUE;
  465. consumed = 1;
  466. } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) {
  467. cycle_alpha = SDL_TRUE;
  468. consumed = 1;
  469. } else if (SDL_strcasecmp(argv[i], "--use-rendergeometry") == 0) {
  470. if (argv[i + 1]) {
  471. if (SDL_strcasecmp(argv[i + 1], "mode1") == 0) {
  472. /* Draw sprite2 as triangles that can be recombined as rect by software renderer */
  473. use_rendergeometry = 1;
  474. } else if (SDL_strcasecmp(argv[i + 1], "mode2") == 0) {
  475. /* Draw sprite2 as triangles that can *not* be recombined as rect by software renderer
  476. * Use an 'indices' array */
  477. use_rendergeometry = 2;
  478. } else {
  479. return -1;
  480. }
  481. }
  482. consumed = 2;
  483. } else if (SDL_isdigit(*argv[i])) {
  484. num_sprites = SDL_atoi(argv[i]);
  485. consumed = 1;
  486. } else if (argv[i][0] != '-') {
  487. icon = argv[i];
  488. consumed = 1;
  489. }
  490. }
  491. if (consumed < 0) {
  492. static const char *options[] = {
  493. "[--blend none|blend|add|mod]",
  494. "[--cyclecolor]",
  495. "[--cyclealpha]",
  496. "[--iterations N]",
  497. "[--use-rendergeometry mode1|mode2]",
  498. "[num_sprites]",
  499. "[icon.bmp]",
  500. NULL };
  501. SDLTest_CommonLogUsage(state, argv[0], options);
  502. quit(1);
  503. }
  504. i += consumed;
  505. }
  506. if (!SDLTest_CommonInit(state)) {
  507. quit(2);
  508. }
  509. /* Create the windows, initialize the renderers, and load the textures */
  510. sprites =
  511. (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
  512. if (!sprites) {
  513. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
  514. quit(2);
  515. }
  516. for (i = 0; i < state->num_windows; ++i) {
  517. SDL_Renderer *renderer = state->renderers[i];
  518. SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
  519. SDL_RenderClear(renderer);
  520. }
  521. if (LoadSprite(icon) < 0) {
  522. quit(2);
  523. }
  524. /* Allocate memory for the sprite info */
  525. positions = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
  526. velocities = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
  527. if (!positions || !velocities) {
  528. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
  529. quit(2);
  530. }
  531. /* Position sprites and set their velocities using the fuzzer */
  532. if (iterations >= 0) {
  533. /* Deterministic seed - used for visual tests */
  534. seed = (Uint64)iterations;
  535. } else {
  536. /* Pseudo-random seed generated from the time */
  537. seed = (Uint64)time(NULL);
  538. }
  539. SDLTest_FuzzerInit(seed);
  540. for (i = 0; i < num_sprites; ++i) {
  541. positions[i].x = SDLTest_RandomIntegerInRange(0, state->window_w - sprite_w);
  542. positions[i].y = SDLTest_RandomIntegerInRange(0, state->window_h - sprite_h);
  543. positions[i].w = sprite_w;
  544. positions[i].h = sprite_h;
  545. velocities[i].x = 0;
  546. velocities[i].y = 0;
  547. while (!velocities[i].x && !velocities[i].y) {
  548. velocities[i].x = SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
  549. velocities[i].y = SDLTest_RandomIntegerInRange(-MAX_SPEED, MAX_SPEED);
  550. }
  551. }
  552. /* Main render loop */
  553. frames = 0;
  554. next_fps_check = SDL_GetTicks() + fps_check_delay;
  555. done = 0;
  556. #ifdef __EMSCRIPTEN__
  557. emscripten_set_main_loop(loop, 0, 1);
  558. #else
  559. while (!done) {
  560. loop();
  561. }
  562. #endif
  563. quit(0);
  564. return 0;
  565. }
  566. /* vi: set ts=4 sw=4 expandtab: */