/usr/include/g3d/iff.h is in libg3d-dev 0.0.8-22.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | /* $Id$ */
/*
libg3d - 3D object loading library
Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __G3D_IFF_H__
#define __G3D_IFF_H__
/**
* SECTION:iff
* @short_description: IFF file helper functions
* @include: g3d/iff.h
*
* These are helper functions to read data from the Interchange File Format
* (IFF).
*/
/* FIXME: still needed for FILE until all plugins are converted
* #ifndef G3D_DISABLE_DEPRECATED */
#include <stdio.h>
/* #endif */
#include <glib.h>
#include <g3d/types.h>
/**
* G3D_IFF_PAD1:
*
* No padding is done after chunks.
*/
#define G3D_IFF_PAD1 0x01
/**
* G3D_IFF_PAD2:
*
* Chunks are 2-byte aligned
*/
#define G3D_IFF_PAD2 0x02
/**
* G3D_IFF_PAD4:
*
* Chunks are 4-byte aligned
*/
#define G3D_IFF_PAD4 0x04
/**
* G3D_IFF_PAD8:
*
* Chunks are 8-byte aligned
*/
#define G3D_IFF_PAD8 0x08
/**
* G3D_IFF_SUBCHUNK_LEN16:
*
* All chunks except the toplevel ones have 16-bit sizes.
*/
#define G3D_IFF_SUBCHUNK_LEN16 0x10
/**
* G3D_IFF_LEN16:
*
* All chunks have 16-bit sizes.
*/
#define G3D_IFF_LEN16 0x20
/**
* G3D_IFF_LE:
*
* The file has little-endian data.
*/
#define G3D_IFF_LE 0x40 /* little endian */
/**
* G3D_IFF_MKID:
* @a: first byte
* @b: second byte
* @c: third byte
* @d: fourth byte
*
* Generate an IFF chunk identifier from character representation, e.g.
* G3D_IFF_MKID('F','O','R','M').
*
* Returns: unsigned integer identifier.
*/
#define G3D_IFF_MKID(a,b,c,d) ( \
(((guint32)(a))<<24) | \
(((guint32)(b))<<16) | \
(((guint32)(c))<< 8) | \
(((guint32)(d)) ) )
G_BEGIN_DECLS
#ifndef G3D_DISABLE_DEPRECATED
/**
* g3d_iff_gdata:
*
* IFF global data (deprecated).
*/
#define g3d_iff_gdata G3DIffGlobal
/**
* g3d_iff_ldata:
*
* IFF local data (deprecated).
*/
#define g3d_iff_ldata G3DIffLocal
/**
* g3d_iff_chunk_callback:
*
* IFF chunk callback (deprecated).
*/
#define g3d_iff_chunk_callback G3DIffChunkCallback
/**
* g3d_iff_chunk_info:
*
* IFF chunk description (deprecated).
*/
#define g3d_iff_chunk_info G3DIffChunkInfo
#endif
/**
* G3DIffGlobal:
* @context: a valid context
* @model: a model
* @stream: the stream to read model from
* @flags: IFF flags
* @user_data: to be used by plugin
* @f: file to read model from (DEPRECATED)
* @max_fpos: maximum file position (DEPRECATED)
*
* The plugin-global data to be given to IFF callback functions.
*/
typedef struct {
G3DContext *context;
G3DModel *model;
G3DStream *stream;
guint32 flags;
gpointer user_data;
FILE *f;
long int max_fpos;
} G3DIffGlobal;
/**
* G3DIffLocal:
* @id: chunk identifier
* @parent_id: parent chunk identifier
* @object: an object set by parent callbacks, may be NULL
* @level: level of chunk
* @level_object: object shared by callbacks on the same level, may be NULL
* @nb: number of bytes remaining in chunk, has to be decremented after
* correctly after reading from stream
* @finalize: for container chunks the callback function is called before
* and after processing possible sub-chunks, the second time @finalize is set
* to TRUE
*
* The function-local data for IFF callback functions.
*/
typedef struct {
guint32 id;
guint32 parent_id;
gpointer object;
gint32 level;
gpointer level_object;
gint32 nb;
gboolean finalize;
} G3DIffLocal;
/**
* G3DIffChunkCallback:
* @global: the global data
* @local: the local data
*
* IFF callback function prototype.
*
* Returns: TRUE on success, FALSE else.
*/
typedef gboolean (* G3DIffChunkCallback)(
G3DIffGlobal *global, G3DIffLocal *local);
/**
* G3DIffChunkInfo:
* @id: identifier of chunk
* @description: human-readable description of chunk type
* @container: TRUE if this chunk contains sub-chunks
* @callback: function to be called if such a chunk is found
*
* A chunk type description.
*/
typedef struct {
gchar *id;
gchar *description;
gboolean container;
G3DIffChunkCallback callback;
} G3DIffChunkInfo;
/**
* g3d_iff_check:
* @stream: stream containing IFF file to check
* @id: top level ID (out)
* @len: length of top level container (out)
*
* Checks a stream for a valid IFF signature and reads the top level container.
*
* Returns: TRUE on success (valid IFF), FALSE else
*/
gboolean g3d_iff_check(G3DStream *stream, guint32 *id, gsize *len);
/**
* g3d_iff_read_chunk:
* @stream: stream to read from
* @id: ID of chunk (out)
* @len: length of chunk (excluding header) (out)
* @flags: flags
*
* Reads one chunk header from an IFF file.
*
* Returns: real length of chunk including header and possible padding byte
*/
gsize g3d_iff_read_chunk(G3DStream *stream, guint32 *id, gsize *len,
guint32 flags);
#ifndef G3D_DISABLE_DEPRECATED
/**
* g3d_iff_open:
* @filename: file name of IFF file
* @id: top level ID (out)
* @len: length of top level container (out)
*
* Opens an IFF file, checks it and reads its top level container.
*
* Returns: the file pointer of open file or NULL in case of an error
*/
FILE *g3d_iff_open(const gchar *filename, guint32 *id, guint32 *len);
/**
* g3d_iff_readchunk:
* @f: the open IFF file pointer
* @id: ID of chunk (out)
* @len: length of chunk (excluding header) (out)
* @flags: flags
*
* Reads one chunk header from an IFF file.
*
* Returns: real length of chunk including header and possible padding byte
*/
int g3d_iff_readchunk(FILE *f, guint32 *id, guint32 *len, guint32 flags);
#endif /* G3D_DISABLE_DEPRECATED */
/**
* g3d_iff_id_to_text:
* @id: an IFF identifier
*
* Get the text representation of an IFF chunk identifier.
*
* Returns: a newly allocated string containing the text identifier.
*/
gchar *g3d_iff_id_to_text(guint32 id);
/**
* g3d_iff_chunk_matches:
* @id: IFF identifier
* @tid: textual representation of identifier
*
* Check whether @id and @tid match.
*
* Returns: TRUE on match, FALSE else.
*/
gboolean g3d_iff_chunk_matches(guint32 id, gchar *tid);
/**
* g3d_iff_handle_chunk:
* @global: global data
* @plocal: local data of parent chunk, must not be NULL
* @chunks: chunk description list
* @flags: IFF flags
*
* Handle an IFF chunk based on chunk description.
*
* Returns: level object for siblings, may be NULL.
*/
gpointer g3d_iff_handle_chunk(G3DIffGlobal *global, G3DIffLocal *plocal,
G3DIffChunkInfo *chunks, guint32 flags);
/**
* g3d_iff_read_ctnr:
* @global: global data
* @local: local data of current chunk, must not be NULL
* @chunks: chunk description list
* @flags: IFF flags
*
* Read subchunks in current chunk and handle them appropriately.
*
* Returns: TRUE on success, FALSE else.
*/
gboolean g3d_iff_read_ctnr(G3DIffGlobal *global, G3DIffLocal *local,
G3DIffChunkInfo *chunks, guint32 flags);
G_END_DECLS
#endif
|