/[LeafOK_CVS]/lbbs/include/section_list.h
ViewVC logotype

Annotation of /lbbs/include/section_list.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Wed May 21 12:43:04 2025 UTC (9 months, 3 weeks ago) by sysadm
Branch: MAIN
Changes since 1.3: +7 -3 lines
Content type: text/x-chdr
Add bi-directional list for section articles

1 sysadm 1.1 /***************************************************************************
2     section_list.h - description
3     -------------------
4     Copyright : (C) 2004-2025 by Leaflet
5     Email : leaflet@leafok.com
6     ***************************************************************************/
7    
8     /***************************************************************************
9     * *
10     * This program is free software; you can redistribute it and/or modify *
11     * it under the terms of the GNU General Public License as published by *
12     * the Free Software Foundation; either version 3 of the License, or *
13     * (at your option) any later version. *
14     * *
15     ***************************************************************************/
16    
17     #include "common.h"
18     #include "bbs.h"
19    
20     #define BBS_article_title_max_len 80
21    
22     // Limit of articles (including those marked as deleted) per section = BBS_article_limit_per_block * BBS_article_block_limit_per_section
23     #define BBS_article_limit_per_block 1000
24     #define BBS_article_block_limit_per_section 50
25    
26     struct article_t
27     {
28     int32_t aid;
29     int32_t tid;
30     int32_t cid;
31     int32_t uid;
32 sysadm 1.4 struct article_t *p_prior; // prior article
33     struct article_t *p_next; // next article
34     struct article_t * p_topic_prior; // same topic
35     struct article_t * p_topic_next; // same topic
36 sysadm 1.1 int8_t visible;
37     int8_t excerption;
38     int8_t ontop;
39     int8_t lock;
40     char username[BBS_username_max_len + 1];
41     char nickname[BBS_nickname_max_len + 1];
42     char title[BBS_article_title_max_len + 1];
43     };
44     typedef struct article_t ARTICLE;
45    
46     struct article_block_t
47     {
48     ARTICLE articles[BBS_article_limit_per_block];
49     int32_t article_count;
50     struct article_block_t *p_next_block;
51     };
52     typedef struct article_block_t ARTICLE_BLOCK;
53    
54     struct section_data_t
55     {
56     int32_t sid;
57     char sname[BBS_section_name_max_len + 1];
58     char stitle[BBS_section_title_max_len + 1];
59     char master_name[BBS_username_max_len + 1];
60     ARTICLE_BLOCK *p_head_block;
61     ARTICLE_BLOCK *p_tail_block;
62     ARTICLE_BLOCK *p_block[BBS_article_block_limit_per_section];
63     int32_t block_count;
64     int32_t block_head_aid[BBS_article_block_limit_per_section];
65     int32_t article_count;
66     int32_t delete_count;
67 sysadm 1.4 ARTICLE *p_article_head;
68     ARTICLE *p_article_tail;
69 sysadm 1.1 };
70     typedef struct section_data_t SECTION_DATA;
71    
72     extern int section_data_pool_init(const char *filename, int article_block_count);
73     extern void section_data_pool_cleanup(void);
74    
75     extern SECTION_DATA *section_data_create(const char *sname, const char *stitle, const char *master_name);
76     extern int section_data_free_block(SECTION_DATA *p_section);
77 sysadm 1.3 extern SECTION_DATA *section_data_find_section_by_name(const char *sname);
78 sysadm 1.1
79 sysadm 1.4 extern int section_data_append_article(SECTION_DATA *p_section, const ARTICLE *p_article_src);
80 sysadm 1.2 extern ARTICLE *section_data_find_article_by_aid(SECTION_DATA *p_section, int32_t aid);
81     extern ARTICLE *section_data_find_article_by_index(SECTION_DATA *p_section, int index);
82 sysadm 1.1 extern int section_data_mark_del_article(SECTION_DATA *p_section, int32_t aid);

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1