wikilib.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef WIKILIB_H
  18. #define WIKILIB_H
  19. #ifndef __cplusplus
  20. // for size_t / ssize_t
  21. #include <stddef.h>
  22. #include <stdbool.h>
  23. #endif
  24. #ifndef NULL
  25. #define NULL 0
  26. #endif
  27. #ifndef MIN
  28. #define MIN(a,b) ((a) > (b) ? (b) : (a))
  29. #endif
  30. #ifndef MAX
  31. #define MAX(a,b) ((a) < (b) ? (b) : (a))
  32. #endif
  33. #ifndef ARRAY_SIZE
  34. #define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
  35. #endif
  36. #ifndef STATIC_ASSERT
  37. #define STATIC_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
  38. #endif
  39. #define ARTICLE_NEW 0
  40. #define ARTICLE_HISTORY 1
  41. #define ARTICLE_BROWSE 2
  42. enum display_mode_e {
  43. DISPLAY_MODE_INDEX,
  44. DISPLAY_MODE_ARTICLE,
  45. DISPLAY_MODE_HISTORY,
  46. DISPLAY_MODE_RESTRICTED,
  47. DISPLAY_MODE_WIKI_SELECTION,
  48. };
  49. typedef unsigned char u8;
  50. typedef unsigned short u16;
  51. typedef unsigned long u32;
  52. typedef signed char s8;
  53. typedef signed short s16;
  54. typedef signed int s32;
  55. #define ARTICLE_NEW 0
  56. #define ARTICLE_HISTORY 1
  57. /* function prototypes */
  58. int wikilib_init (void);
  59. int wikilib_run (void);
  60. void invert_selection(int old_pos, int new_pos, int start_pos, int height);
  61. unsigned long get_time_ticks(void);
  62. unsigned long time_diff(unsigned long t2, unsigned long t1);
  63. unsigned long seconds_to_ticks(float sec);
  64. void repaint_search(void);
  65. void fatal_error(char*);
  66. #endif /* WIKILIB_H */