From: martin-s Date: Sat, 18 Oct 2008 17:25:16 +0000 (+0000) Subject: Add:Core:Added necessary modifications for glib to compile from within navit X-Git-Tag: navit-0.5.0.5194svn~3672 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b28c6e413245cff8096d0d24b67109c37882b49;p=profile%2Fivi%2Fnavit.git Add:Core:Added necessary modifications for glib to compile from within navit git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1485 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/navit/support/glib/Makefile.am b/navit/navit/support/glib/Makefile.am new file mode 100644 index 0000000..d32f4f8 --- /dev/null +++ b/navit/navit/support/glib/Makefile.am @@ -0,0 +1,9 @@ +include $(top_srcdir)/Makefile.inc +AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -I$(top_srcdir)/navit/support -DMODULE=support_glib +noinst_LTLIBRARIES = libsupport_glib.la +libsupport_glib_la_SOURCES = fake.c galiasdef.c gatomic.c gerror.c \ + ghash.c glib_init.c glist.c gmem.c gmessages.c gprimes.c gprintf.c gslice.c \ + gstrfuncs.c gstring.c gutils.c \ + fake.h galias.h gerror.h ghash.h glib.h glibconfig.h glibintl.h glist.h \ + gmacros.h gmem.h gmessages.h gprintf.h gprintfint.h gquark.h gslice.h \ + gstrfuncs.h gthreadprivate.h gtypes.h diff --git a/navit/navit/support/glib/fake.c b/navit/navit/support/glib/fake.c new file mode 100644 index 0000000..7da3718 --- /dev/null +++ b/navit/navit/support/glib/fake.c @@ -0,0 +1,5 @@ +char * +g_convert(char *in) +{ + return g_strdup(in); +} diff --git a/navit/navit/support/glib/fake.h b/navit/navit/support/glib/fake.h new file mode 100644 index 0000000..6fc9d55 --- /dev/null +++ b/navit/navit/support/glib/fake.h @@ -0,0 +1,6 @@ +#define g_return_if_fail +#define GMutex void +#define GPrivate void +#define g_mutex_new() NULL +#define g_mutex_lock(x) +#define g_mutex_unlock(x) diff --git a/navit/navit/support/glib/galias.h b/navit/navit/support/glib/galias.h new file mode 100644 index 0000000..e69de29 diff --git a/navit/navit/support/glib/galiasdef.c b/navit/navit/support/glib/galiasdef.c new file mode 100644 index 0000000..e69de29 diff --git a/navit/navit/support/glib/gerror.c b/navit/navit/support/glib/gerror.c index 9408560..34d8c28 100644 --- a/navit/navit/support/glib/gerror.c +++ b/navit/navit/support/glib/gerror.c @@ -47,6 +47,7 @@ g_error_new_valist (GQuark domain, return error; } +#if NOT_NEEDED_FOR_NAVIT /** * g_error_new: * @domain: error domain @@ -175,6 +176,7 @@ g_error_matches (const GError *error, #define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \ "This indicates a bug in someone's code. You must ensure an error is NULL before it's set.\n" \ "The overwriting error message was: %s" +#endif /* NOT_NEEDED_FOR_NAVIT */ /** * g_set_error: @@ -207,10 +209,13 @@ g_set_error (GError **err, if (*err == NULL) *err = new; +#if NOT_NEEDED_FOR_NAVIT else g_warning (ERROR_OVERWRITTEN_WARNING, new->message); +#endif /* NOT_NEEDED_FOR_NAVIT */ } +#if NOT_NEEDED_FOR_NAVIT /** * g_set_error_literal: * @err: a return location for a #GError, or %NULL @@ -371,5 +376,6 @@ g_propagate_prefixed_error (GError **dest, } } +#endif /* NOT_NEEDED_FOR_NAVIT */ #define __G_ERROR_C__ #include "galiasdef.c" diff --git a/navit/navit/support/glib/glib.h b/navit/navit/support/glib/glib.h new file mode 100644 index 0000000..0c3983c --- /dev/null +++ b/navit/navit/support/glib/glib.h @@ -0,0 +1,39 @@ +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * 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 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __G_LIB_H__ +#define __G_LIB_H__ + +#define __GLIB_H_INSIDE__ +#include +#include +#include +#include +#include + +#undef __GLIB_H_INSIDE__ + +#endif /* __G_LIB_H__ */ diff --git a/navit/navit/support/glib/glib_init.c b/navit/navit/support/glib/glib_init.c new file mode 100644 index 0000000..32be387 --- /dev/null +++ b/navit/navit/support/glib/glib_init.c @@ -0,0 +1,6 @@ +#include "plugin.h" + +void +plugin_init(void) +{ +} diff --git a/navit/navit/support/glib/glibconfig.h b/navit/navit/support/glib/glibconfig.h index db380a6..60d61aa 100644 --- a/navit/navit/support/glib/glibconfig.h +++ b/navit/navit/support/glib/glibconfig.h @@ -187,8 +187,10 @@ typedef unsigned __int64 guintptr; #define G_GNUC_INTERNAL +#if NOT_NEEDED_FOR_NAVIT #define G_THREADS_ENABLED #define G_THREADS_IMPL_WIN32 +#endif /* NOT_NEEDED_FOR_NAVIT */ typedef struct _GMutex* GStaticMutex; #define G_STATIC_MUTEX_INIT NULL #define g_static_mutex_get_mutex(mutex) \ @@ -241,6 +243,10 @@ union _GSystemThread #define G_MODULE_SUFFIX "dll" +#define HAVE_GOOD_PRINTF +#define NO_SYS_SIGLIST_DECL +#define GLIB_STATIC_COMPILATION +#define G_DISABLE_CHECKS /* A GPid is an abstraction for a process "handle". It is *not* an * abstraction for a process identifier in general. GPid is used in * GLib only for descendant processes spawned with the g_spawn* diff --git a/navit/navit/support/glib/glibintl.h b/navit/navit/support/glib/glibintl.h index 4bed7c1..7899488 100644 --- a/navit/navit/support/glib/glibintl.h +++ b/navit/navit/support/glib/glibintl.h @@ -1,9 +1,11 @@ #ifndef __GLIBINTL_H__ #define __GLIBINTL_H__ +#if NOT_NEEDED_FOR_NAVIT #ifndef SIZEOF_CHAR #error "config.h must be included prior to glibintl.h" #endif +#endif /* NOT_NEEDED_FOR_NAVIT */ G_CONST_RETURN gchar *glib_gettext (const gchar *str); diff --git a/navit/navit/support/glib/gmem.c b/navit/navit/support/glib/gmem.c index b9ce0a6..9cc091f 100644 --- a/navit/navit/support/glib/gmem.c +++ b/navit/navit/support/glib/gmem.c @@ -132,8 +132,10 @@ g_malloc (gsize n_bytes) if (mem) return mem; +#if NOT_NEEDED_FOR_NAVIT g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, n_bytes); +#endif /* NOT_NEEDED_FOR_NAVIT */ } return NULL; @@ -152,8 +154,10 @@ g_malloc0 (gsize n_bytes) if (mem) return mem; +#if NOT_NEEDED_FOR_NAVIT g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, n_bytes); +#endif /* NOT_NEEDED_FOR_NAVIT */ } return NULL; @@ -171,8 +175,10 @@ g_realloc (gpointer mem, if (mem) return mem; +#if NOT_NEEDED_FOR_NAVIT g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, n_bytes); +#endif /* NOT_NEEDED_FOR_NAVIT */ } if (mem) @@ -278,11 +284,15 @@ g_mem_set_vtable (GMemVTable *vtable) glib_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : glib_mem_vtable.realloc; vtable_set = TRUE; } +#if NOT_NEEDED_FOR_NAVIT else g_warning (G_STRLOC ": memory allocation vtable lacks one of malloc(), realloc() or free()"); +#endif /* NOT_NEEDED_FOR_NAVIT */ } +#if NOT_NEEDED_FOR_NAVIT else g_warning (G_STRLOC ": memory allocation vtable can only be set once at startup"); +#endif /* NOT_NEEDED_FOR_NAVIT */ } @@ -696,6 +706,7 @@ gboolean g_mem_gc_friendly = FALSE; static void g_mem_init_nomessage (void) { +#if NOT_NEEDED_FOR_NAVIT gchar buffer[1024]; const gchar *val; const GDebugKey keys[] = { @@ -711,6 +722,7 @@ g_mem_init_nomessage (void) { g_mem_gc_friendly = TRUE; } +#endif /* NOT_NEEDED_FOR_NAVIT */ g_mem_initialized = TRUE; } diff --git a/navit/navit/support/glib/gmessages.c b/navit/navit/support/glib/gmessages.c index 7b90a02..6790c75 100644 --- a/navit/navit/support/glib/gmessages.c +++ b/navit/navit/support/glib/gmessages.c @@ -42,11 +42,14 @@ #include #include "glib.h" +#if NOT_NEEDED_FOR_NAVIT #include "gdebug.h" +#endif /* NOT_NEEDED_FOR_NAVIT */ #include "gprintfint.h" #include "gthreadprivate.h" #include "galias.h" +#if NOT_NEEDED_FOR_NAVIT #ifdef G_OS_WIN32 #include /* For getpid() */ #include @@ -1053,6 +1056,7 @@ g_printerr (const gchar *format, g_free (string); } +#endif /* NOT_NEEDED_FOR_NAVIT */ gsize g_printf_string_upper_bound (const gchar *format, va_list args) @@ -1061,6 +1065,7 @@ g_printf_string_upper_bound (const gchar *format, return _g_vsnprintf (&c, 1, format, args) + 1; } +#if NOT_NEEDED_FOR_NAVIT void _g_messages_thread_init_nomessage (void) { @@ -1109,6 +1114,7 @@ _g_debug_init (void) g_log_set_always_fatal (fatal_mask); } } +#endif /* NOT_NEEDED_FOR_NAVIT */ #define __G_MESSAGES_C__ #include "galiasdef.c" diff --git a/navit/navit/support/glib/gslice.c b/navit/navit/support/glib/gslice.c index 70f9efa..d61420d 100644 --- a/navit/navit/support/glib/gslice.c +++ b/navit/navit/support/glib/gslice.c @@ -99,6 +99,7 @@ * [4] allocating ca. 8 chunks per block/page keeps a good balance between * external and internal fragmentation (<= 12.5%). [Bonwick94] */ +#if NOT_NEEDED_FOR_NAVIT /* --- macros and constants --- */ #define LARGEALIGNMENT (256) @@ -793,10 +794,12 @@ thread_memory_magazine2_free (ThreadMemory *tmem, mag->count++; } +#endif /* NOT_NEEDED_FOR_NAVIT */ /* --- API functions --- */ gpointer g_slice_alloc (gsize mem_size) { +#if NOT_NEEDED_FOR_NAVIT gsize chunk_size; gpointer mem; guint acat; @@ -825,6 +828,9 @@ g_slice_alloc (gsize mem_size) if (G_UNLIKELY (allocator->config.debug_blocks)) smc_notify_alloc (mem, mem_size); return mem; +#else /* NOT_NEEDED_FOR_NAVIT */ + return g_malloc(mem_size); +#endif /* NOT_NEEDED_FOR_NAVIT */ } gpointer @@ -850,6 +856,7 @@ void g_slice_free1 (gsize mem_size, gpointer mem_block) { +#if NOT_NEEDED_FOR_NAVIT gsize chunk_size = P2ALIGN (mem_size); guint acat = allocator_categorize (chunk_size); if (G_UNLIKELY (!mem_block)) @@ -885,6 +892,9 @@ g_slice_free1 (gsize mem_size, memset (mem_block, 0, mem_size); g_free (mem_block); } +#else /* NOT_NEEDED_FOR_NAVIT */ + g_free(mem_block); +#endif /* NOT_NEEDED_FOR_NAVIT */ } void @@ -893,6 +903,7 @@ g_slice_free_chain_with_offset (gsize mem_size, gsize next_offset) { gpointer slice = mem_chain; +#if NOT_NEEDED_FOR_NAVIT /* while the thread magazines and the magazine cache are implemented so that * they can easily be extended to allow for free lists containing more free * lists for the first level nodes, which would allow O(1) freeing in this @@ -949,19 +960,24 @@ g_slice_free_chain_with_offset (gsize mem_size, g_mutex_unlock (allocator->slab_mutex); } else /* delegate to system malloc */ +#else /* NOT_NEEDED_FOR_NAVIT */ while (slice) { guint8 *current = slice; slice = *(gpointer*) (current + next_offset); +#if NOT_NEEDED_FOR_NAVIT if (G_UNLIKELY (allocator->config.debug_blocks) && !smc_notify_free (current, mem_size)) abort(); +#endif /* NOT_NEEDED_FOR_NAVIT */ if (G_UNLIKELY (g_mem_gc_friendly)) memset (current, 0, mem_size); g_free (current); } +#endif /* NOT_NEEDED_FOR_NAVIT */ } +#if NOT_NEEDED_FOR_NAVIT /* --- single page allocator --- */ static void allocator_slab_stack_push (Allocator *allocator, @@ -1474,3 +1490,4 @@ g_slice_debug_tree_statistics (void) #define __G_SLICE_C__ #include "galiasdef.c" +#endif /* NOT_NEEDED_FOR_NAVIT */ diff --git a/navit/navit/support/glib/gstrfuncs.c b/navit/navit/support/glib/gstrfuncs.c index f45bbf7..24be1f3 100644 --- a/navit/navit/support/glib/gstrfuncs.c +++ b/navit/navit/support/glib/gstrfuncs.c @@ -378,7 +378,9 @@ g_ascii_strtod (const gchar *nptr, decimal_point = locale_data->decimal_point; decimal_point_len = strlen (decimal_point); +#if NOT_NEEDED_FOR_NAVIT g_assert (decimal_point_len != 0); +#endif /* NOT_NEEDED_FOR_NAVIT */ decimal_point_pos = NULL; end = NULL; @@ -593,7 +595,9 @@ g_ascii_formatd (gchar *buffer, decimal_point = locale_data->decimal_point; decimal_point_len = strlen (decimal_point); +#if NOT_NEEDED_FOR_NAVIT g_assert (decimal_point_len != 0); +#endif /* NOT_NEEDED_FOR_NAVIT */ if (decimal_point[0] != '.' || decimal_point[1] != 0) @@ -852,6 +856,7 @@ g_ascii_strtoll (const gchar *nptr, return (gint64) result; } +#if NOT_NEEDED_FOR_NAVIT G_CONST_RETURN gchar* g_strerror (gint errnum) { @@ -1299,11 +1304,15 @@ g_strerror (gint errnum) #endif } #else /* NO_SYS_ERRLIST */ +#if NOT_NEEDED_FOR_NAVIT extern int sys_nerr; extern char *sys_errlist[]; if ((errnum > 0) && (errnum <= sys_nerr)) return sys_errlist [errnum]; +#else /* NOT_NEEDED_FOR_NAVIT */ + return NULL; +#endif /* NOT_NEEDED_FOR_NAVIT */ #endif /* NO_SYS_ERRLIST */ msg = g_static_private_get (&msg_private); @@ -1449,11 +1458,15 @@ extern const char *strsignal(int); } #else /* NO_SYS_SIGLIST */ +#if NOT_NEEDED_FOR_NAVIT #ifdef NO_SYS_SIGLIST_DECL extern char *sys_siglist[]; /*(see Tue Jan 19 00:44:24 1999 in changelog)*/ #endif return (char*) /* this function should return const --josh */ sys_siglist [signum]; +#else /* NOT_NEEDED_FOR_NAVIT */ + return NULL; +#endif /* NOT_NEEDED_FOR_NAVIT */ #endif /* NO_SYS_SIGLIST */ msg = g_static_private_get (&msg_private); @@ -1467,6 +1480,7 @@ extern const char *strsignal(int); return msg; } +#endif /* NOT_NEEDED_FOR_NAVIT */ /* Functions g_strlcpy and g_strlcat were originally developed by * Todd C. Miller to simplify writing secure code. @@ -2083,7 +2097,9 @@ g_strcompress (const gchar *source) switch (*p) { case '\0': +#if NOT_NEEDED_FOR_NAVIT g_warning ("g_strcompress: trailing \\"); +#endif /* NOT_NEEDED_FOR_NAVIT */ goto out; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': @@ -2243,6 +2259,7 @@ g_strchomp (gchar *string) return string; } +#if NOT_NEEDED_FOR_NAVIT /** * g_strsplit: * @string: a string to split. @@ -2417,6 +2434,7 @@ g_strsplit_set (const gchar *string, return result; } +#endif /* NOT_NEEDED_FOR_NAVIT */ /** * g_strfreev: @@ -2574,6 +2592,7 @@ g_strjoin (const gchar *separator, return string; } +#if NOT_NEEDED_FOR_NAVIT /** * g_strstr_len: @@ -2630,6 +2649,7 @@ g_strstr_len (const gchar *haystack, return NULL; } } +#endif /* NOT_NEEDED_FOR_NAVIT */ /** * g_strrstr: @@ -2680,6 +2700,7 @@ g_strrstr (const gchar *haystack, return NULL; } +#if NOT_NEEDED_FOR_NAVIT /** * g_strrstr_len: * @haystack: a nul-terminated string. @@ -3098,6 +3119,7 @@ g_dngettext (const gchar *domain, return dngettext (domain, msgid, msgid_plural, n); } +#endif /* NOT_NEEDED_FOR_NAVIT */ #define __G_STRFUNCS_C__ #include "galiasdef.c" diff --git a/navit/navit/support/glib/gstring.c b/navit/navit/support/glib/gstring.c index 9f0198b..9a7bb6a 100644 --- a/navit/navit/support/glib/gstring.c +++ b/navit/navit/support/glib/gstring.c @@ -44,6 +44,7 @@ #include "galias.h" +#if NOT_NEEDED_FOR_NAVIT struct _GStringChunk { GHashTable *const_table; @@ -52,6 +53,7 @@ struct _GStringChunk gsize this_size; gsize default_size; }; +#endif /* NOT_NEEDED_FOR_NAVIT */ /* Hash Functions. */ @@ -101,6 +103,7 @@ g_str_hash (gconstpointer v) return h; } +#if NOT_NEEDED_FOR_NAVIT #define MY_MAXSIZE ((gsize)-1) static inline gsize @@ -1480,5 +1483,6 @@ g_string_append_printf (GString *string, va_end (args); } +#endif /* NOT_NEEDED_FOR_NAVIT */ #define __G_STRING_C__ #include "galiasdef.c" diff --git a/navit/navit/support/glib/gutils.c b/navit/navit/support/glib/gutils.c index df9c658..f88890c 100644 --- a/navit/navit/support/glib/gutils.c +++ b/navit/navit/support/glib/gutils.c @@ -85,7 +85,9 @@ #endif /* G_PLATFORM_WIN32 */ #ifdef G_OS_WIN32 +#if NOT_NEEDED_FOR_NAVIT # include +#endif /* NOT_NEEDED_FOR_NAVIT */ # include /* older SDK (e.g. msvc 5.0) does not have these*/ # ifndef CSIDL_MYMUSIC @@ -124,6 +126,7 @@ #include #endif +#if NOT_NEEDED_FOR_NAVIT const guint glib_major_version = GLIB_MAJOR_VERSION; const guint glib_minor_version = GLIB_MINOR_VERSION; const guint glib_micro_version = GLIB_MICRO_VERSION; @@ -3094,6 +3097,7 @@ g_get_language_names (void) return (G_CONST_RETURN gchar * G_CONST_RETURN *) cache->language_names; } +#endif /* NOT_NEEDED_FOR_NAVIT */ /** * g_direct_hash: * @v: a #gpointer key @@ -3163,6 +3167,7 @@ g_int_hash (gconstpointer v) return *(const gint*) v; } +#if NOT_NEEDED_FOR_NAVIT /** * g_nullify_pointer: * @nullify_location: the memory address of the pointer. @@ -3405,6 +3410,7 @@ g_get_tmp_dir (void) } #endif +#endif /* NOT_NEEDED_FOR_NAVIT */ #define __G_UTILS_C__ #include "galiasdef.c"