smflite

annotate src/fake_glib.h @ 2:d9e0d0500a78

added COPYING and README
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Jan 2012 15:51:53 +0200
parents 8e535ca4bb86
children
rev   line source
nuclear@2 1 /* reimplementation of the subset of glib used by libsmf
nuclear@2 2 *
nuclear@2 3 * Copyright (C) 2012 John Tsiombikas <nuclear@mutantstargoat.com>
nuclear@2 4 * All rights reserved.
nuclear@2 5 *
nuclear@2 6 * Redistribution and use in source and binary forms, with or without
nuclear@2 7 * modification, are permitted provided that the following conditions are met:
nuclear@2 8 *
nuclear@2 9 * 1. Redistributions of source code must retain the above copyright notice, this
nuclear@2 10 * list of conditions and the following disclaimer.
nuclear@2 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
nuclear@2 12 * this list of conditions and the following disclaimer in the documentation
nuclear@2 13 * and/or other materials provided with the distribution.
nuclear@2 14 *
nuclear@2 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
nuclear@2 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
nuclear@2 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
nuclear@2 18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
nuclear@2 19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
nuclear@2 20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
nuclear@2 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
nuclear@2 22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nuclear@2 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
nuclear@2 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nuclear@2 25 */
nuclear@2 26
nuclear@0 27 #ifndef FAKE_GLIB_H_
nuclear@0 28 #define FAKE_GLIB_H_
nuclear@0 29
nuclear@0 30 typedef struct FakeGPtrArray {
nuclear@0 31 void **pdata;
nuclear@0 32 unsigned int len;
nuclear@0 33 } FakeGPtrArray;
nuclear@0 34
nuclear@0 35 typedef int (*FakeGCompareFunc)(const void*, const void*);
nuclear@0 36
nuclear@0 37 #ifndef TRUE
nuclear@0 38 #define TRUE 1
nuclear@0 39 #endif
nuclear@0 40 #ifndef FALSE
nuclear@0 41 #define FALSE 0
nuclear@0 42 #endif
nuclear@0 43
nuclear@1 44 typedef char gchar;
nuclear@0 45 typedef int gint;
nuclear@0 46 typedef void* gpointer;
nuclear@0 47 typedef const void* gconstpointer;
nuclear@0 48
nuclear@0 49 #define fg_ptr_array_index(arr, idx) ((arr)->pdata[idx])
nuclear@0 50
nuclear@0 51 FakeGPtrArray *fg_ptr_array_new(void);
nuclear@0 52 void **fg_ptr_array_free(FakeGPtrArray *arr, int free_seg);
nuclear@0 53
nuclear@0 54 void fg_ptr_array_add(FakeGPtrArray *arr, void *data);
nuclear@0 55 int fg_ptr_array_remove(FakeGPtrArray *arr, void *data);
nuclear@0 56 void *fg_ptr_array_remove_index(FakeGPtrArray *arr, unsigned int idx);
nuclear@0 57
nuclear@0 58 void fg_ptr_array_sort(FakeGPtrArray *arr, FakeGCompareFunc cmp);
nuclear@0 59
nuclear@0 60 /* -- logging -- */
nuclear@1 61 void fg_message(const char *fmt, ...);
nuclear@0 62 void fg_warning(const char *fmt, ...);
nuclear@0 63 void fg_critical(const char *fmt, ...);
nuclear@0 64 void fg_error(const char *fmt, ...);
nuclear@0 65 void fg_debug(const char *fmt, ...);
nuclear@0 66
nuclear@0 67 #endif /* FAKE_GLIB_H_ */