wiki_render.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _WIKI_RENDERED_H
  2. #define _WIKI_RENDERED_H
  3. #include <mysql/mysql.h>
  4. #define MAX_TITLE_LEN 512
  5. #define MAX_SQL_STR 2048
  6. #define MAX_TEXT_BUF 5*1024*1024
  7. #define MAX_RENDERED 10*1024*1024
  8. #define MAX_TITLE_SEARCH 64
  9. #define MAX_DAT_FILES 64
  10. #define MAX_ARTICLES_PER_DAT 250000
  11. #define RESULT_SET_LIMIT 200
  12. #define TABLE_CELL_WIDTH (LCD_BUF_WIDTH_PIXELS / 4)
  13. typedef struct _ARTICLE_PTR {
  14. long offset_dat; /* offset to pedia?.dat for the article content */
  15. long offset_fnd; /* offset to pedia.fnd for the title (for search) */
  16. long file_id_compressed_len; /* byte 0: bit0~1 - compress method (00 - lzo, 01 - bzlib, 10 - 7z), bit 2~7 pedia file id */
  17. /* byte 1~3: compressed article length */
  18. } ARTICLE_PTR;
  19. typedef struct _TITLE_SEARCH { /* used to mask the porinter to the remainder of the title for search */
  20. long idxArticle;
  21. char cZero; /* null character for backward search */
  22. char sTitleSearch[MAX_TITLE_SEARCH]; /* null terminated title for search */
  23. char sTitleActual[MAX_TITLE_SEARCH]; /* null terminated actual title. */
  24. /* in the fnd file, it will be concatnated immediately after the null terminator of sTitleSearch */
  25. } TITLE_SEARCH;
  26. void render_article_node(int idxNode);
  27. void process_pass_1(MYSQL *conn, char *sFileName, int msgLevel, long titlesToProcess,
  28. off64_t file_offset_for_pass_1, long max_article_idx);
  29. void process_pass_2(MYSQL *conn, MYSQL *conn2, char *sFileName, int msgLevel, long titlesToProcess, int batch,
  30. long idxStart, long idxEnd);
  31. void process_pass_3(MYSQL *conn, MYSQL *conn2, int bSplitted);
  32. void memrcpy(void *dest, void *src, int len); // memory copy starting from the last byte
  33. void replace_ampersand_char(char *);
  34. void pad_backslash(char *s, int size);
  35. void generate_pedia_hsh(void);
  36. void reorg_pedia(void);
  37. extern void showMsg(int currentLevel, char *format, ...);
  38. extern int msgLevel(void);
  39. #endif /* _WIKI_RENDERED_H */