From 26bdd29be8f2621fb72bd0a1759b78728880788c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 19 Mar 2010 12:15:52 +0000 Subject: [PATCH] Fl_Plugin: using bas 'A' encoded BCD to write the pointer. This is pure and fast C. However, the pointer is not human readable (hexadecimal would just be a waste of time ;-). The size of the string adapts to the length of the pointer and ignores big/little endian. All calls have room for a maximum of 128bit per pointer. I also removed the verbose comments to keep them out of the snapshot tonight. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7303 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Preferences.cxx | 64 ++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index 962e4a8c8..349a41cf7 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -25,7 +25,7 @@ // http://www.fltk.org/str.php // -#define FL_PLUGIN_VERBOSE +#undef FL_PLUGIN_VERBOSE #include #include @@ -1858,22 +1858,44 @@ Fl_Plugin_Manager::~Fl_Plugin_Manager() #endif } +static unsigned char x2i(char hi, char lo) { + return ((hi-'A')<<4) | (lo-'A'); +} + +static void i2x(unsigned char v, char *d) { + d[0] = ((v>>4)&0x0f)+'A'; d[1] = (v&0x0f)+'A'; +} + +static void *a2p(const char *s) { + union { void *ret; unsigned char d[sizeof(void*)]; } v; + v.ret = 0L; + int i=0, n=sizeof(void*); + for (i=0; i