1hook_config_section(3)          Allegro manual          hook_config_section(3)
2
3
4

NAME

6       hook_config_section  -  Hooks  a configuration file section with custom
7       handlers. Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       void hook_config_section(const char  *section,  int  (*intgetter)(const
14       char  *name,  int  def),  const char *(*stringgetter)(const char *name,
15       const char *def), void (*stringsetter)(const  char  *name,  const  char
16       *value));
17

DESCRIPTION

19       Takes  control  of the specified config file section, so that your hook
20       functions will be used to manipulate it instead of the normal disk file
21       access.  If  both the getter and setter functions are NULL, a currently
22       present hook will be unhooked. Hooked functions have the highest prior‐
23       ity. If a section is hooked, the hook will always be called, so you can
24       also hook a '#' section: even override_config_file() cannot override  a
25       hooked section. Example:
26
27          int decode_encrypted_int(const char *name, int def)
28          {
29             ...
30          }
31
32          const char *decode_encrypted_string(const char *name, const char *def)
33          {
34             ...
35          }
36
37          void encode_plaintext_string(const char *name, const char *value)
38          {
39             ...
40          }
41
42          int main(int argc, char *argv[])
43          {
44             ...
45             /* Make it harder for users to tinker with the high scores. */
46             hook_config_section("high_scores", decode_encrypted_int,
47                decode_encrypted_string, encode_plaintext_string);
48             ...
49          } END_OF_MAIN()
50
51

SEE ALSO

53       config_is_hooked(3)
54
55
56
57Allegro                          version 4.2.3          hook_config_section(3)
Impressum