nuclear@2: /* reimplementation of the subset of glib used by libsmf nuclear@2: * nuclear@2: * Copyright (C) 2012 John Tsiombikas nuclear@2: * All rights reserved. nuclear@2: * nuclear@2: * Redistribution and use in source and binary forms, with or without nuclear@2: * modification, are permitted provided that the following conditions are met: nuclear@2: * nuclear@2: * 1. Redistributions of source code must retain the above copyright notice, this nuclear@2: * list of conditions and the following disclaimer. nuclear@2: * 2. Redistributions in binary form must reproduce the above copyright notice, nuclear@2: * this list of conditions and the following disclaimer in the documentation nuclear@2: * and/or other materials provided with the distribution. nuclear@2: * nuclear@2: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND nuclear@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED nuclear@2: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE nuclear@2: * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR nuclear@2: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES nuclear@2: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; nuclear@2: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND nuclear@2: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT nuclear@2: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS nuclear@2: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nuclear@2: */ nuclear@2: nuclear@0: #ifndef FAKE_GLIB_H_ nuclear@0: #define FAKE_GLIB_H_ nuclear@0: nuclear@0: typedef struct FakeGPtrArray { nuclear@0: void **pdata; nuclear@0: unsigned int len; nuclear@0: } FakeGPtrArray; nuclear@0: nuclear@0: typedef int (*FakeGCompareFunc)(const void*, const void*); nuclear@0: nuclear@0: #ifndef TRUE nuclear@0: #define TRUE 1 nuclear@0: #endif nuclear@0: #ifndef FALSE nuclear@0: #define FALSE 0 nuclear@0: #endif nuclear@0: nuclear@1: typedef char gchar; nuclear@0: typedef int gint; nuclear@0: typedef void* gpointer; nuclear@0: typedef const void* gconstpointer; nuclear@0: nuclear@0: #define fg_ptr_array_index(arr, idx) ((arr)->pdata[idx]) nuclear@0: nuclear@0: FakeGPtrArray *fg_ptr_array_new(void); nuclear@0: void **fg_ptr_array_free(FakeGPtrArray *arr, int free_seg); nuclear@0: nuclear@0: void fg_ptr_array_add(FakeGPtrArray *arr, void *data); nuclear@0: int fg_ptr_array_remove(FakeGPtrArray *arr, void *data); nuclear@0: void *fg_ptr_array_remove_index(FakeGPtrArray *arr, unsigned int idx); nuclear@0: nuclear@0: void fg_ptr_array_sort(FakeGPtrArray *arr, FakeGCompareFunc cmp); nuclear@0: nuclear@0: /* -- logging -- */ nuclear@1: void fg_message(const char *fmt, ...); nuclear@0: void fg_warning(const char *fmt, ...); nuclear@0: void fg_critical(const char *fmt, ...); nuclear@0: void fg_error(const char *fmt, ...); nuclear@0: void fg_debug(const char *fmt, ...); nuclear@0: nuclear@0: #endif /* FAKE_GLIB_H_ */