Mercurial > MadButterfly
annotate src/img_ldr_dummy.c @ 1105:1b3e295f3acb
Add a dummy image loader.
It is used with --with-image-loader=dummy of configure. It is a dummy
image load that always abort the program when the program try to load
or free an image. This module can be used for early stage of a new
platform backend.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 05 Dec 2010 21:04:12 +0800 |
parents | |
children |
rev | line source |
---|---|
1105
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
1 #include <stdio.h> |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
2 #include "mb_img_ldr.h" |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
3 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
4 static mb_img_data_t *img_ldr_dummy_load(mb_img_ldr_t *ldr, |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
5 const char *img_id); |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
6 static void img_ldr_dummy_free(mb_img_ldr_t *ldr); |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
7 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
8 static mb_img_ldr_t img_ldr = { |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
9 img_ldr_dummy_load, |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
10 img_ldr_dummy_free |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
11 }; |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
12 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
13 #ifndef ERR |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
14 #include <stdio.h> |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
15 #include <stdlib.h> |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
16 #define ERR(msg) do { fprintf(stderr, __FILE__ ":%d: %s", __LINE__, msg); abort(); } while(0) |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
17 #endif |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
18 #ifndef NOT_IMPLEMENT |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
19 #define NOT_IMPLEMENT(func) \ |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
20 ERR(func " is not impmemented\n") |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
21 #endif |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
22 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
23 static mb_img_data_t * |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
24 img_ldr_dummy_load(mb_img_ldr_t *ldr, const char *img_id) { |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
25 NOT_IMPLEMENT("img_ldr_dummy_load"); |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
26 return NULL; |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
27 } |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
28 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
29 static void |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
30 img_ldr_dummy_free(mb_img_ldr_t *ldr) { |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
31 NOT_IMPLEMENT("img_ldr_dummy_free"); |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
32 } |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
33 |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
34 mb_img_ldr_t * |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
35 simple_mb_img_ldr_new(const char *img_repository) { |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
36 return &img_ldr; |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
37 } |
1b3e295f3acb
Add a dummy image loader.
Thinker K.F. Li <thinker@codemud.net>
parents:
diff
changeset
|
38 |