+2006-08-20 Aaron Bockover <abockover@novell.com>
+
+ * src/gmisc.c: added g_setenv, g_getenv, g_unsetenv
+
+ * src/gstr.c: added g_snprintf, g_sprintf, g_fprintf, g_printf
+
+ * src/glib.h: added macros for above va_args printf functions
+
+ * src/Makefile.am: added gmisc.c
+
+ * test/whats-implemented: script to see what needs to be implemented
+
2006-08-20 Chris Toshok <toshok@ximian.com>
* test/array.c (test_array_big): add a test from the glib
gslist.c \
gstring.c \
gptrarray.c \
- glist.c
+ glist.c \
+ gmisc.c
libeglib_la_CFLAGS = -Wall -Werror -D_FORTIFY_SOURCE=2
* Misc.
*/
#define g_atexit(func) ((void) atexit (func))
+
+const gchar * g_getenv(const gchar *variable);
+gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
+void g_unsetenv(const gchar *variable);
+
/*
* Precondition macros
*/
gchar *g_strchug (gchar *str);
gchar *g_strchomp (gchar *str);
+gint g_printf (gchar const *format, ...);
+gint g_fprintf (FILE *file, gchar const *format, ...);
+gint g_sprintf (gchar *string, gchar const *format, ...);
+gint g_snprintf (gchar *string, gulong n, gchar const *format, ...);
+
+#define g_vprintf vprintf
+#define g_vfprintf vfprintf
+#define g_vsprintf vsprintf
+#define g_vsnprintf vsnprintf
+#define g_vasprintf vasprintf
+
#define g_ascii_isspace(c) (isspace (c) != 0)
#define g_ascii_isalpha(c) (isalpha (c) != 0)
#define g_ascii_isprint(c) (isprint (c) != 0)
--- /dev/null
+/*
+ * gmisc.c: Misc functions with no place to go (right now)
+ *
+ * Author:
+ * Aaron Bockover (abockover@novell.com)
+ *
+ * (C) 2006 Novell, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+
+const gchar *
+g_getenv(const gchar *variable)
+{
+ return getenv(variable);
+}
+
+gboolean
+g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+{
+ return setenv(variable, value, overwrite) == 0;
+}
+
+void
+g_unsetenv(const gchar *variable)
+{
+ unsetenv(variable);
+}
+
return str;
}
+gint
+g_printf(gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vprintf(format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_fprintf(FILE *file, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vfprintf(file, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_sprintf(gchar *string, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsprintf(string, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+gint
+g_snprintf(gchar *string, gulong n, gchar const *format, ...)
+{
+ va_list args;
+ gint ret;
+
+ va_start(args, format);
+ ret = vsnprintf(string, n, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+
--- /dev/null
+#!/bin/bash
+
+# Author: Aaron Bockover
+# Licensed under MIT/X11
+# (C) 2006 Novell
+
+if [ "x$1" = "x--help" ]; then
+ echo "Usage: $0 [--show-only-mono]"
+ echo ""
+ echo "This script prints a sorted list of GLib functions used in Mono"
+ echo "that have not yet been implemented in EGlib."
+ echo ""
+ echo "If --show-only-mono is passed, then the script will print all"
+ echo "GLib functions used in Mono, whether or not they have been"
+ echo "implemented in EGlib yet."
+ echo ""
+ echo "This script relies on the MONO_CHECKOUT environment variable."
+ echo "MONO_CHECKOUT should be set to the location of a mono checkout."
+ echo ""
+ exit 1
+fi
+
+if [ -z $MONO_CHECKOUT ]; then
+ MONO_CHECKOUT=~/cvs/mono/mono
+fi
+
+if [ ! -d $MONO_CHECKOUT ]; then
+ echo "Cannot find mono checkout; set MONO_CHECKOUT"
+ exit 1
+fi
+
+MONO_CHECKOUT="$MONO_CHECKOUT/mono"
+RESULTS_FILE=.results
+
+(for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do
+ grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i |
+ awk 'BEGIN { FS="(" } { print $1 }' |
+ sed -e 's/[^A-Za-z_]//g'
+ done
+) > $RESULTS_FILE
+
+if [ ! "x$1" = "x--show-only-mono" ]; then
+ IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
+
+ rm -f $RESULTS_FILE.tmp
+
+ for mono_function in `cat $RESULTS_FILE`; do
+ matched="no"
+ for implemented_function in $IMPLEMENTED_FUNCTIONS; do
+ if [ "x$mono_function" = "x$implemented_function" ]; then
+ matched="yes"
+ break
+ fi
+ done
+
+ if [ "x$matched" = "xno" ]; then
+ echo $mono_function >> $RESULTS_FILE.tmp
+ fi
+ done
+
+ mv $RESULTS_FILE.tmp $RESULTS_FILE
+fi
+
+(for i in `cat $RESULTS_FILE | sort -u`; do
+ echo "`grep -c $i $RESULTS_FILE` $i";
+ done;
+) | sort -nr
+
+rm $RESULTS_FILE
+