summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-11-12 22:13:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-11-12 22:13:21 (GMT)
commitae8cf6257c8d929de1b7ee86e29fcb45ab4af91c (patch)
tree59fa356b2f83020e23df4cf6975ca5d97567df4d /src/glibext
parentabaf85fdc0edb2bfe67d07d52ae734d50c6fbf61 (diff)
Changed the display of the pseudo registers by using an index.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@192 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/Makefile.am1
-rw-r--r--src/glibext/gnhash.c52
-rw-r--r--src/glibext/gnhash.h37
3 files changed, 90 insertions, 0 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am
index 1e21b58..2365190 100644
--- a/src/glibext/Makefile.am
+++ b/src/glibext/Makefile.am
@@ -7,6 +7,7 @@ libglibext_la_SOURCES = \
gbufferline.h gbufferline.c \
gbuffersegment.h gbuffersegment.c \
gcodebuffer.h gcodebuffer.c \
+ gnhash.h gnhash.c \
proto.h
libglibext_la_LDFLAGS =
diff --git a/src/glibext/gnhash.c b/src/glibext/gnhash.c
new file mode 100644
index 0000000..cdd4dd1
--- /dev/null
+++ b/src/glibext/gnhash.c
@@ -0,0 +1,52 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gnhash.c - nouvelle fonction offrant une empreinte constante
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gnhash.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : v = pointeur quelconque. *
+* *
+* Description : Convertit un pointeur en une empreinte constante. *
+* *
+* Retour : 2. *
+* *
+* Remarques : L'algorithme actuel (12/11/10) de la GLib impose qu'une *
+* même empreinte impose une même clef. Deux clefs distinctes, *
+* pourtant égales, ont deux empreintes distinctes, donc on *
+* définit une seule empreinte possible. Pas terrible, mais *
+* cela répond au besoin (association simple clef <-> valeur). *
+* *
+******************************************************************************/
+
+guint g_constant_hash(gconstpointer v)
+{
+ /**
+ * La valeur doit être supérieure à 1 pour ne
+ * pas être totalement inéfficace.
+ */
+ return 2;
+
+}
diff --git a/src/glibext/gnhash.h b/src/glibext/gnhash.h
new file mode 100644
index 0000000..4c49357
--- /dev/null
+++ b/src/glibext/gnhash.h
@@ -0,0 +1,37 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gnhash.h - prototype pour une nouvelle fonction offrant une empreinte constante
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_GNHASH_H
+#define _GLIBEXT_GNHASH_H
+
+
+#include <glib-object.h>
+
+
+
+/* Convertit un pointeur en une empreinte constante. */
+guint g_constant_hash(gconstpointer);
+
+
+
+#endif /* _GLIBEXT_GNHASH_H */