libweed 0.0.3

weed.h

Go to the documentation of this file.
00001 /* WEED is free software; you can redistribute it and/or
00002    modify it under the terms of the GNU Lesser General Public
00003    License as published by the Free Software Foundation; either
00004    version 3 of the License, or (at your option) any later version.
00005 
00006    Weed is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00009    Lesser General Public License for more details.
00010 
00011    You should have received a copy of the GNU Lesser General Public
00012    License along with this source code; if not, write to the Free Software
00013    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00014 
00015 
00016    Weed is developed by:
00017 
00018    Gabriel "Salsaman" Finch - http://lives.sourceforge.net
00019 
00020    mainly based on LiViDO, which is developed by:
00021 
00022 
00023    Niels Elburg - http://veejay.sf.net
00024 
00025    Gabriel "Salsaman" Finch - http://lives.sourceforge.net
00026 
00027    Denis "Jaromil" Rojo - http://freej.dyne.org
00028 
00029    Tom Schouten - http://zwizwa.fartit.com
00030 
00031    Andraz Tori - http://cvs.cinelerra.org
00032 
00033    reviewed with suggestions and contributions from:
00034 
00035    Silvano "Kysucix" Galliani - http://freej.dyne.org
00036 
00037    Kentaro Fukuchi - http://megaui.net/fukuchi
00038 
00039    Jun Iio - http://www.malib.net
00040 
00041    Carlo Prelz - http://www2.fluido.as:8080/
00042 
00043 */
00044 
00045 /* (C) Gabriel "Salsaman" Finch, 2005 - 2007 */
00046 
00047 #ifndef __WEED_H__
00048 #define __WEED_H__
00049 
00050 #ifdef __cplusplus
00051 extern "C"
00052 {
00053 #endif /* __cplusplus */
00054 
00055 #define __need_size_t
00056 #define __need_NULL
00057 #include <stddef.h>
00058 #include <inttypes.h>
00059 
00060 #define WEED_TRUE 1
00061 #define WEED_FALSE 0
00062 
00063 /* Leaf flags */
00064 #define WEED_LEAF_READONLY_PLUGIN (1<<0)
00065 #define WEED_LEAF_READONLY_HOST (1<<1)
00066 
00067 /* Weed errors */
00068 /* Core errors */
00069 #define WEED_NO_ERROR 0
00070 #define WEED_ERROR_MEMORY_ALLOCATION 1
00071 #define WEED_ERROR_LEAF_READONLY 2
00072 #define WEED_ERROR_NOSUCH_ELEMENT 3
00073 #define WEED_ERROR_NOSUCH_LEAF 4
00074 #define WEED_ERROR_WRONG_SEED_TYPE 5
00075 
00076 /* Seed types */
00077 /* Fundamental seeds */
00078 #define WEED_SEED_INT     1
00079 #define WEED_SEED_DOUBLE  2
00080 #define WEED_SEED_BOOLEAN 3
00081 #define WEED_SEED_STRING  4
00082 #define WEED_SEED_INT64   5
00083 
00084 /* Pointer seeds */
00085 #define WEED_SEED_VOIDPTR  65
00086 #define WEED_SEED_PLANTPTR 66
00087 
00088   // these function types are fixed, and must be defined in the host
00089 typedef void *(*weed_malloc_f) (size_t size);
00090 typedef void (*weed_free_f) (void *ptr);
00091 typedef void *(*weed_memset_f) (void *s, int c, size_t n);
00092 typedef void *(*weed_memcpy_f) (void *dest, const void *src, size_t n);
00093 
00094 #ifndef HAVE_WEED_PLANT_T
00095 #define HAVE_WEED_PLANT_T
00096 
00097 typedef struct weed_leaf weed_leaf_t;
00098 typedef struct weed_data weed_data_t;
00099 typedef weed_leaf_t weed_plant_t;
00100 
00101   /* private data - these fields must NOT be accessed directly ! */
00102 struct weed_leaf {
00103   const char *key;
00104   int seed_type;
00105   int num_elements;
00106   weed_data_t **data;
00107   int flags;
00108   weed_leaf_t *next;
00109 };
00110 
00111 struct weed_data {
00112   size_t size;
00113   void *value;
00114 };
00115 
00116 #endif
00117 
00118 typedef int64_t weed_timecode_t;
00119 
00121 typedef int (*weed_default_getter_f)(weed_plant_t *plant, const char *key, int idx, void *value);
00122 
00123   /* host and plugin functions, may be changed depending on API level */
00124 typedef weed_plant_t *(*weed_plant_new_f)(int plant_type);
00125 typedef char **(*weed_plant_list_leaves_f)(weed_plant_t *plant);
00126 typedef int (*weed_leaf_set_f)(weed_plant_t *plant, const char *key, int seed_type, int num_elems, void *value);
00127 typedef int (*weed_leaf_get_f)(weed_plant_t *plant, const char *key, int idx, void *value);
00128 typedef int (*weed_leaf_num_elements_f)(weed_plant_t *plant, const char *key);
00129 typedef size_t (*weed_leaf_element_size_f)(weed_plant_t *plant, const char *key, int idx);
00130 typedef int (*weed_leaf_seed_type_f)(weed_plant_t *plant, const char *key);
00131 typedef int (*weed_leaf_get_flags_f)(weed_plant_t *plant, const char *key);
00132 
00133 #ifdef __cplusplus
00134 }
00135 #endif /* __cplusplus */
00136 
00137 #endif // #ifndef __WEED_H__
 All Data Structures Files Functions Variables Typedefs Defines