File: template_structs.h

package info (click to toggle)
prayer 1.3.5-dfsg1-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,596 kB
  • sloc: ansic: 43,163; makefile: 817; sh: 445; perl: 166
file content (108 lines) | stat: -rw-r--r-- 2,534 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* $Cambridge: hermes/src/prayer/lib/template_structs.h,v 1.1 2010/07/07 08:52:14 dpc22 Exp $ */

/************************************************
 *    Prayer - a Webmail Interface              *
 ************************************************/

/* Copyright (c) University of Cambridge 2000 - 2008 */
/* See the file NOTICE for conditions of use and distribution. */

typedef enum {
    TEMPLATE_ITEM_LINES,
    TEMPLATE_ITEM_IFDEF,
    TEMPLATE_ITEM_IFEQ,
    TEMPLATE_ITEM_FOREACH,
    TEMPLATE_ITEM_LOOP,
    TEMPLATE_ITEM_CALL,
} TEMPLATE_ITEM_TYPE;

/* Any changes to the following must be mirrored in template_compile */

struct template_map_index {
    char *name;
    struct template_map *template_map;
    unsigned long *count;
};

struct template_map {
    char *name;
    struct template *template;
};

struct template {
    char *name;
    struct template_item *head;
    struct template_item *tail;
    unsigned long count;
    struct template_item *tree;
    struct str *error;
};

struct template_item {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    /* ... */
};

struct template_lines {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    char **first;
    int count;
};

struct template_ifdef {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    BOOL positive;
    char *expr;
    struct template_item *true_block;
    struct template_item *false_block;
};

struct template_ifeq {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    BOOL positive;
    char *name;
    char *value;
    struct template_item *true_block;
    struct template_item *false_block;
};

struct template_foreach {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    char *name;
    char *array;
    struct template_item *block;
};

struct template_loop {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    char *var;
    struct template_item *block;
};

struct template_call {
    unsigned long number;
    struct template_item *list_next;
    struct template_item *tree_next;
    TEMPLATE_ITEM_TYPE type;
    char *name;
    char *params;
};