Mercurial > mplayer.hg
annotate m_struct.h @ 17111:1bfbe748d908
100l, codec-cfg needs fixing after -msgl patch
author | ods15 |
---|---|
date | Tue, 06 Dec 2005 11:59:14 +0000 |
parents | 57bdcdb061d7 |
children | 96568be4bfdc |
rev | line source |
---|---|
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
9586
diff
changeset
|
1 #ifndef _M_STRUCT_H |
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
9586
diff
changeset
|
2 #define _M_STRUCT_H |
8169
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
3 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
4 ///////////////////// A struct setter //////////////////////// |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
5 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
6 struct m_option; |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
7 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
8 /// Struct definition |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
9 typedef struct m_struct_st { |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
10 char* name; // For error msg and debuging |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
11 unsigned int size; // size of the whole struct |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
12 void* defaults; // Pointer to a struct filled with the default settings |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
13 struct m_option* fields; // settable fields |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
14 } m_struct_t; |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
15 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
16 // Note : the p field of the m_option_t struct must contain the offset |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
17 // of the member in the struct (use M_ST_OFF macro for this). |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
18 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
19 // From glib.h (modified ;-) |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
20 #define M_ST_OFF(struct_type, member) \ |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
21 ((void*) &((struct_type*) 0)->member) |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
22 #define M_ST_MB_P(struct_p, struct_offset) \ |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
23 ((void*) (struct_p) + (unsigned long) (struct_offset)) |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
24 #define M_ST_MB(member_type, struct_p, struct_offset) \ |
9586 | 25 (*(member_type*) M_ST_MB_P ((struct_p), (struct_offset))) |
8169
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
26 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
27 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
28 |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
29 /// Allocate the struct and set it to the defaults |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
30 void* |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
31 m_struct_alloc(m_struct_t* st); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
32 /// Set a field of the struct |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
33 int |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
34 m_struct_set(m_struct_t* st, void* obj, char* field, char* param); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
35 /// Reset a field (or all if field == NULL) to defaults |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
36 void |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
37 m_struct_reset(m_struct_t* st, void* obj, char* field); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
38 /// Create a copy of an existing struct |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
39 void* |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
40 m_struct_copy(m_struct_t* st, void* obj); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
41 /// Free an allocated struct |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
42 void |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
43 m_struct_free(m_struct_t* st, void* obj); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
44 /// Get a field description |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
45 struct m_option* |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
46 m_struct_get_field(m_struct_t* st,char* f); |
7c9253521f9c
A struct setter. It allow you to setup struct from some user
albeu
parents:
diff
changeset
|
47 |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
9586
diff
changeset
|
48 #endif /* _M_STRUCT_H */ |