فهرست منبع

Changes to make it compile on linux 64bits.

mingodad 12 سال پیش
والد
کامیت
771b861392

+ 28 - 1
SquiLu-editor/editor.cbp

@@ -93,6 +93,34 @@
 					<Add directory="../flu" />
 					<Add directory="../flu" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
+			<Target title="Release 64bits">
+				<Option output="editor" prefix_auto="1" extension_auto="1" />
+				<Option object_output="objs" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O3" />
+					<Add option="-DNDEBUG=1" />
+					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
+					<Add option="-D_SQ64=1" />
+					<Add option="-DCONFIG_64=1" />
+					<Add directory="/usr/include/postgresql" />
+					<Add directory="/usr/include/mysql" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add library="X11" />
+					<Add library="Xinerama" />
+					<Add library="Xft" />
+					<Add library="Xext" />
+					<Add library="pthread" />
+					<Add library="zmq3" />
+					<Add library="axtls" />
+					<Add library="mpdecimal" />
+					<Add library="discount" />
+					<Add library="rt" />
+				</Linker>
+			</Target>
 		</Build>
 		</Build>
 		<Compiler>
 		<Compiler>
 			<Add option="-Wall" />
 			<Add option="-Wall" />
@@ -104,7 +132,6 @@
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDECIMAL642=1" />
 			<Add option="-DSQUSEDECIMAL642=1" />
 			<Add option="-DNO_EXCEPTION_KEY_NOT_FOUND0=1" />
 			<Add option="-DNO_EXCEPTION_KEY_NOT_FOUND0=1" />
-			<Add option="-D_SQ642=1" />
 			<Add option="-DNO_GARBAGE_COLLECTOR00=1" />
 			<Add option="-DNO_GARBAGE_COLLECTOR00=1" />
 			<Add option="-DSQLITE_DEFAULT_FILE_FORMAT=4" />
 			<Add option="-DSQLITE_DEFAULT_FILE_FORMAT=4" />
 			<Add option="-DSQLITE_DEFAULT_AUTOVACUUM=1" />
 			<Add option="-DSQLITE_DEFAULT_AUTOVACUUM=1" />

+ 3 - 2
SquiLu-ext/sq_fltk.cpp

@@ -3760,7 +3760,8 @@ static SQRESULT _fl_get_font(HSQUIRRELVM v)
 
 
 static SQRESULT _fl_get_font_name(HSQUIRRELVM v)
 static SQRESULT _fl_get_font_name(HSQUIRRELVM v)
 {
 {
-    SQInteger font, attributes = 0;
+    SQInteger font;
+    int attributes = 0;
     sq_getinteger(v, 2, &font);
     sq_getinteger(v, 2, &font);
     const char *fname = Fl::get_font_name((Fl_Font)font, &attributes);
     const char *fname = Fl::get_font_name((Fl_Font)font, &attributes);
     sq_newtable(v);
     sq_newtable(v);
@@ -3916,7 +3917,7 @@ static SQRESULT _fl_globals_fl_color(HSQUIRRELVM v)
     SQ_FUNC_VARS(v);
     SQ_FUNC_VARS(v);
     if(_top_ > 1){
     if(_top_ > 1){
         SQ_GET_INTEGER(v, 2, color);
         SQ_GET_INTEGER(v, 2, color);
-        fl_color(color);
+        fl_color((Fl_Color)color);
         return 0;
         return 0;
     }
     }
     sq_pushinteger(v, fl_color());
     sq_pushinteger(v, fl_color());

+ 2 - 2
SquiLu-ext/sq_sqlite3.cpp

@@ -1524,7 +1524,7 @@ static SQRESULT sq_sqlite3_key(HSQUIRRELVM v)
     SQ_FUNC_VARS_NO_TOP(v);
     SQ_FUNC_VARS_NO_TOP(v);
     GET_sqlite3_INSTANCE();
     GET_sqlite3_INSTANCE();
     SQ_GET_STRING(v, 2, key);
     SQ_GET_STRING(v, 2, key);
-    sq_pushinteger(v, sqlite3_key(self, key, key_size));
+    sq_pushinteger(v, sqlite3_key_v2(self, 0, key, key_size));
     return 1;
     return 1;
 }
 }
 
 
@@ -1537,7 +1537,7 @@ static SQRESULT sq_sqlite3_rekey(HSQUIRRELVM v)
     SQ_FUNC_VARS_NO_TOP(v);
     SQ_FUNC_VARS_NO_TOP(v);
     GET_sqlite3_INSTANCE();
     GET_sqlite3_INSTANCE();
     SQ_GET_STRING(v, 2, key);
     SQ_GET_STRING(v, 2, key);
-    sq_pushinteger(v, sqlite3_rekey(self, key, key_size));
+    sq_pushinteger(v, sqlite3_rekey_v2(self, 0, key, key_size));
     return 1;
     return 1;
 }
 }
 
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 195 - 175
SquiLu-ext/sqlite3.c


+ 34 - 5
SquiLu-ext/sqlite3.h

@@ -107,9 +107,9 @@ extern "C" {
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 ** [sqlite_version()] and [sqlite_source_id()].
 */
 */
-#define SQLITE_VERSION        "3.7.17"
-#define SQLITE_VERSION_NUMBER 3007017
-#define SQLITE_SOURCE_ID      "2013-05-03 20:08:16 9314b08099e7ac99a507a4799f2c6cdd6d597abb"
+#define SQLITE_VERSION        "3.8.0"
+#define SQLITE_VERSION_NUMBER 3008000
+#define SQLITE_SOURCE_ID      "2013-07-12 21:09:24 92adaee5bd31c152dbc1592f4aeb5d8da957a1ea"
 
 
 /*
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -490,6 +490,7 @@ SQLITE_API int sqlite3_exec(
 #define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
 #define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))
 #define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
 #define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
 #define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
 #define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
+#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
 #define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
 #define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
 #define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
 #define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
 #define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
 #define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
@@ -509,6 +510,7 @@ SQLITE_API int sqlite3_exec(
 #define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
 #define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
 #define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
 #define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
 #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
 #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
+#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
 
 
 /*
 /*
 ** CAPI3REF: Flags For File Open Operations
 ** CAPI3REF: Flags For File Open Operations
@@ -2585,7 +2587,7 @@ SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
 ** interface is to keep a GUI updated during a large query.
 ** interface is to keep a GUI updated during a large query.
 **
 **
 ** ^The parameter P is passed through as the only parameter to the 
 ** ^The parameter P is passed through as the only parameter to the 
-** callback function X.  ^The parameter N is the number of 
+** callback function X.  ^The parameter N is the approximate number of 
 ** [virtual machine instructions] that are evaluated between successive
 ** [virtual machine instructions] that are evaluated between successive
 ** invocations of the callback X.
 ** invocations of the callback X.
 **
 **
@@ -4550,6 +4552,11 @@ SQLITE_API int sqlite3_key(
   sqlite3 *db,                   /* Database to be rekeyed */
   sqlite3 *db,                   /* Database to be rekeyed */
   const void *pKey, int nKey     /* The key */
   const void *pKey, int nKey     /* The key */
 );
 );
+SQLITE_API int sqlite3_key_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The key */
+);
 
 
 /*
 /*
 ** Change the key on an open database.  If the current database is not
 ** Change the key on an open database.  If the current database is not
@@ -4563,6 +4570,11 @@ SQLITE_API int sqlite3_rekey(
   sqlite3 *db,                   /* Database to be rekeyed */
   sqlite3 *db,                   /* Database to be rekeyed */
   const void *pKey, int nKey     /* The new key */
   const void *pKey, int nKey     /* The new key */
 );
 );
+SQLITE_API int sqlite3_rekey_v2(
+  sqlite3 *db,                   /* Database to be rekeyed */
+  const char *zDbName,           /* Name of the database */
+  const void *pKey, int nKey     /* The new key */
+);
 
 
 /*
 /*
 ** Specify the activation key for a SEE database.  Unless 
 ** Specify the activation key for a SEE database.  Unless 
@@ -6268,6 +6280,12 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
 ** </dd>
 ** </dd>
+**
+** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
+** <dd>This parameter returns the zero for the current value if and only if
+** there all foreign key constraints (deferred or immediate) have been
+** resolved.  The highwater mark is always 0.
+** </dd>
 ** </dl>
 ** </dl>
 */
 */
 #define SQLITE_DBSTATUS_LOOKASIDE_USED       0
 #define SQLITE_DBSTATUS_LOOKASIDE_USED       0
@@ -6280,7 +6298,8 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
 #define SQLITE_DBSTATUS_CACHE_HIT            7
 #define SQLITE_DBSTATUS_CACHE_HIT            7
 #define SQLITE_DBSTATUS_CACHE_MISS           8
 #define SQLITE_DBSTATUS_CACHE_MISS           8
 #define SQLITE_DBSTATUS_CACHE_WRITE          9
 #define SQLITE_DBSTATUS_CACHE_WRITE          9
-#define SQLITE_DBSTATUS_MAX                  9   /* Largest defined DBSTATUS */
+#define SQLITE_DBSTATUS_DEFERRED_FKS        10
+#define SQLITE_DBSTATUS_MAX                 10   /* Largest defined DBSTATUS */
 
 
 
 
 /*
 /*
@@ -6334,11 +6353,21 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
 ** A non-zero value in this counter may indicate an opportunity to
 ** A non-zero value in this counter may indicate an opportunity to
 ** improvement performance by adding permanent indices that do not
 ** improvement performance by adding permanent indices that do not
 ** need to be reinitialized each time the statement is run.</dd>
 ** need to be reinitialized each time the statement is run.</dd>
+**
+** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
+** <dd>^This is the number of virtual machine operations executed
+** by the prepared statement if that number is less than or equal
+** to 2147483647.  The number of virtual machine operations can be 
+** used as a proxy for the total work done by the prepared statement.
+** If the number of virtual machine operations exceeds 2147483647
+** then the value returned by this statement status code is undefined.
+** </dd>
 ** </dl>
 ** </dl>
 */
 */
 #define SQLITE_STMTSTATUS_FULLSCAN_STEP     1
 #define SQLITE_STMTSTATUS_FULLSCAN_STEP     1
 #define SQLITE_STMTSTATUS_SORT              2
 #define SQLITE_STMTSTATUS_SORT              2
 #define SQLITE_STMTSTATUS_AUTOINDEX         3
 #define SQLITE_STMTSTATUS_AUTOINDEX         3
+#define SQLITE_STMTSTATUS_VM_STEP           4
 
 
 /*
 /*
 ** CAPI3REF: Custom Page Cache Object
 ** CAPI3REF: Custom Page Cache Object

+ 3 - 0
SquiLu/include/squirrel.h

@@ -40,6 +40,9 @@ extern "C" {
 #endif
 #endif
 
 
 #ifdef _SQ64
 #ifdef _SQ64
+
+typedef short SQInt16;
+typedef unsigned short SQUnsignedInt16;
 
 
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 typedef __int64 SQInteger;
 typedef __int64 SQInteger;

+ 144 - 1
SquiLu/squilu.cbp

@@ -365,6 +365,80 @@
 					<Add directory="../fltk/lib" />
 					<Add directory="../fltk/lib" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
+			<Target title="Release 64bits">
+				<Option output="bin/squilu" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O3" />
+					<Add option="-Wall" />
+					<Add option="-DNDEBUG=1" />
+					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
+					<Add option="-D_SQ64=1" />
+					<Add option="-DCONFIG_64=1" />
+					<Add directory="../../zeromq-3.2.2/include" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add library="../../zeromq-3.2.2/libzmq3.a" />
+					<Add library="pthread" />
+					<Add library="rt" />
+					<Add library="dl" />
+					<Add library="axtls" />
+					<Add library="mpdecimal" />
+					<Add library="discount" />
+					<Add library="fltk_z" />
+					<Add directory="../../zeromq-3.2.2" />
+					<Add directory="../fltk/lib" />
+				</Linker>
+			</Target>
+			<Target title="Release FLTK 64bits">
+				<Option output="bin/squilu" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-fomit-frame-pointer" />
+					<Add option="-fexpensive-optimizations" />
+					<Add option="-O3" />
+					<Add option="-Wall" />
+					<Add option="-DWITH_FLTK=1" />
+					<Add option="-DNDEBUG=1" />
+					<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
+					<Add option="-DPROFILE_SQVM22=1" />
+					<Add option="-D_SQ64=1" />
+					<Add option="-DCONFIG_64=1" />
+					<Add directory="../../zeromq-3.2.2/include" />
+					<Add directory="../fltk" />
+					<Add directory="../libharu/include" />
+					<Add directory="../flu" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add library="../../zeromq-3.2.2/libzmq3.a" />
+					<Add library="pthread" />
+					<Add library="rt" />
+					<Add library="dl" />
+					<Add library="axtls" />
+					<Add library="fltkutils" />
+					<Add library="fltk_images" />
+					<Add library="fltk_png" />
+					<Add library="fltk_jpeg" />
+					<Add library="fltk_z" />
+					<Add library="fltk" />
+					<Add library="Xext" />
+					<Add library="Xft" />
+					<Add library="Xinerama" />
+					<Add library="mpdecimal" />
+					<Add library="hpdfs" />
+					<Add library="discount" />
+					<Add directory="../../zeromq-3.2.2" />
+					<Add directory="../fltk/lib" />
+					<Add directory="../flu" />
+					<Add directory="../libharu/src" />
+				</Linker>
+			</Target>
 		</Build>
 		</Build>
 		<Compiler>
 		<Compiler>
 			<Add option="-Wall" />
 			<Add option="-Wall" />
@@ -380,7 +454,6 @@
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDECIMAL642=1" />
 			<Add option="-DSQUSEDECIMAL642=1" />
 			<Add option="-DNO_EXCEPTION_KEY_NOT_FOUND0=1" />
 			<Add option="-DNO_EXCEPTION_KEY_NOT_FOUND0=1" />
-			<Add option="-D_SQ642=1" />
 			<Add option="-DNO_GARBAGE_COLLECTOR00=1" />
 			<Add option="-DNO_GARBAGE_COLLECTOR00=1" />
 			<Add option="-DTHREADSAFE=1" />
 			<Add option="-DTHREADSAFE=1" />
 			<Add option="-DSQLITE_DEFAULT_FILE_FORMAT=4" />
 			<Add option="-DSQLITE_DEFAULT_FILE_FORMAT=4" />
@@ -450,6 +523,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/dynamic_library.h">
 		<Unit filename="../SquiLu-ext/dynamic_library.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -461,6 +536,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/fpdf.cpp">
 		<Unit filename="../SquiLu-ext/fpdf.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -472,6 +549,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/fpdf.h">
 		<Unit filename="../SquiLu-ext/fpdf.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -483,6 +562,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/lua_socket.cpp">
 		<Unit filename="../SquiLu-ext/lua_socket.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -494,6 +575,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/lua_socket.h">
 		<Unit filename="../SquiLu-ext/lua_socket.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -505,6 +588,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/mongoose.c">
 		<Unit filename="../SquiLu-ext/mongoose.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -517,6 +602,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/mongoose.h">
 		<Unit filename="../SquiLu-ext/mongoose.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -528,6 +615,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/pdf-font.cpp">
 		<Unit filename="../SquiLu-ext/pdf-font.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -539,6 +628,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/pdf-font.h">
 		<Unit filename="../SquiLu-ext/pdf-font.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -550,6 +641,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_axtls.c">
 		<Unit filename="../SquiLu-ext/sq_axtls.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -562,6 +655,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_base64.cpp">
 		<Unit filename="../SquiLu-ext/sq_base64.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -573,6 +668,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_decimal.cpp">
 		<Unit filename="../SquiLu-ext/sq_decimal.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -583,6 +680,8 @@
 			<Option target="Debug FLTK" />
 			<Option target="Debug FLTK" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fltk.cpp">
 		<Unit filename="../SquiLu-ext/sq_fltk.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -594,6 +693,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fpdf.cpp">
 		<Unit filename="../SquiLu-ext/sq_fpdf.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -605,6 +706,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -617,6 +720,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_markdown.cpp">
 		<Unit filename="../SquiLu-ext/sq_markdown.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -627,6 +732,8 @@
 			<Option target="Debug FLTK" />
 			<Option target="Debug FLTK" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_mix.cpp">
 		<Unit filename="../SquiLu-ext/sq_mix.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -638,6 +745,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_mongoose.cpp">
 		<Unit filename="../SquiLu-ext/sq_mongoose.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -649,6 +758,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_mysql.cpp" />
 		<Unit filename="../SquiLu-ext/sq_mysql.cpp" />
 		<Unit filename="../SquiLu-ext/sq_parsecsv.cpp">
 		<Unit filename="../SquiLu-ext/sq_parsecsv.cpp">
@@ -660,6 +771,8 @@
 			<Option target="Debug FLTK" />
 			<Option target="Debug FLTK" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_postgresql.cpp">
 		<Unit filename="../SquiLu-ext/sq_postgresql.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -670,6 +783,8 @@
 			<Option target="Debug FLTK" />
 			<Option target="Debug FLTK" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_rs232.c">
 		<Unit filename="../SquiLu-ext/sq_rs232.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -682,6 +797,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_slave_vm.cpp">
 		<Unit filename="../SquiLu-ext/sq_slave_vm.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -693,6 +810,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_socket.cpp">
 		<Unit filename="../SquiLu-ext/sq_socket.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -704,6 +823,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp">
 		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -715,6 +836,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp">
 		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -726,6 +849,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_zlib.cpp">
 		<Unit filename="../SquiLu-ext/sq_zlib.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -737,6 +862,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sq_zmq3.cpp">
 		<Unit filename="../SquiLu-ext/sq_zmq3.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -747,6 +874,8 @@
 			<Option target="Debug FLTK" />
 			<Option target="Debug FLTK" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -759,6 +888,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sqlite3.h">
 		<Unit filename="../SquiLu-ext/sqlite3.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -770,6 +901,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sqmodule.h">
 		<Unit filename="../SquiLu-ext/sqmodule.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -781,6 +914,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sqratimport.cpp">
 		<Unit filename="../SquiLu-ext/sqratimport.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -792,6 +927,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/sqratimport.h">
 		<Unit filename="../SquiLu-ext/sqratimport.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -803,6 +940,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/tinyxml2.cpp">
 		<Unit filename="../SquiLu-ext/tinyxml2.cpp">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -814,6 +953,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu-ext/tinyxml2.h">
 		<Unit filename="../SquiLu-ext/tinyxml2.h">
 			<Option target="Debug" />
 			<Option target="Debug" />
@@ -825,6 +966,8 @@
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release FLTK win32 no console" />
 			<Option target="Release wince" />
 			<Option target="Release wince" />
+			<Option target="Release 64bits" />
+			<Option target="Release FLTK 64bits" />
 		</Unit>
 		</Unit>
 		<Unit filename="dadbiz.rc">
 		<Unit filename="dadbiz.rc">
 			<Option compilerVar="WINDRES" />
 			<Option compilerVar="WINDRES" />

+ 34 - 34
discount/blocktags

@@ -1,34 +1,34 @@
-static struct kw blocktags[] = {
-   { "P", 1, 0 },
-   { "BR", 2, 1 },
-   { "DL", 2, 0 },
-   { "H1", 2, 0 },
-   { "H2", 2, 0 },
-   { "H3", 2, 0 },
-   { "H4", 2, 0 },
-   { "H5", 2, 0 },
-   { "H6", 2, 0 },
-   { "HR", 2, 1 },
-   { "OL", 2, 0 },
-   { "UL", 2, 0 },
-   { "BDO", 3, 0 },
-   { "DFN", 3, 0 },
-   { "DIV", 3, 0 },
-   { "MAP", 3, 0 },
-   { "PRE", 3, 0 },
-   { "WBR", 3, 0 },
-   { "XMP", 3, 0 },
-   { "NOBR", 4, 0 },
-   { "STYLE", 5, 0 },
-   { "TABLE", 5, 0 },
-   { "CENTER", 6, 0 },
-   { "IFRAME", 6, 0 },
-   { "OBJECT", 6, 0 },
-   { "SCRIPT", 6, 0 },
-   { "ADDRESS", 7, 0 },
-   { "LISTING", 7, 0 },
-   { "PLAINTEXT", 9, 0 },
-   { "BLOCKQUOTE", 10, 0 },
-};
-
-#define NR_blocktags 30
+static struct kw blocktags[] = {
+   { "P", 1, 0 },
+   { "BR", 2, 1 },
+   { "DL", 2, 0 },
+   { "H1", 2, 0 },
+   { "H2", 2, 0 },
+   { "H3", 2, 0 },
+   { "H4", 2, 0 },
+   { "H5", 2, 0 },
+   { "H6", 2, 0 },
+   { "HR", 2, 1 },
+   { "OL", 2, 0 },
+   { "UL", 2, 0 },
+   { "BDO", 3, 0 },
+   { "DFN", 3, 0 },
+   { "DIV", 3, 0 },
+   { "MAP", 3, 0 },
+   { "PRE", 3, 0 },
+   { "WBR", 3, 0 },
+   { "XMP", 3, 0 },
+   { "NOBR", 4, 0 },
+   { "STYLE", 5, 0 },
+   { "TABLE", 5, 0 },
+   { "CENTER", 6, 0 },
+   { "IFRAME", 6, 0 },
+   { "OBJECT", 6, 0 },
+   { "SCRIPT", 6, 0 },
+   { "ADDRESS", 7, 0 },
+   { "LISTING", 7, 0 },
+   { "PLAINTEXT", 9, 0 },
+   { "BLOCKQUOTE", 10, 0 },
+};
+
+#define NR_blocktags 30

+ 10 - 10
fltk/config-linux.h

@@ -10,7 +10,7 @@
  * This library is free software. Distribution and use rights are outlined in
  * This library is free software. Distribution and use rights are outlined in
  * the file "COPYING" which should have been included with this file.  If this
  * the file "COPYING" which should have been included with this file.  If this
  * file is missing or damaged, see the license at:
  * file is missing or damaged, see the license at:
- * 
+ *
  *     http://www.fltk.org/COPYING.php
  *     http://www.fltk.org/COPYING.php
  *
  *
  * Please report all bugs and problems on the following page:
  * Please report all bugs and problems on the following page:
@@ -112,7 +112,7 @@
  * __APPLE_QUARTZ__:
  * __APPLE_QUARTZ__:
  *
  *
  * All Apple implementations are now based on Quartz and Cocoa,
  * All Apple implementations are now based on Quartz and Cocoa,
- * so this flag should always be on for Mac OS X. This flag has 
+ * so this flag should always be on for Mac OS X. This flag has
  * no meaning on operating systems other than Mac OS X.
  * no meaning on operating systems other than Mac OS X.
  */
  */
 
 
@@ -153,7 +153,7 @@
  *
  *
  * Byte order of your machine: 1 = big-endian, 0 = little-endian.
  * Byte order of your machine: 1 = big-endian, 0 = little-endian.
  */
  */
- 
+
 #ifdef __APPLE__
 #ifdef __APPLE__
 #include <mac_endianness.h>
 #include <mac_endianness.h>
 #else
 #else
@@ -236,9 +236,9 @@
  * Do we have various image libraries?
  * Do we have various image libraries?
  */
  */
 
 
-#undef HAVE_LIBPNG
-#undef HAVE_LIBZ
-#undef HAVE_LIBJPEG
+#define HAVE_LIBPNG 1
+#define HAVE_LIBZ 1
+#define HAVE_LIBJPEG 1
 
 
 /*
 /*
  * FLTK_USE_CAIRO
  * FLTK_USE_CAIRO
@@ -261,15 +261,15 @@
  * Which header file do we include for libpng?
  * Which header file do we include for libpng?
  */
  */
 
 
-#undef HAVE_PNG_H
-#undef HAVE_LIBPNG_PNG_H
+#define HAVE_PNG_H 1
+/* #undef HAVE_LIBPNG_PNG_H */
 
 
 /*
 /*
  * Do we have the png_xyz() functions?
  * Do we have the png_xyz() functions?
  */
  */
 
 
-#undef HAVE_PNG_GET_VALID
-#undef HAVE_PNG_SET_TRNS_TO_ALPHA
+#define HAVE_PNG_GET_VALID 1
+#define HAVE_PNG_SET_TRNS_TO_ALPHA 1
 
 
 /*
 /*
  * Do we have POSIX threading?
  * Do we have POSIX threading?

+ 5 - 320
fltk/config.h

@@ -1,320 +1,5 @@
-/* config.h.  Generated from configh.in by configure.  */
-/*
- * "$Id: configh.in 8864 2011-07-19 04:49:30Z greg.ercolano $"
- *
- * Configuration file for the Fast Light Tool Kit (FLTK).
- * @configure_input@
- *
- * Copyright 1998-2010 by Bill Spitzak and others.
- *
- * This library is free software. Distribution and use rights are outlined in
- * the file "COPYING" which should have been included with this file.  If this
- * file is missing or damaged, see the license at:
- * 
- *     http://www.fltk.org/COPYING.php
- *
- * Please report all bugs and problems on the following page:
- *
- *     http://www.fltk.org/str.php
- */
-
-/*
- * Where to find files...
- */
-
-#define FLTK_DATADIR "/usr/local/share/fltk"
-#define FLTK_DOCDIR "/usr/local/share/doc/fltk"
-
-/*
- * BORDER_WIDTH:
- *
- * Thickness of FL_UP_BOX and FL_DOWN_BOX.  Current 1,2, and 3 are
- * supported.
- *
- * 3 is the historic FLTK look.
- * 2 is the default and looks like Microsoft Windows, KDE, and Qt.
- * 1 is a plausible future evolution...
- *
- * Note that this may be simulated at runtime by redefining the boxtypes
- * using Fl::set_boxtype().
- */
-
-#define BORDER_WIDTH 2
-
-/*
- * HAVE_GL:
- *
- * Do you have OpenGL? Set this to 0 if you don't have or plan to use
- * OpenGL, and FLTK will be smaller.
- */
-
-#define HAVE_GL 1
-
-/*
- * HAVE_GL_GLU_H:
- *
- * Do you have the OpenGL Utility Library header file?
- * (many broken Mesa RPMs do not...)
- */
-
-#undef HAVE_GL_GLU_H
-
-/*
- * HAVE_GLXGETPROCADDRESSARB:
- *
- * Do you have the OpenGL glXGetProcAddressARB() function?
- */
-
-#undef HAVE_GLXGETPROCADDRESSARB
-
-/*
- * USE_COLORMAP:
- *
- * Setting this to zero will save a good deal of code (especially for
- * fl_draw_image), but FLTK will only work on TrueColor visuals.
- */
-
-#define USE_COLORMAP 1
-
-/*
- * HAVE_XINERAMA
- *
- * Do we have the Xinerama library to support multi-head displays?
- */
-
-#define HAVE_XINERAMA 1
-
-/*
- * USE_XFT
- *
- * Use the new Xft library to draw anti-aliased text.
- */
-
-#define USE_XFT 1
-
-/*
- * HAVE_XDBE:
- *
- * Do we have the X double-buffer extension?
- */
-
-#define HAVE_XDBE 1
-
-/*
- * USE_XDBE:
- *
- * Actually try to use the double-buffer extension?
- */
-
-#define USE_XDBE HAVE_XDBE
-
-/*
- * __APPLE_QUARTZ__:
- *
- * All Apple implementations are now based on Quartz and Cocoa,
- * so this flag should always be on for Mac OS X. This flag has 
- * no meaning on operating systems other than Mac OS X.
- */
-
-#undef __APPLE_QUARTZ__
-
-
-/*
- * USE_X11
- *
- * Should we use X11 for the current platform
- *
- */
-
-#define USE_X11 1
-
-/*
- * HAVE_OVERLAY:
- *
- * Use the X overlay extension?  FLTK will try to use an overlay
- * visual for Fl_Overlay_Window, the Gl_Window overlay, and for the
- * menus.  Setting this to zero will remove a substantial amount of
- * code from FLTK.  Overlays have only been tested on SGI servers!
- */
-
-#define HAVE_OVERLAY 0
-
-/*
- * HAVE_GL_OVERLAY:
- *
- * It is possible your GL has an overlay even if X does not.  If so,
- * set this to 1.
- */
-
-#define HAVE_GL_OVERLAY HAVE_OVERLAY
-
-/*
- * WORDS_BIGENDIAN:
- *
- * Byte order of your machine: 1 = big-endian, 0 = little-endian.
- */
- 
-#ifdef __APPLE__
-#include <mac_endianness.h>
-#else
-#define WORDS_BIGENDIAN 0
-#endif
-
-/*
- * U16, U32, U64:
- *
- * Types used by fl_draw_image.  One of U32 or U64 must be defined.
- * U16 is optional but FLTK will work better with it!
- */
-
-#define U16 unsigned short
-#define U32 unsigned
-/* #undef U64 */
-
-/*
- * HAVE_DIRENT_H, HAVE_SYS_NDIR_H, HAVE_SYS_DIR_H, HAVE_NDIR_H,
- * HAVE_SCANDIR, HAVE_SCANDIR_POSIX:
- *
- * Where is <dirent.h> (used only by fl_file_chooser and scandir).
- */
-
-#define HAVE_DIRENT_H 1
-/* #undef HAVE_SYS_NDIR_H */
-/* #undef HAVE_SYS_DIR_H */
-/* #undef HAVE_NDIR_H */
-#define HAVE_SCANDIR 1
-#define HAVE_SCANDIR_POSIX 1
-
-/*
- * Possibly missing sprintf-style functions:
- */
-
-#define HAVE_VSNPRINTF 1
-#define HAVE_SNPRINTF 1
-
-/*
- * String functions and headers...
- */
-
-#define HAVE_STRINGS_H 1
-#define HAVE_STRCASECMP 1
-/* #undef HAVE_STRLCAT */
-/* #undef HAVE_STRLCPY */
-
-/*
- * Do we have POSIX locale support?
- */
-
-#define HAVE_LOCALE_H 1
-#define HAVE_LOCALECONV 1
-
-/*
- * HAVE_SYS_SELECT_H:
- *
- * Whether or not select() call has its own header file.
- */
-
-#define HAVE_SYS_SELECT_H 1
-
-/*
- * HAVE_SYS_STDTYPES_H:
- *
- * Whether or not we have the <sys/stdtypes.h> header file.
- */
-
-/* #define HAVE_SYS_STDTYPES_H 1 */
-
-/*
- * USE_POLL:
- *
- * Use the poll() call provided on Linux and Irix instead of select()
- */
-
-#define USE_POLL 0
-
-/*
- * Do we have various image libraries?
- */
-
-#define HAVE_LIBPNG 1
-#define HAVE_LIBZ 1
-#define HAVE_LIBJPEG 1
-
-/*
- * FLTK_USE_CAIRO
- *
- * Do we have the cairo library available and want extended cairo use in fltk ?
- * will implies to link cairo.lib in all fltk based apps.
- */
-
-#undef FLTK_USE_CAIRO
-
-/*
- * FLTK_HAVE_CAIRO
- *
- * Do we have the cairo library available?
- */
-
-#undef FLTK_HAVE_CAIRO
-
-/*
- * Which header file do we include for libpng?
- */
-
-#define HAVE_PNG_H 1
-/* #undef HAVE_LIBPNG_PNG_H */
-
-/*
- * Do we have the png_xyz() functions?
- */
-
-#define HAVE_PNG_GET_VALID 1
-#define HAVE_PNG_SET_TRNS_TO_ALPHA 1
-
-/*
- * Do we have POSIX threading?
- */
-
-#define HAVE_PTHREAD 1
-#define HAVE_PTHREAD_H 1
-
-/*
- * Do we have the ALSA library?
- */
-
-#undef HAVE_ALSA_ASOUNDLIB_H
-
-/*
- * Do we have the long long type?
- */
-
-#define HAVE_LONG_LONG 1
-
-#ifdef HAVE_LONG_LONG
-#  define FLTK_LLFMT	"%lld"
-#  define FLTK_LLCAST	(long long)
-#else
-#  define FLTK_LLFMT	"%ld"
-#  define FLTK_LLCAST	(long)
-#endif /* HAVE_LONG_LONG */
-
-/*
- * Do we have the strtoll() function?
- */
-
-#define HAVE_STRTOLL 1
-
-#ifndef HAVE_STRTOLL
-#  define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
-#endif /* !HAVE_STRTOLL */
-
-/*
- * Do we have the dlsym() function and header?
- */
-
-#define HAVE_DLFCN_H 1
-#define HAVE_DLSYM 1
-
-/*
- * End of "$Id: configh.in 8864 2011-07-19 04:49:30Z greg.ercolano $".
- */
+#ifdef WIN32
+#include "config-mingw.h"
+#else
+#include "config-linux.h"
+#endif // _WIN32

+ 0 - 1
fltk/fluid/fluid.cbp

@@ -36,7 +36,6 @@
 				</Compiler>
 				</Compiler>
 				<Linker>
 				<Linker>
 					<Add option="-s" />
 					<Add option="-s" />
-					<Add library="sqlite3" />
 					<Add library="pthread" />
 					<Add library="pthread" />
 					<Add library="dl" />
 					<Add library="dl" />
 					<Add library="X11" />
 					<Add library="X11" />

+ 0 - 1
fltk/fluid/luacpp.h

@@ -12,7 +12,6 @@ extern "C"
 #include <lua.h>
 #include <lua.h>
 #include <lauxlib.h>
 #include <lauxlib.h>
 #include <lualib.h>
 #include <lualib.h>
-
 }
 }
 
 
 /**
 /**

+ 21 - 21
fltk/src/Fl_x.cxx

@@ -688,7 +688,7 @@ static void fl_init_workarea() {
   int format;
   int format;
   unsigned *xywh;
   unsigned *xywh;
 
 
-  /* If there are several screens, the _NET_WORKAREA property 
+  /* If there are several screens, the _NET_WORKAREA property
    does not give the work area of the main screen, but that of all screens together.
    does not give the work area of the main screen, but that of all screens together.
    Therefore, we use this property only when there is a single screen,
    Therefore, we use this property only when there is a single screen,
    and fall back to the main screen full area when there are several screens.
    and fall back to the main screen full area when there are several screens.
@@ -699,9 +699,9 @@ static void fl_init_workarea() {
                          (unsigned char **)&xywh) || !xywh || !xywh[2] ||
                          (unsigned char **)&xywh) || !xywh || !xywh[2] ||
                          !xywh[3])
                          !xywh[3])
   {
   {
-    Fl::screen_xywh(fl_workarea_xywh[0], 
-		    fl_workarea_xywh[1], 
-		    fl_workarea_xywh[2], 
+    Fl::screen_xywh(fl_workarea_xywh[0],
+		    fl_workarea_xywh[1],
+		    fl_workarea_xywh[2],
 		    fl_workarea_xywh[3], 0);
 		    fl_workarea_xywh[3], 0);
   }
   }
   else
   else
@@ -798,8 +798,8 @@ void fl_sendClientMessage(Window window, Atom message,
 }
 }
 
 
 
 
-/* 
-   Get window property value (32 bit format) 
+/*
+   Get window property value (32 bit format)
    Returns zero on success, -1 on error
    Returns zero on success, -1 on error
 */
 */
 static int get_xwinprop(Window wnd, Atom prop, long max_length,
 static int get_xwinprop(Window wnd, Atom prop, long max_length,
@@ -807,9 +807,9 @@ static int get_xwinprop(Window wnd, Atom prop, long max_length,
   Atom actual;
   Atom actual;
   int format;
   int format;
   unsigned long bytes_after;
   unsigned long bytes_after;
-  
-  if (Success != XGetWindowProperty(fl_display, wnd, prop, 0, max_length, 
-                                    False, AnyPropertyType, &actual, &format, 
+
+  if (Success != XGetWindowProperty(fl_display, wnd, prop, 0, max_length,
+                                    False, AnyPropertyType, &actual, &format,
                                     nitems, &bytes_after, (unsigned char**)data)) {
                                     nitems, &bytes_after, (unsigned char**)data)) {
     return -1;
     return -1;
   }
   }
@@ -979,7 +979,7 @@ int fl_handle(const XEvent& thisevent)
   if ( XFilterEvent((XEvent *)&xevent, 0) )
   if ( XFilterEvent((XEvent *)&xevent, 0) )
       return(1);
       return(1);
 
 
-#if USE_XRANDR  
+#if USE_XRANDR
   if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) {
   if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) {
     XRRUpdateConfiguration_f(&xevent);
     XRRUpdateConfiguration_f(&xevent);
     Fl::call_screen_init();
     Fl::call_screen_init();
@@ -987,11 +987,11 @@ int fl_handle(const XEvent& thisevent)
     Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
     Fl::handle(FL_SCREEN_CONFIGURATION_CHANGED, NULL);
   }
   }
 #endif
 #endif
-  
+
   if (xevent.type == PropertyNotify && xevent.xproperty.atom == fl_NET_WORKAREA) {
   if (xevent.type == PropertyNotify && xevent.xproperty.atom == fl_NET_WORKAREA) {
     fl_init_workarea();
     fl_init_workarea();
   }
   }
-  
+
   switch (xevent.type) {
   switch (xevent.type) {
 
 
   case KeymapNotify:
   case KeymapNotify:
@@ -1536,7 +1536,7 @@ int fl_handle(const XEvent& thisevent)
       if (xevent.xproperty.state != PropertyDelete) {
       if (xevent.xproperty.state != PropertyDelete) {
         unsigned long nitems;
         unsigned long nitems;
         unsigned long *words = 0;
         unsigned long *words = 0;
-        if (0 == get_xwinprop(xid, fl_NET_WM_STATE, 64, &nitems, &words) ) { 
+        if (0 == get_xwinprop(xid, fl_NET_WM_STATE, 64, &nitems, &words) ) {
           for (unsigned long item = 0; item < nitems; item++) {
           for (unsigned long item = 0; item < nitems; item++) {
             if (words[item] == fl_NET_WM_STATE_FULLSCREEN) {
             if (words[item] == fl_NET_WM_STATE_FULLSCREEN) {
               fullscreen_state = 1;
               fullscreen_state = 1;
@@ -1871,8 +1871,8 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
   }
   }
   // For the non-EWMH fullscreen case, we cannot use the code above,
   // For the non-EWMH fullscreen case, we cannot use the code above,
   // since we do not want save_under, do not want to turn off the
   // since we do not want save_under, do not want to turn off the
-  // border, and cannot grab without an existing window. Besides, 
-  // there is no clear_override(). 
+  // border, and cannot grab without an existing window. Besides,
+  // there is no clear_override().
   if (win->fullscreen_active() && !Fl_X::ewmh_supported()) {
   if (win->fullscreen_active() && !Fl_X::ewmh_supported()) {
     attr.override_redirect = 1;
     attr.override_redirect = 1;
     mask |= CWOverrideRedirect;
     mask |= CWOverrideRedirect;
@@ -2168,11 +2168,11 @@ static void decorated_win_size(Fl_Window *win, int &w, int &h)
   if (!win->shown() || win->parent() || !win->border() || !win->visible()) return;
   if (!win->shown() || win->parent() || !win->border() || !win->visible()) return;
   Window root, parent, *children;
   Window root, parent, *children;
   unsigned n = 0;
   unsigned n = 0;
-  Status status = XQueryTree(fl_display, Fl_X::i(win)->xid, &root, &parent, &children, &n); 
+  Status status = XQueryTree(fl_display, Fl_X::i(win)->xid, &root, &parent, &children, &n);
   if (status != 0 && n) XFree(children);
   if (status != 0 && n) XFree(children);
-  // when compiz is used, root and parent are the same window 
+  // when compiz is used, root and parent are the same window
   // and I don't know where to find the window decoration
   // and I don't know where to find the window decoration
-  if (status == 0 || root == parent) return; 
+  if (status == 0 || root == parent) return;
   XWindowAttributes attributes;
   XWindowAttributes attributes;
   XGetWindowAttributes(fl_display, parent, &attributes);
   XGetWindowAttributes(fl_display, parent, &attributes);
   w = attributes.width;
   w = attributes.width;
@@ -2207,12 +2207,12 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
   unsigned n = 0;
   unsigned n = 0;
   int bx, bt, do_it;
   int bx, bt, do_it;
   from = fl_window;
   from = fl_window;
-  do_it = (XQueryTree(fl_display, fl_window, &root, &parent, &children, &n) != 0 && 
+  do_it = (XQueryTree(fl_display, fl_window, &root, &parent, &children, &n) != 0 &&
 	   XTranslateCoordinates(fl_display, fl_window, parent, 0, 0, &bx, &bt, &child_win) == True);
 	   XTranslateCoordinates(fl_display, fl_window, parent, 0, 0, &bx, &bt, &child_win) == True);
   if (n) XFree(children);
   if (n) XFree(children);
-  // hack to bypass STR #2648: when compiz is used, root and parent are the same window 
+  // hack to bypass STR #2648: when compiz is used, root and parent are the same window
   // and I don't know where to find the window decoration
   // and I don't know where to find the window decoration
-  if (do_it && root == parent) do_it = 0; 
+  if (do_it && root == parent) do_it = 0;
   if (!do_it) {
   if (!do_it) {
     this->set_current();
     this->set_current();
     this->print_widget(win, x_offset, y_offset);
     this->print_widget(win, x_offset, y_offset);

+ 1 - 1
flu/FLU/Flu_Tree_Browser.H

@@ -1087,7 +1087,7 @@ class FLU_EXPORT Flu_Tree_Browser : public Fl_Group
       //! Remove the entry identified by path \b fullpath from this node
       //! Remove the entry identified by path \b fullpath from this node
       /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */
       /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */
       inline unsigned int remove( const char *fullpath )
       inline unsigned int remove( const char *fullpath )
-	{ return( (unsigned int)modify( fullpath, REMOVE, tree->rdata ) ); }
+	{ return( (ptrdiff_t)modify( fullpath, REMOVE, tree->rdata ) ); }
 
 
       //! Remove the entry identified by unique id \b id from this node
       //! Remove the entry identified by unique id \b id from this node
       /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */
       /*! \return the unique id of the removed entry, or \c 0 if no matching entry was found */

+ 1 - 1
flu/src/FSocket_Posix.H

@@ -53,7 +53,7 @@ class FSocket_Posix : public FSocket {
   // Directory for Unix Domain socket files. This directory should be
   // Directory for Unix Domain socket files. This directory should be
   // either empty or be terminated with "/". Dafault value is "/tmp/"
   // either empty or be terminated with "/". Dafault value is "/tmp/"
   //
   //
-  static char* unix_socket_dir;
+  static const char* unix_socket_dir;
 
 
   int open(int listen_queue_size);
   int open(int listen_queue_size);
   int connect(int max_attempts, time_t timeout);
   int connect(int max_attempts, time_t timeout);

+ 142 - 142
flu/src/FSocket_Posix.cxx

@@ -2,7 +2,7 @@
 
 
 #if defined(__svr4__)
 #if defined(__svr4__)
 #define mutex system_mutex
 #define mutex system_mutex
-#endif 
+#endif
 
 
 #if defined(__FreeBSD__) || defined(__linux__) || defined(__CYGWIN__)
 #if defined(__FreeBSD__) || defined(__linux__) || defined(__CYGWIN__)
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
@@ -38,12 +38,12 @@ extern "C" {
 
 
 #define MAX_HOST_NAME     256
 #define MAX_HOST_NAME     256
 
 
-char* FSocket_Posix::unix_socket_dir = "/tmp/";
+const char* FSocket_Posix::unix_socket_dir = "/tmp/";
 
 
-class FSocket_Posix_library { 
- public: 
-  FSocket_Posix_library() { 
-    static struct sigaction sigpipe_ignore; 
+class FSocket_Posix_library {
+ public:
+  FSocket_Posix_library() {
+    static struct sigaction sigpipe_ignore;
     sigpipe_ignore.sa_handler = SIG_IGN;
     sigpipe_ignore.sa_handler = SIG_IGN;
     sigaction(SIGPIPE, &sigpipe_ignore, NULL);
     sigaction(SIGPIPE, &sigpipe_ignore, NULL);
   }
   }
@@ -55,45 +55,45 @@ int FSocket_Posix::open(int listen_queue_size) {
   char hostname[MAX_HOST_NAME];
   char hostname[MAX_HOST_NAME];
   unsigned short port;
   unsigned short port;
   char* p;
   char* p;
-  
+
   assert(address != NULL);
   assert(address != NULL);
-  
-  if ((p = strchr(address, ':')) == NULL 
-      || unsigned(p - address) >= sizeof(hostname) 
+
+  if ((p = strchr(address, ':')) == NULL
+      || unsigned(p - address) >= sizeof(hostname)
       || sscanf(p+1, "%hd", &port) != 1)  {
       || sscanf(p+1, "%hd", &port) != 1)  {
     errcode = bad_address;
     errcode = bad_address;
     return 0;
     return 0;
   }
   }
   memcpy(hostname, address, p - address);
   memcpy(hostname, address, p - address);
   hostname[p - address] = '\0';
   hostname[p - address] = '\0';
-  
-  create_file = 0; 
 
 
-  union { 
+  create_file = 0;
+
+  union {
     sockaddr    sock;
     sockaddr    sock;
     sockaddr_in sock_inet;
     sockaddr_in sock_inet;
     //char        name[MAX_HOST_NAME];
     //char        name[MAX_HOST_NAME];
   } u;
   } u;
   int sa_length;
   int sa_length;
-  
-  if (domain == sock_local_domain) { 
+
+  if (domain == sock_local_domain) {
     u.sock.sa_family = AF_UNIX;
     u.sock.sa_family = AF_UNIX;
-    
-    assert(strlen(unix_socket_dir) + strlen(address) 
-	   < MAX_HOST_NAME - offsetof(sockaddr,sa_data)); 
-    
-    sa_length = offsetof(sockaddr,sa_data) + 
+
+    assert(strlen(unix_socket_dir) + strlen(address)
+	   < MAX_HOST_NAME - offsetof(sockaddr,sa_data));
+
+    sa_length = offsetof(sockaddr,sa_data) +
       sprintf(u.sock.sa_data,"%s%s", unix_socket_dir, address);
       sprintf(u.sock.sa_data,"%s%s", unix_socket_dir, address);
-    
+
     unlink(u.sock.sa_data); // remove file if existed
     unlink(u.sock.sa_data); // remove file if existed
-    create_file = 1; 
+    create_file = 1;
   } else {
   } else {
     u.sock_inet.sin_family= AF_INET;
     u.sock_inet.sin_family= AF_INET;
     u.sock_inet.sin_addr.s_addr = htonl(INADDR_ANY);
     u.sock_inet.sin_addr.s_addr = htonl(INADDR_ANY);
     u.sock_inet.sin_port = htons(port);
     u.sock_inet.sin_port = htons(port);
-    sa_length = sizeof(sockaddr_in);	
-  } 
-  if ((fd = socket(u.sock.sa_family, SOCK_STREAM, 0)) < 0) { 
+    sa_length = sizeof(sockaddr_in);
+  }
+  if ((fd = socket(u.sock.sa_family, SOCK_STREAM, 0)) < 0) {
     errcode = errno;
     errcode = errno;
     return 0;
     return 0;
   }
   }
@@ -117,27 +117,27 @@ int  FSocket_Posix::valid() {
 }
 }
 
 
 void FSocket_Posix::get_error_text(char* buf, size_t buf_size) {
 void FSocket_Posix::get_error_text(char* buf, size_t buf_size) {
-  char* msg; 
-  switch(errcode) { 
+  const char* msg;
+  switch(errcode) {
    case ok:
    case ok:
     msg = "ok";
     msg = "ok";
     break;
     break;
    case not_opened:
    case not_opened:
     msg = "socket not opened";
     msg = "socket not opened";
     break;
     break;
-   case bad_address: 
+   case bad_address:
     msg = "bad address";
     msg = "bad address";
     break;
     break;
-   case connection_failed: 
+   case connection_failed:
     msg = "exceed limit of attempts of connection to server";
     msg = "exceed limit of attempts of connection to server";
     break;
     break;
    case broken_pipe:
    case broken_pipe:
     msg = "connection is broken";
     msg = "connection is broken";
-    break; 
+    break;
    case invalid_access_mode:
    case invalid_access_mode:
     msg = "invalid access mode";
     msg = "invalid access mode";
     break;
     break;
-   default: 
+   default:
     msg = strerror(errcode);
     msg = strerror(errcode);
   }
   }
   strncpy(buf, msg, buf_size);
   strncpy(buf, msg, buf_size);
@@ -146,38 +146,38 @@ void FSocket_Posix::get_error_text(char* buf, size_t buf_size) {
 
 
 FSocket* FSocket_Posix::accept() {
 FSocket* FSocket_Posix::accept() {
   int s;
   int s;
-  
-  if (state != ss_open) { 
+
+  if (state != ss_open) {
     errcode = not_opened;
     errcode = not_opened;
     return NULL;
     return NULL;
   }
   }
-  
+
   while((s = ::accept(fd, NULL, NULL )) < 0 && errno == EINTR);
   while((s = ::accept(fd, NULL, NULL )) < 0 && errno == EINTR);
-  
-  if (s < 0) { 
+
+  if (s < 0) {
     errcode = errno;
     errcode = errno;
     return NULL;
     return NULL;
   } else if (state != ss_open) {
   } else if (state != ss_open) {
     errcode = not_opened;
     errcode = not_opened;
     return NULL;
     return NULL;
-  } else { 
+  } else {
     static struct linger l = {1, LINGER_TIME};
     static struct linger l = {1, LINGER_TIME};
-    if (domain == sock_global_domain) { 
+    if (domain == sock_global_domain) {
       int enabled = 1;
       int enabled = 1;
-      if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&enabled, 
+      if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&enabled,
 		     sizeof enabled) != 0) {
 		     sizeof enabled) != 0) {
 	errcode = errno;
 	errcode = errno;
-	::close(s);	
+	::close(s);
 	return NULL;
 	return NULL;
       }
       }
     }
     }
-    if (setsockopt(s, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof l) != 0) { 
-      errcode = invalid_access_mode; 
+    if (setsockopt(s, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof l) != 0) {
+      errcode = invalid_access_mode;
       ::close(s);
       ::close(s);
-      return NULL; 
+      return NULL;
     }
     }
     errcode = ok;
     errcode = ok;
-    return new FSocket_Posix(s); 
+    return new FSocket_Posix(s);
   }
   }
 }
 }
 
 
@@ -186,7 +186,7 @@ int FSocket_Posix::cancel_accept()  {
   state = ss_shutdown;
   state = ss_shutdown;
   delete FSocket::connect(address, domain, 1, 0);
   delete FSocket::connect(address, domain, 1, 0);
   return 1;
   return 1;
-}    
+}
 
 
 
 
 int FSocket_Posix::connect(int max_attempts, time_t timeout) {
 int FSocket_Posix::connect(int max_attempts, time_t timeout) {
@@ -194,12 +194,12 @@ int FSocket_Posix::connect(int max_attempts, time_t timeout) {
   char* p;
   char* p;
   char hostname[MAX_HOST_NAME];
   char hostname[MAX_HOST_NAME];
   unsigned short port;
   unsigned short port;
-  
+
   assert(address != NULL);
   assert(address != NULL);
-  
-  if (domain != sock_local_domain) { 
-    if ((p = strchr(address, ':')) == NULL 
-	|| unsigned(p - address) >= sizeof(hostname) 
+
+  if (domain != sock_local_domain) {
+    if ((p = strchr(address, ':')) == NULL
+	|| unsigned(p - address) >= sizeof(hostname)
 	|| sscanf(p+1, "%hd", &port) != 1) {
 	|| sscanf(p+1, "%hd", &port) != 1) {
       errcode = bad_address;
       errcode = bad_address;
       return 0;
       return 0;
@@ -207,33 +207,33 @@ int FSocket_Posix::connect(int max_attempts, time_t timeout) {
     memcpy(hostname, address, p - address);
     memcpy(hostname, address, p - address);
     hostname[p - address] = '\0';
     hostname[p - address] = '\0';
   }
   }
-  create_file = 0; 
-  
-  union { 
+  create_file = 0;
+
+  union {
     sockaddr    sock;
     sockaddr    sock;
     sockaddr_in sock_inet;
     sockaddr_in sock_inet;
     char        name[MAX_HOST_NAME];
     char        name[MAX_HOST_NAME];
   } u;
   } u;
-  
+
   int sa_length;
   int sa_length;
-  
-  if (domain == sock_local_domain || (domain == sock_any_domain && 
+
+  if (domain == sock_local_domain || (domain == sock_any_domain &&
 				      strcmp(hostname, "localhost") == 0)) {
 				      strcmp(hostname, "localhost") == 0)) {
     // connect UNIX socket
     // connect UNIX socket
     u.sock.sa_family = AF_UNIX;
     u.sock.sa_family = AF_UNIX;
-    
-    assert(strlen(unix_socket_dir) + strlen(address) 
-	   < MAX_HOST_NAME - offsetof(sockaddr,sa_data)); 
-    
+
+    assert(strlen(unix_socket_dir) + strlen(address)
+	   < MAX_HOST_NAME - offsetof(sockaddr,sa_data));
+
     sa_length = offsetof(sockaddr,sa_data) +
     sa_length = offsetof(sockaddr,sa_data) +
       sprintf(u.sock.sa_data, "%s%s", unix_socket_dir, address);
       sprintf(u.sock.sa_data, "%s%s", unix_socket_dir, address);
-  } else { 
-    u.sock_inet.sin_family = AF_INET;  
+  } else {
+    u.sock_inet.sin_family = AF_INET;
     u.sock_inet.sin_addr.s_addr = inet_addr(hostname);
     u.sock_inet.sin_addr.s_addr = inet_addr(hostname);
-    
+
     if ((int)(u.sock_inet.sin_addr.s_addr) == -1) {
     if ((int)(u.sock_inet.sin_addr.s_addr) == -1) {
       struct hostent* hp;  // entry in hosts table
       struct hostent* hp;  // entry in hosts table
-      if ((hp=gethostbyname(hostname)) == NULL || 
+      if ((hp=gethostbyname(hostname)) == NULL ||
 	  hp->h_addrtype != AF_INET) {
 	  hp->h_addrtype != AF_INET) {
 	errcode = bad_address;
 	errcode = bad_address;
 	return 0;
 	return 0;
@@ -244,34 +244,34 @@ int FSocket_Posix::connect(int max_attempts, time_t timeout) {
     sa_length = sizeof(u.sock_inet);
     sa_length = sizeof(u.sock_inet);
   }
   }
   while (1) {
   while (1) {
-    if ((fd = socket(u.sock.sa_family, SOCK_STREAM, 0)) < 0) { 
+    if ((fd = socket(u.sock.sa_family, SOCK_STREAM, 0)) < 0) {
       errcode = errno;
       errcode = errno;
       return 0;
       return 0;
     }
     }
-    do { 
+    do {
       rc = ::connect(fd, &u.sock, sa_length);
       rc = ::connect(fd, &u.sock, sa_length);
     } while (rc < 0 && errno == EINTR);
     } while (rc < 0 && errno == EINTR);
-    
-    if (rc < 0) { 
+
+    if (rc < 0) {
       errcode = errno;
       errcode = errno;
       ::close(fd);
       ::close(fd);
       if (errcode == ENOENT || errcode == ECONNREFUSED) {
       if (errcode == ENOENT || errcode == ECONNREFUSED) {
-	if (--max_attempts > 0) { 
+	if (--max_attempts > 0) {
 	  sleep(timeout);
 	  sleep(timeout);
-	} else { 
+	} else {
 	  break;
 	  break;
 	}
 	}
       } else {
       } else {
 	return 0;
 	return 0;
       }
       }
     } else {
     } else {
-      if (u.sock_inet.sin_family == AF_INET) { 
+      if (u.sock_inet.sin_family == AF_INET) {
 	int enabled = 1;
 	int enabled = 1;
-	if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&enabled, 
+	if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&enabled,
 		       sizeof enabled) != 0)
 		       sizeof enabled) != 0)
 	  {
 	  {
 	    errcode = errno;
 	    errcode = errno;
-	    ::close(fd);	
+	    ::close(fd);
 		    return 0;
 		    return 0;
 	  }
 	  }
       }
       }
@@ -284,29 +284,29 @@ int FSocket_Posix::connect(int max_attempts, time_t timeout) {
   return 0;
   return 0;
 }
 }
 
 
-int FSocket_Posix::read(void* buf, size_t min_size, size_t max_size, 
-		      time_t timeout) { 
+int FSocket_Posix::read(void* buf, size_t min_size, size_t max_size,
+		      time_t timeout) {
   size_t size = 0;
   size_t size = 0;
   time_t start = 0;
   time_t start = 0;
-  if (state != ss_open) { 
+  if (state != ss_open) {
     errcode = not_opened;
     errcode = not_opened;
     return -1;
     return -1;
   }
   }
-  if (timeout != WAIT_FOREVER) { 
-    start = time(NULL); 
+  if (timeout != WAIT_FOREVER) {
+    start = time(NULL);
   }
   }
-  do { 
-    ssize_t rc; 
-    if (timeout != WAIT_FOREVER) { 
+  do {
+    ssize_t rc;
+    if (timeout != WAIT_FOREVER) {
       fd_set events;
       fd_set events;
       struct timeval tm;
       struct timeval tm;
       FD_ZERO(&events);
       FD_ZERO(&events);
       FD_SET(fd, &events);
       FD_SET(fd, &events);
       tm.tv_sec = timeout;
       tm.tv_sec = timeout;
       tm.tv_usec = 0;
       tm.tv_usec = 0;
-      while ((rc = select(fd+1, &events, NULL, NULL, &tm)) < 0 
+      while ((rc = select(fd+1, &events, NULL, NULL, &tm)) < 0
 	     && errno == EINTR);
 	     && errno == EINTR);
-      if (rc < 0) { 
+      if (rc < 0) {
 	errcode = errno;
 	errcode = errno;
 	return -1;
 	return -1;
       }
       }
@@ -314,86 +314,86 @@ int FSocket_Posix::read(void* buf, size_t min_size, size_t max_size,
 	return size;
 	return size;
       }
       }
       time_t now = time(NULL);
       time_t now = time(NULL);
-      timeout = start + timeout >= now ? 0 : timeout + start - now;  
+      timeout = start + timeout >= now ? 0 : timeout + start - now;
     }
     }
-    while ((rc = ::read(fd, (char*)buf + size, max_size - size)) < 0 
-	   && errno == EINTR); 
-    if (rc < 0) { 
+    while ((rc = ::read(fd, (char*)buf + size, max_size - size)) < 0
+	   && errno == EINTR);
+    if (rc < 0) {
       errcode = errno;
       errcode = errno;
       return -1;
       return -1;
     } else if (rc == 0) {
     } else if (rc == 0) {
       errcode = broken_pipe;
       errcode = broken_pipe;
-      return -1; 
-    } else { 
-      size += rc; 
+      return -1;
+    } else {
+      size += rc;
     }
     }
-  } while (size < min_size); 
-  
+  } while (size < min_size);
+
   return (int)size;
   return (int)size;
 }
 }
-	
 
 
-int FSocket_Posix::read(void* buf, size_t size) { 
-  if (state != ss_open) { 
+
+int FSocket_Posix::read(void* buf, size_t size) {
+  if (state != ss_open) {
     errcode = not_opened;
     errcode = not_opened;
     return 0;
     return 0;
   }
   }
-  
-  do { 
-    ssize_t rc; 
-    while ((rc = ::read(fd, buf, size)) < 0 && errno == EINTR); 
-    if (rc < 0) { 
+
+  do {
+    ssize_t rc;
+    while ((rc = ::read(fd, buf, size)) < 0 && errno == EINTR);
+    if (rc < 0) {
       errcode = errno;
       errcode = errno;
       return 0;
       return 0;
     } else if (rc == 0) {
     } else if (rc == 0) {
       errcode = broken_pipe;
       errcode = broken_pipe;
-      return 0; 
-    } else { 
-      buf = (char*)buf + rc; 
-      size -= rc; 
+      return 0;
+    } else {
+      buf = (char*)buf + rc;
+      size -= rc;
     }
     }
-  } while (size != 0); 
-  
+  } while (size != 0);
+
   return 1;
   return 1;
 }
 }
 
 
 
 
-int FSocket_Posix::write(void const* buf, size_t size) { 
-  if (state != ss_open) { 
+int FSocket_Posix::write(void const* buf, size_t size) {
+  if (state != ss_open) {
     errcode = not_opened;
     errcode = not_opened;
     return 0;
     return 0;
   }
   }
-  
-  do { 
-    ssize_t rc; 
-    while ((rc = ::write(fd, buf, size)) < 0 && errno == EINTR); 
-    if (rc < 0) { 
+
+  do {
+    ssize_t rc;
+    while ((rc = ::write(fd, buf, size)) < 0 && errno == EINTR);
+    if (rc < 0) {
       errcode = errno;
       errcode = errno;
       return 0;
       return 0;
     } else if (rc == 0) {
     } else if (rc == 0) {
       errcode = broken_pipe;
       errcode = broken_pipe;
-      return 0; 
-    } else { 
-      buf = (char*)buf + rc; 
-      size -= rc; 
+      return 0;
+    } else {
+      buf = (char*)buf + rc;
+      size -= rc;
     }
     }
-  } while (size != 0); 
-  
+  } while (size != 0);
+
   //
   //
-  // errcode is not assigned 'ok' value beacuse write function 
+  // errcode is not assigned 'ok' value beacuse write function
   // can be called in parallel with other socket operations, so
   // can be called in parallel with other socket operations, so
   // we want to preserve old error code here.
   // we want to preserve old error code here.
   //
   //
   return 1;
   return 1;
 }
 }
-	
+
 int FSocket_Posix::close() {
 int FSocket_Posix::close() {
   if (state != ss_close) {
   if (state != ss_close) {
     state = ss_close;
     state = ss_close;
     if (::close(fd) == 0) {
     if (::close(fd) == 0) {
       errcode = ok;
       errcode = ok;
       return 1;
       return 1;
-    } else { 
+    } else {
       errcode = errno;
       errcode = errno;
       return 0;
       return 0;
     }
     }
@@ -403,64 +403,64 @@ int FSocket_Posix::close() {
 }
 }
 
 
 int FSocket_Posix::shutdown() {
 int FSocket_Posix::shutdown() {
-  if (state == ss_open) { 
+  if (state == ss_open) {
     state = ss_shutdown;
     state = ss_shutdown;
     int rc = ::shutdown(fd, 2);
     int rc = ::shutdown(fd, 2);
-    if (rc != 0) { 
+    if (rc != 0) {
       errcode = errno;
       errcode = errno;
       return 0;
       return 0;
-    } 
-  } 
+    }
+  }
   return 1;
   return 1;
 }
 }
 
 
 FSocket_Posix::~FSocket_Posix() {
 FSocket_Posix::~FSocket_Posix() {
   close();
   close();
-  if (create_file) { 
+  if (create_file) {
     char name[MAX_HOST_NAME];
     char name[MAX_HOST_NAME];
     sprintf(name, "%s%s", unix_socket_dir, address);
     sprintf(name, "%s%s", unix_socket_dir, address);
     unlink(name);
     unlink(name);
   }
   }
-  delete[] address; 
+  delete[] address;
 }
 }
 
 
-FSocket_Posix::FSocket_Posix(const char* addr, socket_domain domain) { 
-  address = strdup(addr); 
+FSocket_Posix::FSocket_Posix(const char* addr, socket_domain domain) {
+  address = strdup(addr);
   this->domain = domain;
   this->domain = domain;
   create_file = 0;
   create_file = 0;
   errcode = ok;
   errcode = ok;
 }
 }
 
 
-FSocket_Posix::FSocket_Posix(int new_fd) { 
-  fd = new_fd; 
-  address = NULL; 
+FSocket_Posix::FSocket_Posix(int new_fd) {
+  fd = new_fd;
+  address = NULL;
   create_file = 0;
   create_file = 0;
-  state = ss_open; 
+  state = ss_open;
   errcode = ok;
   errcode = ok;
 }
 }
 
 
 FSocket* FSocket::create_local(char const* address, int listen_queue_size) {
 FSocket* FSocket::create_local(char const* address, int listen_queue_size) {
   FSocket_Posix* sock = new FSocket_Posix(address, sock_local_domain);
   FSocket_Posix* sock = new FSocket_Posix(address, sock_local_domain);
-  sock->open(listen_queue_size); 
+  sock->open(listen_queue_size);
   return sock;
   return sock;
 }
 }
 
 
 FSocket* FSocket::create_global(char const* address, int listen_queue_size) {
 FSocket* FSocket::create_global(char const* address, int listen_queue_size) {
   FSocket_Posix* sock = new FSocket_Posix(address, sock_global_domain);
   FSocket_Posix* sock = new FSocket_Posix(address, sock_global_domain);
-  sock->open(listen_queue_size); 
+  sock->open(listen_queue_size);
   return sock;
   return sock;
 }
 }
 
 
-FSocket* FSocket::connect(char const* address, 
-			    socket_domain domain, 
-			    int max_attempts, 
+FSocket* FSocket::connect(char const* address,
+			    socket_domain domain,
+			    int max_attempts,
 			    time_t timeout) {
 			    time_t timeout) {
   FSocket_Posix* sock = new FSocket_Posix(address, domain);
   FSocket_Posix* sock = new FSocket_Posix(address, domain);
-  sock->connect(max_attempts, timeout); 
+  sock->connect(max_attempts, timeout);
   return sock;
   return sock;
 }
 }
-    
-char const* get_process_name() { 
+
+char const* get_process_name() {
   static char name[MAX_HOST_NAME+8];
   static char name[MAX_HOST_NAME+8];
   struct utsname local_host;
   struct utsname local_host;
   uname(&local_host);
   uname(&local_host);

+ 2 - 2
flu/src/Flu_File_Chooser.cpp

@@ -2756,7 +2756,7 @@ int Flu_File_Chooser :: popupContextMenu( Entry *entry )
     }
     }
 
 
   // add the programmable context handlers
   // add the programmable context handlers
-  for( unsigned int i = 0; i < contextHandlers.size(); i++ )
+  for( ptrdiff_t i = 0; i < contextHandlers.size(); i++ )
     {
     {
       if( !(contextHandlers[i].type & type) )
       if( !(contextHandlers[i].type & type) )
 	continue;
 	continue;
@@ -2772,7 +2772,7 @@ int Flu_File_Chooser :: popupContextMenu( Entry *entry )
   const Fl_Menu_Item *selection = entryPopup.popup();
   const Fl_Menu_Item *selection = entryPopup.popup();
   if( selection )
   if( selection )
     {
     {
-      int handler = (int)selection->user_data();
+      ptrdiff_t handler = (ptrdiff_t)selection->user_data();
       switch( handler )
       switch( handler )
 	{
 	{
 	case ACTION_NEW_FOLDER:
 	case ACTION_NEW_FOLDER:

+ 2 - 2
flu/src/Flu_Tree_Browser.cpp

@@ -3030,7 +3030,7 @@ Flu_Tree_Browser::Node* Flu_Tree_Browser::add_leaf( const char* path, const char
 
 
 unsigned int Flu_Tree_Browser::remove( const char *fullpath )
 unsigned int Flu_Tree_Browser::remove( const char *fullpath )
 {
 {
-    return( (unsigned int)root.modify( fullpath, Node::REMOVE, rdata ) );
+    return( (ptrdiff_t)root.modify( fullpath, Node::REMOVE, rdata ) );
 }
 }
 
 
 unsigned int Flu_Tree_Browser::remove( const char *path, const char *text )
 unsigned int Flu_Tree_Browser::remove( const char *path, const char *text )
@@ -3566,7 +3566,7 @@ Flu_Tree_Browser::Node* Flu_Tree_Browser::Node::modify( const char* path, int wh
         // if this is the last node, remove it.
         // if this is the last node, remove it.
         if( lastNode )
         if( lastNode )
         {
         {
-            int ID = n->id();
+            ptrdiff_t ID = n->id();
             _children.erase( n );
             _children.erase( n );
             //if( tree->rdata.cbNode == n )
             //if( tree->rdata.cbNode == n )
             //tree->rdata.cbNode = NULL;
             //tree->rdata.cbNode = NULL;

+ 4 - 1
mpdecimal/context.c

@@ -29,13 +29,16 @@
 #include "mpdecimal.h"
 #include "mpdecimal.h"
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
+#ifndef _WIN32_WCE
 #include <signal.h>
 #include <signal.h>
-
+#endif
 
 
 void
 void
 mpd_dflt_traphandler(mpd_context_t *ctx UNUSED)
 mpd_dflt_traphandler(mpd_context_t *ctx UNUSED)
 {
 {
+#ifndef _WIN32_WCE
 	raise(SIGFPE);
 	raise(SIGFPE);
+#endif
 }
 }
 
 
 void (* mpd_traphandler)(mpd_context_t *) = mpd_dflt_traphandler;
 void (* mpd_traphandler)(mpd_context_t *) = mpd_dflt_traphandler;

+ 5 - 0
mpdecimal/io.c

@@ -33,8 +33,13 @@
 #include <ctype.h>
 #include <ctype.h>
 #include <limits.h>
 #include <limits.h>
 #include <assert.h>
 #include <assert.h>
+#ifdef _WIN32_WCE
+static int errno = 0;
+#define EINVAL -1
+#else
 #include <errno.h>
 #include <errno.h>
 #include <locale.h>
 #include <locale.h>
+#endif
 #include "bits.h"
 #include "bits.h"
 #include "constants.h"
 #include "constants.h"
 #include "memory.h"
 #include "memory.h"

+ 2 - 1
mpdecimal/io.h

@@ -29,8 +29,9 @@
 #ifndef IO_H
 #ifndef IO_H
 #define IO_H
 #define IO_H
 
 
-
+#ifdef _WIN32_WCE
 #include <errno.h>
 #include <errno.h>
+#endif
 #include "mpdecimal.h"
 #include "mpdecimal.h"
 
 
 
 

+ 43 - 6
mpdecimal/mpdecimal.cbp

@@ -16,6 +16,8 @@
 				<Compiler>
 				<Compiler>
 					<Add option="-Wall" />
 					<Add option="-Wall" />
 					<Add option="-g" />
 					<Add option="-g" />
+					<Add option="-DPPRO=1" />
+					<Add option="-DASM=1" />
 				</Compiler>
 				</Compiler>
 			</Target>
 			</Target>
 			<Target title="Release">
 			<Target title="Release">
@@ -28,13 +30,15 @@
 				<Compiler>
 				<Compiler>
 					<Add option="-O3" />
 					<Add option="-O3" />
 					<Add option="-Wall" />
 					<Add option="-Wall" />
+					<Add option="-DPPRO=1" />
+					<Add option="-DASM=1" />
 				</Compiler>
 				</Compiler>
 				<Linker>
 				<Linker>
 					<Add option="-s" />
 					<Add option="-s" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
 			<Target title="Release win32">
 			<Target title="Release win32">
-				<Option output="libmpdecimal-win32" prefix_auto="1" extension_auto="1" />
+				<Option output="mpdecimal-win32" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="/home/mingo/dev/mpdecimal-2.3/.objs-win32" />
 				<Option object_output="/home/mingo/dev/mpdecimal-2.3/.objs-win32" />
 				<Option type="2" />
 				<Option type="2" />
@@ -43,17 +47,48 @@
 				<Compiler>
 				<Compiler>
 					<Add option="-O3" />
 					<Add option="-O3" />
 					<Add option="-Wall" />
 					<Add option="-Wall" />
+					<Add option="-DPPRO=1" />
+					<Add option="-DASM=1" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+				</Linker>
+			</Target>
+			<Target title="Release wince">
+				<Option output="mpdecimal-wince" prefix_auto="1" extension_auto="1" />
+				<Option working_dir="" />
+				<Option object_output="/home/mingo/dev/mpdecimal-2.3/.objs-wince" />
+				<Option type="2" />
+				<Option compiler="cegcc_compiler" />
+				<Option createDefFile="1" />
+				<Compiler>
+					<Add option="-O3" />
+					<Add option="-Wall" />
+					<Add option="-DANSI=1" />
+					<Add option="-D_WIN32_WCE=1" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+				</Linker>
+			</Target>
+			<Target title="Release_64bits">
+				<Option output="libmpdecimal" prefix_auto="1" extension_auto="1" />
+				<Option working_dir="" />
+				<Option object_output="/home/mingo/dev/mpdecimal-2.3/.objs" />
+				<Option type="2" />
+				<Option compiler="gcc" />
+				<Option createDefFile="1" />
+				<Compiler>
+					<Add option="-O3" />
+					<Add option="-Wall" />
+					<Add option="-DASM=1" />
+					<Add option="-DCONFIG_64=1" />
 				</Compiler>
 				</Compiler>
 				<Linker>
 				<Linker>
 					<Add option="-s" />
 					<Add option="-s" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
 		</Build>
 		</Build>
-		<Compiler>
-			<Add option="-DCONFIG_32=1" />
-			<Add option="-DPPRO=1" />
-			<Add option="-DASM=1" />
-		</Compiler>
 		<Unit filename="basearith.c">
 		<Unit filename="basearith.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
 		</Unit>
 		</Unit>
@@ -93,6 +128,8 @@
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
 		</Unit>
 		</Unit>
 		<Unit filename="memory.h" />
 		<Unit filename="memory.h" />
+		<Unit filename="mpdecimal.32.h" />
+		<Unit filename="mpdecimal.64.h" />
 		<Unit filename="mpdecimal.c">
 		<Unit filename="mpdecimal.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
 		</Unit>
 		</Unit>

+ 3 - 705
mpdecimal/mpdecimal.h

@@ -29,723 +29,21 @@
 #ifndef MPDECIMAL_H
 #ifndef MPDECIMAL_H
 #define MPDECIMAL_H
 #define MPDECIMAL_H
 
 
-
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C" {
 extern "C" {
 #define __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
 #endif
 #endif
 
 
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include <stdint.h>
-
-
-#if !defined(__GNUC_STDC_INLINE__)
-  #define __GNUC_STDC_INLINE__
-#endif
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-  #define UNUSED __attribute__((unused))
-#else
-  #define UNUSED
-#endif
-
-
-/******************************************************************************/
-/*                              Configuration                                 */
-/******************************************************************************/
-
-/* ABI: 32-bit */
-#ifdef CONFIG_64
-  #error "cannot use CONFIG_64 with 32-bit header."
-#endif
-
-#ifndef CONFIG_32
-  #define CONFIG_32
-#endif
-
-
-/* BEGIN CONFIG_64 */
-#if defined(CONFIG_64)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT64_MAX
-#define MPD_BITS_PER_UINT 64
-typedef uint64_t mpd_uint_t;  /* unsigned mod type */
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for exp, digits, len, prec */
-#define MPD_SSIZE_MAX INT64_MAX
-#define MPD_SSIZE_MIN INT64_MIN
-typedef int64_t mpd_ssize_t;
-#define _mpd_strtossize strtoll
-
-/* decimal arithmetic */
-#define MPD_RADIX 10000000000000000000ULL  /* 10**19 */
-#define MPD_RDIGITS 19
-#define MPD_MAX_POW10 19
-#define MPD_EXPDIGITS 19  /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 4294967296ULL      /* 2**32 */
-#define MPD_MAX_PREC 999999999999999999LL
-#define MPD_MAX_PREC_LOG2 64
-#define MPD_ELIMIT  1000000000000000000LL
-#define MPD_MAX_EMAX   999999999999999999LL    /* ELIMIT-1 */
-#define MPD_MIN_EMIN  (-999999999999999999LL)  /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 2000000000000000001LL
-#define MPD_EXP_CLAMP (-4000000000000000001LL)
-#define MPD_MAXIMPORT 105263157894736842L /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_64 */
-
-
-/* BEGIN CONFIG_32 */
-#elif defined(CONFIG_32)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT32_MAX
-#define MPD_BITS_PER_UINT 32
-typedef uint32_t mpd_uint_t;  /* unsigned mod type */
-
-#ifndef LEGACY_COMPILER
-#define MPD_UUINT_MAX UINT64_MAX
-typedef uint64_t mpd_uuint_t; /* double width unsigned mod type */
-#endif
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for dec->len, dec->exp, ctx->prec */
-#define MPD_SSIZE_MAX INT32_MAX
-#define MPD_SSIZE_MIN INT32_MIN
-typedef int32_t mpd_ssize_t;
-#define _mpd_strtossize strtol
-
-/* decimal arithmetic */
-#define MPD_RADIX 1000000000UL  /* 10**9 */
-#define MPD_RDIGITS 9
-#define MPD_MAX_POW10 9
-#define MPD_EXPDIGITS 10 /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 33554432UL /* 2**25 */
-#define MPD_MAX_PREC 425000000L
-#define MPD_MAX_PREC_LOG2 32
-#define MPD_ELIMIT 425000001L
-#define MPD_MAX_EMAX 425000000L        /* ELIMIT-1 */
-#define MPD_MIN_EMIN (-425000000L)     /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 1000000001L      /* allows for emax=999999999 in the tests */
-#define MPD_EXP_CLAMP (-2000000001L) /* allows for emin=-999999999 in the tests */
-#define MPD_MAXIMPORT 94444445L      /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_32 */
-
-#else
-  #error "define CONFIG_64 or CONFIG_32"
-#endif
-/* END CONFIG */
-
-
-#if MPD_SIZE_MAX != MPD_UINT_MAX
-  #error "unsupported platform: need mpd_size_t == mpd_uint_t"
-#endif
-
-
-/******************************************************************************/
-/*                                Context                                     */
-/******************************************************************************/
-
-enum {
-	MPD_ROUND_UP,          /* round away from 0               */
-	MPD_ROUND_DOWN,        /* round toward 0 (truncate)       */
-	MPD_ROUND_CEILING,     /* round toward +infinity          */
-	MPD_ROUND_FLOOR,       /* round toward -infinity          */
-	MPD_ROUND_HALF_UP,     /* 0.5 is rounded up               */
-	MPD_ROUND_HALF_DOWN,   /* 0.5 is rounded down             */
-	MPD_ROUND_HALF_EVEN,   /* 0.5 is rounded to even          */
-	MPD_ROUND_05UP,        /* round zero or five away from 0  */
-	MPD_ROUND_TRUNC,       /* truncate, but set infinity      */
-	MPD_ROUND_GUARD
-};
-
-enum { MPD_CLAMP_DEFAULT, MPD_CLAMP_IEEE_754, MPD_CLAMP_GUARD };
-
-extern const char *mpd_round_string[MPD_ROUND_GUARD];
-extern const char *mpd_clamp_string[MPD_CLAMP_GUARD];
-
-
-typedef struct {
-	mpd_ssize_t prec;   /* precision */
-	mpd_ssize_t emax;   /* max positive exp */
-	mpd_ssize_t emin;   /* min negative exp */
-	uint32_t traps;     /* status events that should be trapped */
-	uint32_t status;    /* status flags */
-	uint32_t newtrap;   /* set by mpd_addstatus_raise() */
-	int      round;     /* rounding mode */
-	int      clamp;     /* clamp mode */
-	int      allcr;     /* all functions correctly rounded */
-} mpd_context_t;
-
-
-/* Status flags */
-#define MPD_Clamped             0x00000001U
-#define MPD_Conversion_syntax   0x00000002U
-#define MPD_Division_by_zero    0x00000004U
-#define MPD_Division_impossible 0x00000008U
-#define MPD_Division_undefined  0x00000010U
-#define MPD_Fpu_error           0x00000020U
-#define MPD_Inexact             0x00000040U
-#define MPD_Invalid_context     0x00000080U
-#define MPD_Invalid_operation   0x00000100U
-#define MPD_Malloc_error        0x00000200U
-#define MPD_Not_implemented     0x00000400U
-#define MPD_Overflow            0x00000800U
-#define MPD_Rounded             0x00001000U
-#define MPD_Subnormal           0x00002000U
-#define MPD_Underflow           0x00004000U
-#define MPD_Max_status         (0x00008000U-1U)
-
-/* Conditions that result in an IEEE 754 exception */
-#define MPD_IEEE_Invalid_operation (MPD_Conversion_syntax |   \
-                                    MPD_Division_impossible | \
-                                    MPD_Division_undefined |  \
-                                    MPD_Fpu_error |           \
-                                    MPD_Invalid_context |     \
-                                    MPD_Invalid_operation |   \
-                                    MPD_Malloc_error)         \
-
-/* Errors that require the result of an operation to be set to NaN */
-#define MPD_Errors (MPD_IEEE_Invalid_operation | \
-                    MPD_Division_by_zero)
-
-/* Default traps */
-#define MPD_Traps (MPD_IEEE_Invalid_operation | \
-                   MPD_Division_by_zero |       \
-                   MPD_Overflow |               \
-                   MPD_Underflow)
-
-/* Official name */
-#define MPD_Insufficient_storage MPD_Malloc_error
-
-/* IEEE 754 interchange format contexts */
-#define MPD_IEEE_CONTEXT_MAX_BITS 512 /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
-#define MPD_DECIMAL32 32
-#define MPD_DECIMAL64 64
-#define MPD_DECIMAL128 128
-
-
-#define MPD_MINALLOC_MIN 2
-#define MPD_MINALLOC_MAX 64
-extern mpd_ssize_t MPD_MINALLOC;
-extern void (* mpd_traphandler)(mpd_context_t *);
-void mpd_dflt_traphandler(mpd_context_t *);
-
-void mpd_setminalloc(mpd_ssize_t n);
-void mpd_init(mpd_context_t *ctx, mpd_ssize_t prec);
-
-void mpd_maxcontext(mpd_context_t *ctx);
-void mpd_maxcontext_plus(mpd_context_t *workctx, const mpd_context_t *ctx);
-void mpd_defaultcontext(mpd_context_t *ctx);
-void mpd_basiccontext(mpd_context_t *ctx);
-int mpd_ieee_context(mpd_context_t *ctx, int bits);
-
-mpd_ssize_t mpd_getprec(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemax(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemin(const mpd_context_t *ctx);
-int mpd_getround(const mpd_context_t *ctx);
-uint32_t mpd_gettraps(const mpd_context_t *ctx);
-uint32_t mpd_getstatus(const mpd_context_t *ctx);
-int mpd_getclamp(const mpd_context_t *ctx);
-int mpd_getcr(const mpd_context_t *ctx);
-
-int mpd_qsetprec(mpd_context_t *ctx, mpd_ssize_t prec);
-int mpd_qsetemax(mpd_context_t *ctx, mpd_ssize_t emax);
-int mpd_qsetemin(mpd_context_t *ctx, mpd_ssize_t emin);
-int mpd_qsetround(mpd_context_t *ctx, int newround);
-int mpd_qsettraps(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetstatus(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetclamp(mpd_context_t *ctx, int c);
-int mpd_qsetcr(mpd_context_t *ctx, int c);
-void mpd_addstatus_raise(mpd_context_t *ctx, uint32_t flags);
-
-
-/******************************************************************************/
-/*                           Decimal Arithmetic                               */
-/******************************************************************************/
-
-/* mpd_t flags */
-#define MPD_POS                 ((uint8_t)0)
-#define MPD_NEG                 ((uint8_t)1)
-#define MPD_INF                 ((uint8_t)2)
-#define MPD_NAN                 ((uint8_t)4)
-#define MPD_SNAN                ((uint8_t)8)
-#define MPD_SPECIAL (MPD_INF|MPD_NAN|MPD_SNAN)
-#define MPD_STATIC              ((uint8_t)16)
-#define MPD_STATIC_DATA         ((uint8_t)32)
-#define MPD_SHARED_DATA         ((uint8_t)64)
-#define MPD_CONST_DATA          ((uint8_t)128)
-#define MPD_DATAFLAGS (MPD_STATIC_DATA|MPD_SHARED_DATA|MPD_CONST_DATA)
-
-/* mpd_t */
-typedef struct {
-	uint8_t flags;
-	mpd_ssize_t exp;
-	mpd_ssize_t digits;
-	mpd_ssize_t len;
-	mpd_ssize_t alloc;
-	mpd_uint_t *data;
-} mpd_t;
-
-
-typedef unsigned char uchar;
-extern mpd_t mpd_ln10;
-
-
-/******************************************************************************/
-/*                       Quiet, thread-safe functions                         */
-/******************************************************************************/
-
-/* format specification */
-typedef struct {
-	mpd_ssize_t min_width; /* minimum field width */
-	mpd_ssize_t prec;      /* fraction digits or significant digits */
-	char type;             /* conversion specifier */
-	char align;            /* alignment */
-	char sign;             /* sign printing/alignment */
-	char fill[5];          /* fill character */
-	const char *dot;       /* decimal point */
-	const char *sep;       /* thousands separator */
-	const char *grouping;  /* grouping of digits */
-} mpd_spec_t;
-
-/* output to a string */
-char *mpd_to_sci(const mpd_t *dec, int fmt);
-char *mpd_to_eng(const mpd_t *dec, int fmt);
-int mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt, int caps);
-char * mpd_qformat_spec(const mpd_t *dec, mpd_spec_t *spec, const mpd_context_t *ctx, uint32_t *status);
-char *mpd_qformat(const mpd_t *dec, const char *fmt, const mpd_context_t *ctx, uint32_t *status);
-
-#define MPD_NUM_FLAGS 15
-#define MPD_MAX_FLAG_STRING 208
-#define MPD_MAX_FLAG_LIST (MPD_MAX_FLAG_STRING+18)
-#define MPD_MAX_SIGNAL_LIST 121
-int mpd_snprint_flags(char *dest, int nmemb, uint32_t flags);
-int mpd_lsnprint_flags(char *dest, int nmemb, uint32_t flags, const char *flag_string[]);
-int mpd_lsnprint_signals(char *dest, int nmemb, uint32_t flags, const char *signal_string[]);
-
-/* output to a file */
-void mpd_fprint(FILE *file, const mpd_t *dec);
-void mpd_print(const mpd_t *dec);
-
-/* assignment from a string */
-void mpd_qset_string(mpd_t *dec, const char *s, const mpd_context_t *ctx, uint32_t *status);
-
-/* set to NaN with error flags */
-void mpd_seterror(mpd_t *result, uint32_t flags, uint32_t *status);
-/* set a special with sign and type */
-void mpd_setspecial(mpd_t *dec, uint8_t sign, uint8_t type);
-/* set coefficient to zero or all nines */
-void mpd_zerocoeff(mpd_t *result);
-void mpd_qmaxcoeff(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly assign a C integer type to an mpd_t */
-void mpd_qset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-#ifndef LEGACY_COMPILER
-void mpd_qset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-#endif
-
-/* quietly assign a C integer type to an mpd_t with a static coefficient */
-void mpd_qsset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly get a C integer type from an mpd_t */
-mpd_ssize_t mpd_qget_ssize(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qget_uint(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qabs_uint(const mpd_t *dec, uint32_t *status);
-
-
-/* quiet functions */
-int mpd_qcheck_nan(mpd_t *nanresult, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcheck_nans(mpd_t *nanresult, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfinalize(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-const char * mpd_class(const mpd_t *a, const mpd_context_t *ctx);
-
-int mpd_qcopy(mpd_t *result, const mpd_t *a,  uint32_t *status);
-mpd_t *mpd_qncopy(const mpd_t *a);
-int mpd_qcopy_abs(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_negate(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, uint32_t *status);
-
-void mpd_qand(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvert(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlogb(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qscaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qxor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_same_quantum(const mpd_t *a, const mpd_t *b);
-
-void mpd_qrotate(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qshiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr_inplace(mpd_t *result, mpd_ssize_t n);
-void mpd_qshift(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qshiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, const mpd_context_t *ctx, uint32_t *status);
-
-int mpd_qcmp(const mpd_t *a, const mpd_t *b, uint32_t *status);
-int mpd_qcompare(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcompare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_cmp_total(const mpd_t *a, const mpd_t *b);
-int mpd_cmp_total_mag(const mpd_t *a, const mpd_t *b);
-int mpd_compare_total(mpd_t *result, const mpd_t *a, const mpd_t *b);
-int mpd_compare_total_mag(mpd_t *result, const mpd_t *a, const mpd_t *b);
-
-void mpd_qround_to_intx(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qround_to_int(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qtrunc(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfloor(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qceil(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_qabs(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qminus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qplus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_minus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_plus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qquantize(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qreduce(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivint(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpow(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpowmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_update_ln10(mpd_ssize_t prec, uint32_t *status);
-void mpd_qln(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlog10(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvroot(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-
-size_t mpd_sizeinbase(mpd_t *a, uint32_t base);
-void mpd_qimport_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-void mpd_qimport_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-size_t mpd_qexport_u16(uint16_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-size_t mpd_qexport_u32(uint32_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-
-
-/******************************************************************************/
-/*                           Signalling functions                             */
-/******************************************************************************/
-
-char * mpd_format(const mpd_t *dec, const char *fmt, mpd_context_t *ctx);
-void mpd_import_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-void mpd_import_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-size_t mpd_export_u16(uint16_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-size_t mpd_export_u32(uint32_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-void mpd_finalize(mpd_t *result, mpd_context_t *ctx);
-int mpd_check_nan(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_check_nans(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_set_string(mpd_t *result, const char *s, mpd_context_t *ctx);
-void mpd_maxcoeff(mpd_t *result, mpd_context_t *ctx);
-void mpd_sset_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_sset_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_sset_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_sset_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-void mpd_set_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_set_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_set_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_set_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-#ifndef LEGACY_COMPILER
-void mpd_set_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_set_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-#endif
-mpd_ssize_t mpd_get_ssize(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_get_uint(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_abs_uint(const mpd_t *a, mpd_context_t *ctx);
-void mpd_and(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_copy(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_canonical(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_negate(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_invert(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_logb(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_or(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rotate(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_scaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_shiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-mpd_uint_t mpd_shiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shift(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_xor(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_cmp(const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_add_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_add_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_add_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_sub(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_sub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_sub_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_sub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_sub_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_div(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_div_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_div_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_div_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_div_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_divmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_divint(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_exp(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_fma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, mpd_context_t *ctx);
-void mpd_ln(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_log10(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_max(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_max_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_mul(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_mul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_mul_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_mul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_mul_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_next_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_pow(mpd_t *result, const mpd_t *base, const mpd_t *exp, mpd_context_t *ctx);
-void mpd_powmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, mpd_context_t *ctx);
-void mpd_quantize(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, mpd_context_t *ctx);
-void mpd_reduce(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_rem(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_round_to_intx(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_round_to_int(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_trunc(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_floor(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_ceil(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_sqrt(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_invroot(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-
-
-/******************************************************************************/
-/*                          Configuration specific                            */
-/******************************************************************************/
-
 #ifdef CONFIG_64
 #ifdef CONFIG_64
-void mpd_qsset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-int64_t mpd_qget_i64(const mpd_t *dec, uint32_t *status);
-uint64_t mpd_qget_u64(const mpd_t *dec, uint32_t *status);
-
-void mpd_qadd_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_sset_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_sset_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-int64_t mpd_get_i64(const mpd_t *a, mpd_context_t *ctx);
-uint64_t mpd_get_u64(const mpd_t *a, mpd_context_t *ctx);
-
-void mpd_add_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_add_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_sub_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_sub_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_div_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_div_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_mul_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_mul_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
+  #include "mpdecimal.64.h"
 #else
 #else
-int32_t mpd_qget_i32(const mpd_t *dec, uint32_t *status);
-uint32_t mpd_qget_u32(const mpd_t *dec, uint32_t *status);
-int32_t mpd_get_i32(const mpd_t *a, mpd_context_t *ctx);
-uint32_t mpd_get_u32(const mpd_t *a, mpd_context_t *ctx);
+  #define CONFIG_32
+  #include "mpdecimal.32.h"
 #endif
 #endif
 
 
-
-/******************************************************************************/
-/*                       Get attributes of a decimal                          */
-/******************************************************************************/
-
-mpd_ssize_t mpd_adjexp(const mpd_t *dec);
-mpd_ssize_t mpd_etiny(const mpd_context_t *ctx);
-mpd_ssize_t mpd_etop(const mpd_context_t *ctx);
-mpd_uint_t mpd_msword(const mpd_t *dec);
-int mpd_word_digits(mpd_uint_t word);
-/* most significant digit of a word */
-mpd_uint_t mpd_msd(mpd_uint_t word);
-/* least significant digit of a word */
-mpd_uint_t mpd_lsd(mpd_uint_t word);
-/* coefficient size needed to store 'digits' */
-mpd_ssize_t mpd_digits_to_size(mpd_ssize_t digits);
-/* number of digits in the exponent, undefined for MPD_SSIZE_MIN */
-int mpd_exp_digits(mpd_ssize_t exp);
-int mpd_iscanonical(const mpd_t *dec UNUSED);
-int mpd_isfinite(const mpd_t *dec);
-int mpd_isinfinite(const mpd_t *dec);
-int mpd_isinteger(const mpd_t *dec);
-int mpd_isnan(const mpd_t *dec);
-int mpd_isnegative(const mpd_t *dec);
-int mpd_ispositive(const mpd_t *dec);
-int mpd_isqnan(const mpd_t *dec);
-int mpd_issigned(const mpd_t *dec);
-int mpd_issnan(const mpd_t *dec);
-int mpd_isspecial(const mpd_t *dec);
-int mpd_iszero(const mpd_t *dec);
-/* undefined for special numbers */
-int mpd_iszerocoeff(const mpd_t *dec);
-int mpd_isnormal(const mpd_t *dec, const mpd_context_t *ctx);
-int mpd_issubnormal(const mpd_t *dec, const mpd_context_t *ctx);
-/* odd word */
-int mpd_isoddword(mpd_uint_t word);
-/* odd coefficient */
-int mpd_isoddcoeff(const mpd_t *dec);
-/* odd decimal, only defined for integers */
-int mpd_isodd(const mpd_t *dec);
-/* even decimal, only defined for integers */
-int mpd_iseven(const mpd_t *dec);
-/* 0 if dec is positive, 1 if dec is negative */
-uint8_t mpd_sign(const mpd_t *dec);
-/* 1 if dec is positive, -1 if dec is negative */
-int mpd_arith_sign(const mpd_t *dec);
-long mpd_radix(void);
-int mpd_isdynamic(mpd_t *dec);
-int mpd_isstatic(mpd_t *dec);
-int mpd_isdynamic_data(mpd_t *dec);
-int mpd_isstatic_data(mpd_t *dec);
-int mpd_isshared_data(mpd_t *dec);
-int mpd_isconst_data(mpd_t *dec);
-mpd_ssize_t mpd_trail_zeros(const mpd_t *dec);
-
-
-/******************************************************************************/
-/*                       Set attributes of a decimal                          */
-/******************************************************************************/
-
-/* set number of decimal digits in the coefficient */
-void mpd_setdigits(mpd_t *result);
-void mpd_set_sign(mpd_t *result, uint8_t sign);
-/* copy sign from another decimal */
-void mpd_signcpy(mpd_t *result, mpd_t *a);
-void mpd_set_infinity(mpd_t *result);
-void mpd_set_qnan(mpd_t *result);
-void mpd_set_snan(mpd_t *result);
-void mpd_set_negative(mpd_t *result);
-void mpd_set_positive(mpd_t *result);
-void mpd_set_dynamic(mpd_t *result);
-void mpd_set_static(mpd_t *result);
-void mpd_set_dynamic_data(mpd_t *result);
-void mpd_set_static_data(mpd_t *result);
-void mpd_set_shared_data(mpd_t *result);
-void mpd_set_const_data(mpd_t *result);
-void mpd_clear_flags(mpd_t *result);
-void mpd_set_flags(mpd_t *result, uint8_t flags);
-void mpd_copy_flags(mpd_t *result, const mpd_t *a);
-
-
-/******************************************************************************/
-/*                              Error Macros                                  */
-/******************************************************************************/
-
-#define mpd_err_fatal(...) \
-        do {fprintf(stderr, "%s:%d: error: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__);  fputc('\n', stderr); \
-            exit(1); \
-        } while (0)
-#define mpd_err_warn(...) \
-        do {fprintf(stderr, "%s:%d: warning: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__); fputc('\n', stderr); \
-        } while (0)
-
-
-/******************************************************************************/
-/*                            Memory handling                                 */
-/******************************************************************************/
-
-extern void *(* mpd_mallocfunc)(size_t size);
-extern void *(* mpd_callocfunc)(size_t nmemb, size_t size);
-extern void *(* mpd_reallocfunc)(void *ptr, size_t size);
-extern void (* mpd_free)(void *ptr);
-
-void *mpd_callocfunc_em(size_t nmemb, size_t size);
-
-void *mpd_alloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_calloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_realloc(void *ptr, mpd_size_t nmemb, mpd_size_t size, uint8_t *err);
-void *mpd_sh_alloc(mpd_size_t struct_size, mpd_size_t nmemb, mpd_size_t size);
-
-mpd_t *mpd_qnew(void);
-mpd_t *mpd_new(mpd_context_t *ctx);
-mpd_t *mpd_qnew_size(mpd_ssize_t size);
-void mpd_del(mpd_t *dec);
-
-void mpd_uint_zero(mpd_uint_t *dest, mpd_size_t len);
-int mpd_qresize(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-int mpd_qresize_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-void mpd_minalloc(mpd_t *result);
-
-int mpd_resize(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-int mpd_resize_zero(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-
-
 #ifdef __cplusplus
 #ifdef __cplusplus
 } /* END extern "C" */
 } /* END extern "C" */
 #endif
 #endif
 
 
 
 
 #endif /* MPDECIMAL_H */
 #endif /* MPDECIMAL_H */
-
-
-

+ 0 - 751
mpdecimal/mpdecimal.h.32

@@ -1,751 +0,0 @@
-/*
- * Copyright (c) 2008-2010 Stefan Krah. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#ifndef MPDECIMAL_H
-#define MPDECIMAL_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#define __STDC_LIMIT_MACROS
-#endif
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include <stdint.h>
-
-
-#if !defined(__GNUC_STDC_INLINE__)
-  #define __GNUC_STDC_INLINE__
-#endif
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-  #define UNUSED __attribute__((unused))
-#else
-  #define UNUSED
-#endif
-
-
-/******************************************************************************/
-/*                              Configuration                                 */
-/******************************************************************************/
-
-/* ABI: 32-bit */
-#ifdef CONFIG_64
-  #error "cannot use CONFIG_64 with 32-bit header."
-#endif
-
-#ifndef CONFIG_32
-  #define CONFIG_32
-#endif
-
-
-/* BEGIN CONFIG_64 */
-#if defined(CONFIG_64)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT64_MAX
-#define MPD_BITS_PER_UINT 64
-typedef uint64_t mpd_uint_t;  /* unsigned mod type */
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for exp, digits, len, prec */
-#define MPD_SSIZE_MAX INT64_MAX
-#define MPD_SSIZE_MIN INT64_MIN
-typedef int64_t mpd_ssize_t;
-#define _mpd_strtossize strtoll
-
-/* decimal arithmetic */
-#define MPD_RADIX 10000000000000000000ULL  /* 10**19 */
-#define MPD_RDIGITS 19
-#define MPD_MAX_POW10 19
-#define MPD_EXPDIGITS 19  /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 4294967296ULL      /* 2**32 */
-#define MPD_MAX_PREC 999999999999999999LL
-#define MPD_MAX_PREC_LOG2 64
-#define MPD_ELIMIT  1000000000000000000LL
-#define MPD_MAX_EMAX   999999999999999999LL    /* ELIMIT-1 */
-#define MPD_MIN_EMIN  (-999999999999999999LL)  /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 2000000000000000001LL
-#define MPD_EXP_CLAMP (-4000000000000000001LL)
-#define MPD_MAXIMPORT 105263157894736842L /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_64 */
-
-
-/* BEGIN CONFIG_32 */
-#elif defined(CONFIG_32)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT32_MAX
-#define MPD_BITS_PER_UINT 32
-typedef uint32_t mpd_uint_t;  /* unsigned mod type */
-
-#ifndef LEGACY_COMPILER
-#define MPD_UUINT_MAX UINT64_MAX
-typedef uint64_t mpd_uuint_t; /* double width unsigned mod type */
-#endif
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for dec->len, dec->exp, ctx->prec */
-#define MPD_SSIZE_MAX INT32_MAX
-#define MPD_SSIZE_MIN INT32_MIN
-typedef int32_t mpd_ssize_t;
-#define _mpd_strtossize strtol
-
-/* decimal arithmetic */
-#define MPD_RADIX 1000000000UL  /* 10**9 */
-#define MPD_RDIGITS 9
-#define MPD_MAX_POW10 9
-#define MPD_EXPDIGITS 10 /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 33554432UL /* 2**25 */
-#define MPD_MAX_PREC 425000000L
-#define MPD_MAX_PREC_LOG2 32
-#define MPD_ELIMIT 425000001L
-#define MPD_MAX_EMAX 425000000L        /* ELIMIT-1 */
-#define MPD_MIN_EMIN (-425000000L)     /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 1000000001L      /* allows for emax=999999999 in the tests */
-#define MPD_EXP_CLAMP (-2000000001L) /* allows for emin=-999999999 in the tests */
-#define MPD_MAXIMPORT 94444445L      /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_32 */
-
-#else
-  #error "define CONFIG_64 or CONFIG_32"
-#endif
-/* END CONFIG */
-
-
-#if MPD_SIZE_MAX != MPD_UINT_MAX
-  #error "unsupported platform: need mpd_size_t == mpd_uint_t"
-#endif
-
-
-/******************************************************************************/
-/*                                Context                                     */
-/******************************************************************************/
-
-enum {
-	MPD_ROUND_UP,          /* round away from 0               */
-	MPD_ROUND_DOWN,        /* round toward 0 (truncate)       */
-	MPD_ROUND_CEILING,     /* round toward +infinity          */
-	MPD_ROUND_FLOOR,       /* round toward -infinity          */
-	MPD_ROUND_HALF_UP,     /* 0.5 is rounded up               */
-	MPD_ROUND_HALF_DOWN,   /* 0.5 is rounded down             */
-	MPD_ROUND_HALF_EVEN,   /* 0.5 is rounded to even          */
-	MPD_ROUND_05UP,        /* round zero or five away from 0  */
-	MPD_ROUND_TRUNC,       /* truncate, but set infinity      */
-	MPD_ROUND_GUARD
-};
-
-enum { MPD_CLAMP_DEFAULT, MPD_CLAMP_IEEE_754, MPD_CLAMP_GUARD };
-
-extern const char *mpd_round_string[MPD_ROUND_GUARD];
-extern const char *mpd_clamp_string[MPD_CLAMP_GUARD];
-
-
-typedef struct {
-	mpd_ssize_t prec;   /* precision */
-	mpd_ssize_t emax;   /* max positive exp */
-	mpd_ssize_t emin;   /* min negative exp */
-	uint32_t traps;     /* status events that should be trapped */
-	uint32_t status;    /* status flags */
-	uint32_t newtrap;   /* set by mpd_addstatus_raise() */
-	int      round;     /* rounding mode */
-	int      clamp;     /* clamp mode */
-	int      allcr;     /* all functions correctly rounded */
-} mpd_context_t;
-
-
-/* Status flags */
-#define MPD_Clamped             0x00000001U
-#define MPD_Conversion_syntax   0x00000002U
-#define MPD_Division_by_zero    0x00000004U
-#define MPD_Division_impossible 0x00000008U
-#define MPD_Division_undefined  0x00000010U
-#define MPD_Fpu_error           0x00000020U
-#define MPD_Inexact             0x00000040U
-#define MPD_Invalid_context     0x00000080U
-#define MPD_Invalid_operation   0x00000100U
-#define MPD_Malloc_error        0x00000200U
-#define MPD_Not_implemented     0x00000400U
-#define MPD_Overflow            0x00000800U
-#define MPD_Rounded             0x00001000U
-#define MPD_Subnormal           0x00002000U
-#define MPD_Underflow           0x00004000U
-#define MPD_Max_status         (0x00008000U-1U)
-
-/* Conditions that result in an IEEE 754 exception */
-#define MPD_IEEE_Invalid_operation (MPD_Conversion_syntax |   \
-                                    MPD_Division_impossible | \
-                                    MPD_Division_undefined |  \
-                                    MPD_Fpu_error |           \
-                                    MPD_Invalid_context |     \
-                                    MPD_Invalid_operation |   \
-                                    MPD_Malloc_error)         \
-
-/* Errors that require the result of an operation to be set to NaN */
-#define MPD_Errors (MPD_IEEE_Invalid_operation | \
-                    MPD_Division_by_zero)
-
-/* Default traps */
-#define MPD_Traps (MPD_IEEE_Invalid_operation | \
-                   MPD_Division_by_zero |       \
-                   MPD_Overflow |               \
-                   MPD_Underflow)
-
-/* Official name */
-#define MPD_Insufficient_storage MPD_Malloc_error
-
-/* IEEE 754 interchange format contexts */
-#define MPD_IEEE_CONTEXT_MAX_BITS 512 /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
-#define MPD_DECIMAL32 32
-#define MPD_DECIMAL64 64
-#define MPD_DECIMAL128 128
-
-
-#define MPD_MINALLOC_MIN 2
-#define MPD_MINALLOC_MAX 64
-extern mpd_ssize_t MPD_MINALLOC;
-extern void (* mpd_traphandler)(mpd_context_t *);
-void mpd_dflt_traphandler(mpd_context_t *);
-
-void mpd_setminalloc(mpd_ssize_t n);
-void mpd_init(mpd_context_t *ctx, mpd_ssize_t prec);
-
-void mpd_maxcontext(mpd_context_t *ctx);
-void mpd_maxcontext_plus(mpd_context_t *workctx, const mpd_context_t *ctx);
-void mpd_defaultcontext(mpd_context_t *ctx);
-void mpd_basiccontext(mpd_context_t *ctx);
-int mpd_ieee_context(mpd_context_t *ctx, int bits);
-
-mpd_ssize_t mpd_getprec(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemax(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemin(const mpd_context_t *ctx);
-int mpd_getround(const mpd_context_t *ctx);
-uint32_t mpd_gettraps(const mpd_context_t *ctx);
-uint32_t mpd_getstatus(const mpd_context_t *ctx);
-int mpd_getclamp(const mpd_context_t *ctx);
-int mpd_getcr(const mpd_context_t *ctx);
-
-int mpd_qsetprec(mpd_context_t *ctx, mpd_ssize_t prec);
-int mpd_qsetemax(mpd_context_t *ctx, mpd_ssize_t emax);
-int mpd_qsetemin(mpd_context_t *ctx, mpd_ssize_t emin);
-int mpd_qsetround(mpd_context_t *ctx, int newround);
-int mpd_qsettraps(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetstatus(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetclamp(mpd_context_t *ctx, int c);
-int mpd_qsetcr(mpd_context_t *ctx, int c);
-void mpd_addstatus_raise(mpd_context_t *ctx, uint32_t flags);
-
-
-/******************************************************************************/
-/*                           Decimal Arithmetic                               */
-/******************************************************************************/
-
-/* mpd_t flags */
-#define MPD_POS                 ((uint8_t)0)
-#define MPD_NEG                 ((uint8_t)1)
-#define MPD_INF                 ((uint8_t)2)
-#define MPD_NAN                 ((uint8_t)4)
-#define MPD_SNAN                ((uint8_t)8)
-#define MPD_SPECIAL (MPD_INF|MPD_NAN|MPD_SNAN)
-#define MPD_STATIC              ((uint8_t)16)
-#define MPD_STATIC_DATA         ((uint8_t)32)
-#define MPD_SHARED_DATA         ((uint8_t)64)
-#define MPD_CONST_DATA          ((uint8_t)128)
-#define MPD_DATAFLAGS (MPD_STATIC_DATA|MPD_SHARED_DATA|MPD_CONST_DATA)
-
-/* mpd_t */
-typedef struct {
-	uint8_t flags;
-	mpd_ssize_t exp;
-	mpd_ssize_t digits;
-	mpd_ssize_t len;
-	mpd_ssize_t alloc;
-	mpd_uint_t *data;
-} mpd_t;
-
-
-typedef unsigned char uchar;
-extern mpd_t mpd_ln10;
-
-
-/******************************************************************************/
-/*                       Quiet, thread-safe functions                         */
-/******************************************************************************/
-
-/* format specification */
-typedef struct {
-	mpd_ssize_t min_width; /* minimum field width */
-	mpd_ssize_t prec;      /* fraction digits or significant digits */
-	char type;             /* conversion specifier */
-	char align;            /* alignment */
-	char sign;             /* sign printing/alignment */
-	char fill[5];          /* fill character */
-	const char *dot;       /* decimal point */
-	const char *sep;       /* thousands separator */
-	const char *grouping;  /* grouping of digits */
-} mpd_spec_t;
-
-/* output to a string */
-char *mpd_to_sci(const mpd_t *dec, int fmt);
-char *mpd_to_eng(const mpd_t *dec, int fmt);
-int mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt, int caps);
-char * mpd_qformat_spec(const mpd_t *dec, mpd_spec_t *spec, const mpd_context_t *ctx, uint32_t *status);
-char *mpd_qformat(const mpd_t *dec, const char *fmt, const mpd_context_t *ctx, uint32_t *status);
-
-#define MPD_NUM_FLAGS 15
-#define MPD_MAX_FLAG_STRING 208
-#define MPD_MAX_FLAG_LIST (MPD_MAX_FLAG_STRING+18)
-#define MPD_MAX_SIGNAL_LIST 121
-int mpd_snprint_flags(char *dest, int nmemb, uint32_t flags);
-int mpd_lsnprint_flags(char *dest, int nmemb, uint32_t flags, const char *flag_string[]);
-int mpd_lsnprint_signals(char *dest, int nmemb, uint32_t flags, const char *signal_string[]);
-
-/* output to a file */
-void mpd_fprint(FILE *file, const mpd_t *dec);
-void mpd_print(const mpd_t *dec);
-
-/* assignment from a string */
-void mpd_qset_string(mpd_t *dec, const char *s, const mpd_context_t *ctx, uint32_t *status);
-
-/* set to NaN with error flags */
-void mpd_seterror(mpd_t *result, uint32_t flags, uint32_t *status);
-/* set a special with sign and type */
-void mpd_setspecial(mpd_t *dec, uint8_t sign, uint8_t type);
-/* set coefficient to zero or all nines */
-void mpd_zerocoeff(mpd_t *result);
-void mpd_qmaxcoeff(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly assign a C integer type to an mpd_t */
-void mpd_qset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-#ifndef LEGACY_COMPILER
-void mpd_qset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-#endif
-
-/* quietly assign a C integer type to an mpd_t with a static coefficient */
-void mpd_qsset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly get a C integer type from an mpd_t */
-mpd_ssize_t mpd_qget_ssize(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qget_uint(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qabs_uint(const mpd_t *dec, uint32_t *status);
-
-
-/* quiet functions */
-int mpd_qcheck_nan(mpd_t *nanresult, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcheck_nans(mpd_t *nanresult, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfinalize(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-const char * mpd_class(const mpd_t *a, const mpd_context_t *ctx);
-
-int mpd_qcopy(mpd_t *result, const mpd_t *a,  uint32_t *status);
-mpd_t *mpd_qncopy(const mpd_t *a);
-int mpd_qcopy_abs(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_negate(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, uint32_t *status);
-
-void mpd_qand(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvert(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlogb(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qscaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qxor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_same_quantum(const mpd_t *a, const mpd_t *b);
-
-void mpd_qrotate(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qshiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr_inplace(mpd_t *result, mpd_ssize_t n);
-void mpd_qshift(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qshiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, const mpd_context_t *ctx, uint32_t *status);
-
-int mpd_qcmp(const mpd_t *a, const mpd_t *b, uint32_t *status);
-int mpd_qcompare(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcompare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_cmp_total(const mpd_t *a, const mpd_t *b);
-int mpd_cmp_total_mag(const mpd_t *a, const mpd_t *b);
-int mpd_compare_total(mpd_t *result, const mpd_t *a, const mpd_t *b);
-int mpd_compare_total_mag(mpd_t *result, const mpd_t *a, const mpd_t *b);
-
-void mpd_qround_to_intx(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qround_to_int(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qtrunc(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfloor(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qceil(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_qabs(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qminus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qplus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_minus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_plus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qquantize(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qreduce(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivint(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpow(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpowmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_update_ln10(mpd_ssize_t prec, uint32_t *status);
-void mpd_qln(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlog10(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvroot(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-
-size_t mpd_sizeinbase(mpd_t *a, uint32_t base);
-void mpd_qimport_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-void mpd_qimport_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-size_t mpd_qexport_u16(uint16_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-size_t mpd_qexport_u32(uint32_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-
-
-/******************************************************************************/
-/*                           Signalling functions                             */
-/******************************************************************************/
-
-char * mpd_format(const mpd_t *dec, const char *fmt, mpd_context_t *ctx);
-void mpd_import_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-void mpd_import_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-size_t mpd_export_u16(uint16_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-size_t mpd_export_u32(uint32_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-void mpd_finalize(mpd_t *result, mpd_context_t *ctx);
-int mpd_check_nan(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_check_nans(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_set_string(mpd_t *result, const char *s, mpd_context_t *ctx);
-void mpd_maxcoeff(mpd_t *result, mpd_context_t *ctx);
-void mpd_sset_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_sset_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_sset_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_sset_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-void mpd_set_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_set_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_set_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_set_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-#ifndef LEGACY_COMPILER
-void mpd_set_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_set_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-#endif
-mpd_ssize_t mpd_get_ssize(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_get_uint(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_abs_uint(const mpd_t *a, mpd_context_t *ctx);
-void mpd_and(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_copy(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_canonical(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_negate(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_invert(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_logb(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_or(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rotate(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_scaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_shiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-mpd_uint_t mpd_shiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shift(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_xor(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_cmp(const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_add_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_add_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_add_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_sub(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_sub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_sub_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_sub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_sub_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_div(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_div_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_div_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_div_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_div_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_divmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_divint(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_exp(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_fma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, mpd_context_t *ctx);
-void mpd_ln(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_log10(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_max(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_max_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_mul(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_mul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_mul_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_mul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_mul_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_next_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_pow(mpd_t *result, const mpd_t *base, const mpd_t *exp, mpd_context_t *ctx);
-void mpd_powmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, mpd_context_t *ctx);
-void mpd_quantize(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, mpd_context_t *ctx);
-void mpd_reduce(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_rem(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_round_to_intx(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_round_to_int(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_trunc(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_floor(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_ceil(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_sqrt(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_invroot(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-
-
-/******************************************************************************/
-/*                          Configuration specific                            */
-/******************************************************************************/
-
-#ifdef CONFIG_64
-void mpd_qsset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-int64_t mpd_qget_i64(const mpd_t *dec, uint32_t *status);
-uint64_t mpd_qget_u64(const mpd_t *dec, uint32_t *status);
-
-void mpd_qadd_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_sset_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_sset_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-int64_t mpd_get_i64(const mpd_t *a, mpd_context_t *ctx);
-uint64_t mpd_get_u64(const mpd_t *a, mpd_context_t *ctx);
-
-void mpd_add_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_add_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_sub_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_sub_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_div_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_div_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_mul_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_mul_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-#else
-int32_t mpd_qget_i32(const mpd_t *dec, uint32_t *status);
-uint32_t mpd_qget_u32(const mpd_t *dec, uint32_t *status);
-int32_t mpd_get_i32(const mpd_t *a, mpd_context_t *ctx);
-uint32_t mpd_get_u32(const mpd_t *a, mpd_context_t *ctx);
-#endif
-
-
-/******************************************************************************/
-/*                       Get attributes of a decimal                          */
-/******************************************************************************/
-
-mpd_ssize_t mpd_adjexp(const mpd_t *dec);
-mpd_ssize_t mpd_etiny(const mpd_context_t *ctx);
-mpd_ssize_t mpd_etop(const mpd_context_t *ctx);
-mpd_uint_t mpd_msword(const mpd_t *dec);
-int mpd_word_digits(mpd_uint_t word);
-/* most significant digit of a word */
-mpd_uint_t mpd_msd(mpd_uint_t word);
-/* least significant digit of a word */
-mpd_uint_t mpd_lsd(mpd_uint_t word);
-/* coefficient size needed to store 'digits' */
-mpd_ssize_t mpd_digits_to_size(mpd_ssize_t digits);
-/* number of digits in the exponent, undefined for MPD_SSIZE_MIN */
-int mpd_exp_digits(mpd_ssize_t exp);
-int mpd_iscanonical(const mpd_t *dec UNUSED);
-int mpd_isfinite(const mpd_t *dec);
-int mpd_isinfinite(const mpd_t *dec);
-int mpd_isinteger(const mpd_t *dec);
-int mpd_isnan(const mpd_t *dec);
-int mpd_isnegative(const mpd_t *dec);
-int mpd_ispositive(const mpd_t *dec);
-int mpd_isqnan(const mpd_t *dec);
-int mpd_issigned(const mpd_t *dec);
-int mpd_issnan(const mpd_t *dec);
-int mpd_isspecial(const mpd_t *dec);
-int mpd_iszero(const mpd_t *dec);
-/* undefined for special numbers */
-int mpd_iszerocoeff(const mpd_t *dec);
-int mpd_isnormal(const mpd_t *dec, const mpd_context_t *ctx);
-int mpd_issubnormal(const mpd_t *dec, const mpd_context_t *ctx);
-/* odd word */
-int mpd_isoddword(mpd_uint_t word);
-/* odd coefficient */
-int mpd_isoddcoeff(const mpd_t *dec);
-/* odd decimal, only defined for integers */
-int mpd_isodd(const mpd_t *dec);
-/* even decimal, only defined for integers */
-int mpd_iseven(const mpd_t *dec);
-/* 0 if dec is positive, 1 if dec is negative */
-uint8_t mpd_sign(const mpd_t *dec);
-/* 1 if dec is positive, -1 if dec is negative */
-int mpd_arith_sign(const mpd_t *dec);
-long mpd_radix(void);
-int mpd_isdynamic(mpd_t *dec);
-int mpd_isstatic(mpd_t *dec);
-int mpd_isdynamic_data(mpd_t *dec);
-int mpd_isstatic_data(mpd_t *dec);
-int mpd_isshared_data(mpd_t *dec);
-int mpd_isconst_data(mpd_t *dec);
-mpd_ssize_t mpd_trail_zeros(const mpd_t *dec);
-
-
-/******************************************************************************/
-/*                       Set attributes of a decimal                          */
-/******************************************************************************/
-
-/* set number of decimal digits in the coefficient */
-void mpd_setdigits(mpd_t *result);
-void mpd_set_sign(mpd_t *result, uint8_t sign);
-/* copy sign from another decimal */
-void mpd_signcpy(mpd_t *result, mpd_t *a);
-void mpd_set_infinity(mpd_t *result);
-void mpd_set_qnan(mpd_t *result);
-void mpd_set_snan(mpd_t *result);
-void mpd_set_negative(mpd_t *result);
-void mpd_set_positive(mpd_t *result);
-void mpd_set_dynamic(mpd_t *result);
-void mpd_set_static(mpd_t *result);
-void mpd_set_dynamic_data(mpd_t *result);
-void mpd_set_static_data(mpd_t *result);
-void mpd_set_shared_data(mpd_t *result);
-void mpd_set_const_data(mpd_t *result);
-void mpd_clear_flags(mpd_t *result);
-void mpd_set_flags(mpd_t *result, uint8_t flags);
-void mpd_copy_flags(mpd_t *result, const mpd_t *a);
-
-
-/******************************************************************************/
-/*                              Error Macros                                  */
-/******************************************************************************/
-
-#define mpd_err_fatal(...) \
-        do {fprintf(stderr, "%s:%d: error: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__);  fputc('\n', stderr); \
-            exit(1); \
-        } while (0)
-#define mpd_err_warn(...) \
-        do {fprintf(stderr, "%s:%d: warning: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__); fputc('\n', stderr); \
-        } while (0)
-
-
-/******************************************************************************/
-/*                            Memory handling                                 */
-/******************************************************************************/
-
-extern void *(* mpd_mallocfunc)(size_t size);
-extern void *(* mpd_callocfunc)(size_t nmemb, size_t size);
-extern void *(* mpd_reallocfunc)(void *ptr, size_t size);
-extern void (* mpd_free)(void *ptr);
-
-void *mpd_callocfunc_em(size_t nmemb, size_t size);
-
-void *mpd_alloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_calloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_realloc(void *ptr, mpd_size_t nmemb, mpd_size_t size, uint8_t *err);
-void *mpd_sh_alloc(mpd_size_t struct_size, mpd_size_t nmemb, mpd_size_t size);
-
-mpd_t *mpd_qnew(void);
-mpd_t *mpd_new(mpd_context_t *ctx);
-mpd_t *mpd_qnew_size(mpd_ssize_t size);
-void mpd_del(mpd_t *dec);
-
-void mpd_uint_zero(mpd_uint_t *dest, mpd_size_t len);
-int mpd_qresize(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-int mpd_qresize_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-void mpd_minalloc(mpd_t *result);
-
-int mpd_resize(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-int mpd_resize_zero(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-
-
-#ifdef __cplusplus
-} /* END extern "C" */
-#endif
-
-
-#endif /* MPDECIMAL_H */
-
-
-

+ 0 - 751
mpdecimal/mpdecimal.h.64

@@ -1,751 +0,0 @@
-/*
- * Copyright (c) 2008-2010 Stefan Krah. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#ifndef MPDECIMAL_H
-#define MPDECIMAL_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#define __STDC_LIMIT_MACROS
-#endif
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include <stdint.h>
-
-
-#if !defined(__GNUC_STDC_INLINE__)
-  #define __GNUC_STDC_INLINE__
-#endif
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-  #define UNUSED __attribute__((unused))
-#else
-  #define UNUSED
-#endif
-
-
-/******************************************************************************/
-/*                              Configuration                                 */
-/******************************************************************************/
-
-/* ABI: 64-bit */
-#ifdef CONFIG_32
-  #error "cannot use CONFIG_32 with 64-bit header."
-#endif
-
-#ifndef CONFIG_64
-  #define CONFIG_64
-#endif
-
-
-/* BEGIN CONFIG_64 */
-#if defined(CONFIG_64)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT64_MAX
-#define MPD_BITS_PER_UINT 64
-typedef uint64_t mpd_uint_t;  /* unsigned mod type */
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for exp, digits, len, prec */
-#define MPD_SSIZE_MAX INT64_MAX
-#define MPD_SSIZE_MIN INT64_MIN
-typedef int64_t mpd_ssize_t;
-#define _mpd_strtossize strtoll
-
-/* decimal arithmetic */
-#define MPD_RADIX 10000000000000000000ULL  /* 10**19 */
-#define MPD_RDIGITS 19
-#define MPD_MAX_POW10 19
-#define MPD_EXPDIGITS 19  /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 4294967296ULL      /* 2**32 */
-#define MPD_MAX_PREC 999999999999999999LL
-#define MPD_MAX_PREC_LOG2 64
-#define MPD_ELIMIT  1000000000000000000LL
-#define MPD_MAX_EMAX   999999999999999999LL    /* ELIMIT-1 */
-#define MPD_MIN_EMIN  (-999999999999999999LL)  /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 2000000000000000001LL
-#define MPD_EXP_CLAMP (-4000000000000000001LL)
-#define MPD_MAXIMPORT 105263157894736842L /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_64 */
-
-
-/* BEGIN CONFIG_32 */
-#elif defined(CONFIG_32)
-/* types for modular and base arithmetic */
-#define MPD_UINT_MAX UINT32_MAX
-#define MPD_BITS_PER_UINT 32
-typedef uint32_t mpd_uint_t;  /* unsigned mod type */
-
-#ifndef LEGACY_COMPILER
-#define MPD_UUINT_MAX UINT64_MAX
-typedef uint64_t mpd_uuint_t; /* double width unsigned mod type */
-#endif
-
-#define MPD_SIZE_MAX SIZE_MAX
-typedef size_t mpd_size_t; /* unsigned size type */
-
-/* type for dec->len, dec->exp, ctx->prec */
-#define MPD_SSIZE_MAX INT32_MAX
-#define MPD_SSIZE_MIN INT32_MIN
-typedef int32_t mpd_ssize_t;
-#define _mpd_strtossize strtol
-
-/* decimal arithmetic */
-#define MPD_RADIX 1000000000UL  /* 10**9 */
-#define MPD_RDIGITS 9
-#define MPD_MAX_POW10 9
-#define MPD_EXPDIGITS 10 /* MPD_EXPDIGITS <= MPD_RDIGITS+1 */
-
-#define MPD_MAXTRANSFORM_2N 33554432UL /* 2**25 */
-#define MPD_MAX_PREC 425000000L
-#define MPD_MAX_PREC_LOG2 32
-#define MPD_ELIMIT 425000001L
-#define MPD_MAX_EMAX 425000000L        /* ELIMIT-1 */
-#define MPD_MIN_EMIN (-425000000L)     /* -EMAX */
-#define MPD_MIN_ETINY (MPD_MIN_EMIN-(MPD_MAX_PREC-1))
-#define MPD_EXP_INF 1000000001L      /* allows for emax=999999999 in the tests */
-#define MPD_EXP_CLAMP (-2000000001L) /* allows for emin=-999999999 in the tests */
-#define MPD_MAXIMPORT 94444445L      /* ceil((2*MPD_MAX_PREC)/MPD_RDIGITS) */
-/* END CONFIG_32 */
-
-#else
-  #error "define CONFIG_64 or CONFIG_32"
-#endif
-/* END CONFIG */
-
-
-#if MPD_SIZE_MAX != MPD_UINT_MAX
-  #error "unsupported platform: need mpd_size_t == mpd_uint_t"
-#endif
-
-
-/******************************************************************************/
-/*                                Context                                     */
-/******************************************************************************/
-
-enum {
-	MPD_ROUND_UP,          /* round away from 0               */
-	MPD_ROUND_DOWN,        /* round toward 0 (truncate)       */
-	MPD_ROUND_CEILING,     /* round toward +infinity          */
-	MPD_ROUND_FLOOR,       /* round toward -infinity          */
-	MPD_ROUND_HALF_UP,     /* 0.5 is rounded up               */
-	MPD_ROUND_HALF_DOWN,   /* 0.5 is rounded down             */
-	MPD_ROUND_HALF_EVEN,   /* 0.5 is rounded to even          */
-	MPD_ROUND_05UP,        /* round zero or five away from 0  */
-	MPD_ROUND_TRUNC,       /* truncate, but set infinity      */
-	MPD_ROUND_GUARD
-};
-
-enum { MPD_CLAMP_DEFAULT, MPD_CLAMP_IEEE_754, MPD_CLAMP_GUARD };
-
-extern const char *mpd_round_string[MPD_ROUND_GUARD];
-extern const char *mpd_clamp_string[MPD_CLAMP_GUARD];
-
-
-typedef struct {
-	mpd_ssize_t prec;   /* precision */
-	mpd_ssize_t emax;   /* max positive exp */
-	mpd_ssize_t emin;   /* min negative exp */
-	uint32_t traps;     /* status events that should be trapped */
-	uint32_t status;    /* status flags */
-	uint32_t newtrap;   /* set by mpd_addstatus_raise() */
-	int      round;     /* rounding mode */
-	int      clamp;     /* clamp mode */
-	int      allcr;     /* all functions correctly rounded */
-} mpd_context_t;
-
-
-/* Status flags */
-#define MPD_Clamped             0x00000001U
-#define MPD_Conversion_syntax   0x00000002U
-#define MPD_Division_by_zero    0x00000004U
-#define MPD_Division_impossible 0x00000008U
-#define MPD_Division_undefined  0x00000010U
-#define MPD_Fpu_error           0x00000020U
-#define MPD_Inexact             0x00000040U
-#define MPD_Invalid_context     0x00000080U
-#define MPD_Invalid_operation   0x00000100U
-#define MPD_Malloc_error        0x00000200U
-#define MPD_Not_implemented     0x00000400U
-#define MPD_Overflow            0x00000800U
-#define MPD_Rounded             0x00001000U
-#define MPD_Subnormal           0x00002000U
-#define MPD_Underflow           0x00004000U
-#define MPD_Max_status         (0x00008000U-1U)
-
-/* Conditions that result in an IEEE 754 exception */
-#define MPD_IEEE_Invalid_operation (MPD_Conversion_syntax |   \
-                                    MPD_Division_impossible | \
-                                    MPD_Division_undefined |  \
-                                    MPD_Fpu_error |           \
-                                    MPD_Invalid_context |     \
-                                    MPD_Invalid_operation |   \
-                                    MPD_Malloc_error)         \
-
-/* Errors that require the result of an operation to be set to NaN */
-#define MPD_Errors (MPD_IEEE_Invalid_operation | \
-                    MPD_Division_by_zero)
-
-/* Default traps */
-#define MPD_Traps (MPD_IEEE_Invalid_operation | \
-                   MPD_Division_by_zero |       \
-                   MPD_Overflow |               \
-                   MPD_Underflow)
-
-/* Official name */
-#define MPD_Insufficient_storage MPD_Malloc_error
-
-/* IEEE 754 interchange format contexts */
-#define MPD_IEEE_CONTEXT_MAX_BITS 512 /* 16*(log2(MPD_MAX_EMAX / 3)-3) */
-#define MPD_DECIMAL32 32
-#define MPD_DECIMAL64 64
-#define MPD_DECIMAL128 128
-
-
-#define MPD_MINALLOC_MIN 2
-#define MPD_MINALLOC_MAX 64
-extern mpd_ssize_t MPD_MINALLOC;
-extern void (* mpd_traphandler)(mpd_context_t *);
-void mpd_dflt_traphandler(mpd_context_t *);
-
-void mpd_setminalloc(mpd_ssize_t n);
-void mpd_init(mpd_context_t *ctx, mpd_ssize_t prec);
-
-void mpd_maxcontext(mpd_context_t *ctx);
-void mpd_maxcontext_plus(mpd_context_t *workctx, const mpd_context_t *ctx);
-void mpd_defaultcontext(mpd_context_t *ctx);
-void mpd_basiccontext(mpd_context_t *ctx);
-int mpd_ieee_context(mpd_context_t *ctx, int bits);
-
-mpd_ssize_t mpd_getprec(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemax(const mpd_context_t *ctx);
-mpd_ssize_t mpd_getemin(const mpd_context_t *ctx);
-int mpd_getround(const mpd_context_t *ctx);
-uint32_t mpd_gettraps(const mpd_context_t *ctx);
-uint32_t mpd_getstatus(const mpd_context_t *ctx);
-int mpd_getclamp(const mpd_context_t *ctx);
-int mpd_getcr(const mpd_context_t *ctx);
-
-int mpd_qsetprec(mpd_context_t *ctx, mpd_ssize_t prec);
-int mpd_qsetemax(mpd_context_t *ctx, mpd_ssize_t emax);
-int mpd_qsetemin(mpd_context_t *ctx, mpd_ssize_t emin);
-int mpd_qsetround(mpd_context_t *ctx, int newround);
-int mpd_qsettraps(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetstatus(mpd_context_t *ctx, uint32_t flags);
-int mpd_qsetclamp(mpd_context_t *ctx, int c);
-int mpd_qsetcr(mpd_context_t *ctx, int c);
-void mpd_addstatus_raise(mpd_context_t *ctx, uint32_t flags);
-
-
-/******************************************************************************/
-/*                           Decimal Arithmetic                               */
-/******************************************************************************/
-
-/* mpd_t flags */
-#define MPD_POS                 ((uint8_t)0)
-#define MPD_NEG                 ((uint8_t)1)
-#define MPD_INF                 ((uint8_t)2)
-#define MPD_NAN                 ((uint8_t)4)
-#define MPD_SNAN                ((uint8_t)8)
-#define MPD_SPECIAL (MPD_INF|MPD_NAN|MPD_SNAN)
-#define MPD_STATIC              ((uint8_t)16)
-#define MPD_STATIC_DATA         ((uint8_t)32)
-#define MPD_SHARED_DATA         ((uint8_t)64)
-#define MPD_CONST_DATA          ((uint8_t)128)
-#define MPD_DATAFLAGS (MPD_STATIC_DATA|MPD_SHARED_DATA|MPD_CONST_DATA)
-
-/* mpd_t */
-typedef struct {
-	uint8_t flags;
-	mpd_ssize_t exp;
-	mpd_ssize_t digits;
-	mpd_ssize_t len;
-	mpd_ssize_t alloc;
-	mpd_uint_t *data;
-} mpd_t;
-
-
-typedef unsigned char uchar;
-extern mpd_t mpd_ln10;
-
-
-/******************************************************************************/
-/*                       Quiet, thread-safe functions                         */
-/******************************************************************************/
-
-/* format specification */
-typedef struct {
-	mpd_ssize_t min_width; /* minimum field width */
-	mpd_ssize_t prec;      /* fraction digits or significant digits */
-	char type;             /* conversion specifier */
-	char align;            /* alignment */
-	char sign;             /* sign printing/alignment */
-	char fill[5];          /* fill character */
-	const char *dot;       /* decimal point */
-	const char *sep;       /* thousands separator */
-	const char *grouping;  /* grouping of digits */
-} mpd_spec_t;
-
-/* output to a string */
-char *mpd_to_sci(const mpd_t *dec, int fmt);
-char *mpd_to_eng(const mpd_t *dec, int fmt);
-int mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt, int caps);
-char * mpd_qformat_spec(const mpd_t *dec, mpd_spec_t *spec, const mpd_context_t *ctx, uint32_t *status);
-char *mpd_qformat(const mpd_t *dec, const char *fmt, const mpd_context_t *ctx, uint32_t *status);
-
-#define MPD_NUM_FLAGS 15
-#define MPD_MAX_FLAG_STRING 208
-#define MPD_MAX_FLAG_LIST (MPD_MAX_FLAG_STRING+18)
-#define MPD_MAX_SIGNAL_LIST 121
-int mpd_snprint_flags(char *dest, int nmemb, uint32_t flags);
-int mpd_lsnprint_flags(char *dest, int nmemb, uint32_t flags, const char *flag_string[]);
-int mpd_lsnprint_signals(char *dest, int nmemb, uint32_t flags, const char *signal_string[]);
-
-/* output to a file */
-void mpd_fprint(FILE *file, const mpd_t *dec);
-void mpd_print(const mpd_t *dec);
-
-/* assignment from a string */
-void mpd_qset_string(mpd_t *dec, const char *s, const mpd_context_t *ctx, uint32_t *status);
-
-/* set to NaN with error flags */
-void mpd_seterror(mpd_t *result, uint32_t flags, uint32_t *status);
-/* set a special with sign and type */
-void mpd_setspecial(mpd_t *dec, uint8_t sign, uint8_t type);
-/* set coefficient to zero or all nines */
-void mpd_zerocoeff(mpd_t *result);
-void mpd_qmaxcoeff(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly assign a C integer type to an mpd_t */
-void mpd_qset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-#ifndef LEGACY_COMPILER
-void mpd_qset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-#endif
-
-/* quietly assign a C integer type to an mpd_t with a static coefficient */
-void mpd_qsset_ssize(mpd_t *result, mpd_ssize_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_i32(mpd_t *result, int32_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_uint(mpd_t *result, mpd_uint_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u32(mpd_t *result, uint32_t a, const mpd_context_t *ctx, uint32_t *status);
-
-/* quietly get a C integer type from an mpd_t */
-mpd_ssize_t mpd_qget_ssize(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qget_uint(const mpd_t *dec, uint32_t *status);
-mpd_uint_t mpd_qabs_uint(const mpd_t *dec, uint32_t *status);
-
-
-/* quiet functions */
-int mpd_qcheck_nan(mpd_t *nanresult, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcheck_nans(mpd_t *nanresult, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfinalize(mpd_t *result, const mpd_context_t *ctx, uint32_t *status);
-
-const char * mpd_class(const mpd_t *a, const mpd_context_t *ctx);
-
-int mpd_qcopy(mpd_t *result, const mpd_t *a,  uint32_t *status);
-mpd_t *mpd_qncopy(const mpd_t *a);
-int mpd_qcopy_abs(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_negate(mpd_t *result, const mpd_t *a, uint32_t *status);
-int mpd_qcopy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, uint32_t *status);
-
-void mpd_qand(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvert(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlogb(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qscaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qxor(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_same_quantum(const mpd_t *a, const mpd_t *b);
-
-void mpd_qrotate(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qshiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, uint32_t *status);
-mpd_uint_t mpd_qshiftr_inplace(mpd_t *result, mpd_ssize_t n);
-void mpd_qshift(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qshiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, const mpd_context_t *ctx, uint32_t *status);
-
-int mpd_qcmp(const mpd_t *a, const mpd_t *b, uint32_t *status);
-int mpd_qcompare(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_qcompare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-int mpd_cmp_total(const mpd_t *a, const mpd_t *b);
-int mpd_cmp_total_mag(const mpd_t *a, const mpd_t *b);
-int mpd_compare_total(mpd_t *result, const mpd_t *a, const mpd_t *b);
-int mpd_compare_total_mag(mpd_t *result, const mpd_t *a, const mpd_t *b);
-
-void mpd_qround_to_intx(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qround_to_int(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qtrunc(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfloor(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qceil(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_qabs(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmax_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmin_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qminus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qplus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_minus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_plus(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qnext_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qquantize(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qreduce(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qfma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i32(mpd_t *result, const mpd_t *a, int32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u32(mpd_t *result, const mpd_t *a, uint32_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivint(mpd_t *q, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qrem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdivmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpow(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qpowmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_update_ln10(mpd_ssize_t prec, uint32_t *status);
-void mpd_qln(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qlog10(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qinvroot(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx, uint32_t *status);
-
-
-size_t mpd_sizeinbase(mpd_t *a, uint32_t base);
-void mpd_qimport_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-void mpd_qimport_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen,
-                     uint8_t srcsign, uint32_t srcbase,
-                     const mpd_context_t *ctx, uint32_t *status);
-size_t mpd_qexport_u16(uint16_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-size_t mpd_qexport_u32(uint32_t *rdata, size_t rlen, uint32_t base,
-                       const mpd_t *src, uint32_t *status);
-
-
-/******************************************************************************/
-/*                           Signalling functions                             */
-/******************************************************************************/
-
-char * mpd_format(const mpd_t *dec, const char *fmt, mpd_context_t *ctx);
-void mpd_import_u16(mpd_t *result, const uint16_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-void mpd_import_u32(mpd_t *result, const uint32_t *srcdata, size_t srclen, uint8_t srcsign, uint32_t base, mpd_context_t *ctx);
-size_t mpd_export_u16(uint16_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-size_t mpd_export_u32(uint32_t *rdata, size_t rlen, uint32_t base, const mpd_t *src, mpd_context_t *ctx);
-void mpd_finalize(mpd_t *result, mpd_context_t *ctx);
-int mpd_check_nan(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_check_nans(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_set_string(mpd_t *result, const char *s, mpd_context_t *ctx);
-void mpd_maxcoeff(mpd_t *result, mpd_context_t *ctx);
-void mpd_sset_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_sset_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_sset_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_sset_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-void mpd_set_ssize(mpd_t *result, mpd_ssize_t a, mpd_context_t *ctx);
-void mpd_set_i32(mpd_t *result, int32_t a, mpd_context_t *ctx);
-void mpd_set_uint(mpd_t *result, mpd_uint_t a, mpd_context_t *ctx);
-void mpd_set_u32(mpd_t *result, uint32_t a, mpd_context_t *ctx);
-#ifndef LEGACY_COMPILER
-void mpd_set_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_set_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-#endif
-mpd_ssize_t mpd_get_ssize(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_get_uint(const mpd_t *a, mpd_context_t *ctx);
-mpd_uint_t mpd_abs_uint(const mpd_t *a, mpd_context_t *ctx);
-void mpd_and(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_copy(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_canonical(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_negate(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_copy_sign(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_invert(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_logb(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_or(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rotate(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_scaleb(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_shiftl(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-mpd_uint_t mpd_shiftr(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shiftn(mpd_t *result, const mpd_t *a, mpd_ssize_t n, mpd_context_t *ctx);
-void mpd_shift(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_xor(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_abs(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-int mpd_cmp(const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-int mpd_compare_signal(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_add_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_add_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_add_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_add_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_sub(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_sub_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_sub_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_sub_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_sub_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_div(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_div_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_div_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_div_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_div_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_divmod(mpd_t *q, mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_divint(mpd_t *q, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_exp(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_fma(mpd_t *result, const mpd_t *a, const mpd_t *b, const mpd_t *c, mpd_context_t *ctx);
-void mpd_ln(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_log10(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_max(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_max_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_min_mag(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_mul(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_mul_ssize(mpd_t *result, const mpd_t *a, mpd_ssize_t b, mpd_context_t *ctx);
-void mpd_mul_i32(mpd_t *result, const mpd_t *a, int32_t b, mpd_context_t *ctx);
-void mpd_mul_uint(mpd_t *result, const mpd_t *a, mpd_uint_t b, mpd_context_t *ctx);
-void mpd_mul_u32(mpd_t *result, const mpd_t *a, uint32_t b, mpd_context_t *ctx);
-void mpd_next_minus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_next_toward(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_plus(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_pow(mpd_t *result, const mpd_t *base, const mpd_t *exp, mpd_context_t *ctx);
-void mpd_powmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_t *mod, mpd_context_t *ctx);
-void mpd_quantize(mpd_t *result, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, mpd_context_t *ctx);
-void mpd_reduce(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_rem(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_rem_near(mpd_t *r, const mpd_t *a, const mpd_t *b, mpd_context_t *ctx);
-void mpd_round_to_intx(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_round_to_int(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_trunc(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_floor(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_ceil(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_sqrt(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-void mpd_invroot(mpd_t *result, const mpd_t *a, mpd_context_t *ctx);
-
-
-/******************************************************************************/
-/*                          Configuration specific                            */
-/******************************************************************************/
-
-#ifdef CONFIG_64
-void mpd_qsset_i64(mpd_t *result, int64_t a, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsset_u64(mpd_t *result, uint64_t a, const mpd_context_t *ctx, uint32_t *status);
-int64_t mpd_qget_i64(const mpd_t *dec, uint32_t *status);
-uint64_t mpd_qget_u64(const mpd_t *dec, uint32_t *status);
-
-void mpd_qadd_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qadd_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qsub_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qmul_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_i64(mpd_t *result, const mpd_t *a, int64_t b, const mpd_context_t *ctx, uint32_t *status);
-void mpd_qdiv_u64(mpd_t *result, const mpd_t *a, uint64_t b, const mpd_context_t *ctx, uint32_t *status);
-
-void mpd_sset_i64(mpd_t *result, int64_t a, mpd_context_t *ctx);
-void mpd_sset_u64(mpd_t *result, uint64_t a, mpd_context_t *ctx);
-int64_t mpd_get_i64(const mpd_t *a, mpd_context_t *ctx);
-uint64_t mpd_get_u64(const mpd_t *a, mpd_context_t *ctx);
-
-void mpd_add_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_add_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_sub_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_sub_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_div_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_div_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-void mpd_mul_i64(mpd_t *result, const mpd_t *a, int64_t b, mpd_context_t *ctx);
-void mpd_mul_u64(mpd_t *result, const mpd_t *a, uint64_t b, mpd_context_t *ctx);
-#else
-int32_t mpd_qget_i32(const mpd_t *dec, uint32_t *status);
-uint32_t mpd_qget_u32(const mpd_t *dec, uint32_t *status);
-int32_t mpd_get_i32(const mpd_t *a, mpd_context_t *ctx);
-uint32_t mpd_get_u32(const mpd_t *a, mpd_context_t *ctx);
-#endif
-
-
-/******************************************************************************/
-/*                       Get attributes of a decimal                          */
-/******************************************************************************/
-
-mpd_ssize_t mpd_adjexp(const mpd_t *dec);
-mpd_ssize_t mpd_etiny(const mpd_context_t *ctx);
-mpd_ssize_t mpd_etop(const mpd_context_t *ctx);
-mpd_uint_t mpd_msword(const mpd_t *dec);
-int mpd_word_digits(mpd_uint_t word);
-/* most significant digit of a word */
-mpd_uint_t mpd_msd(mpd_uint_t word);
-/* least significant digit of a word */
-mpd_uint_t mpd_lsd(mpd_uint_t word);
-/* coefficient size needed to store 'digits' */
-mpd_ssize_t mpd_digits_to_size(mpd_ssize_t digits);
-/* number of digits in the exponent, undefined for MPD_SSIZE_MIN */
-int mpd_exp_digits(mpd_ssize_t exp);
-int mpd_iscanonical(const mpd_t *dec UNUSED);
-int mpd_isfinite(const mpd_t *dec);
-int mpd_isinfinite(const mpd_t *dec);
-int mpd_isinteger(const mpd_t *dec);
-int mpd_isnan(const mpd_t *dec);
-int mpd_isnegative(const mpd_t *dec);
-int mpd_ispositive(const mpd_t *dec);
-int mpd_isqnan(const mpd_t *dec);
-int mpd_issigned(const mpd_t *dec);
-int mpd_issnan(const mpd_t *dec);
-int mpd_isspecial(const mpd_t *dec);
-int mpd_iszero(const mpd_t *dec);
-/* undefined for special numbers */
-int mpd_iszerocoeff(const mpd_t *dec);
-int mpd_isnormal(const mpd_t *dec, const mpd_context_t *ctx);
-int mpd_issubnormal(const mpd_t *dec, const mpd_context_t *ctx);
-/* odd word */
-int mpd_isoddword(mpd_uint_t word);
-/* odd coefficient */
-int mpd_isoddcoeff(const mpd_t *dec);
-/* odd decimal, only defined for integers */
-int mpd_isodd(const mpd_t *dec);
-/* even decimal, only defined for integers */
-int mpd_iseven(const mpd_t *dec);
-/* 0 if dec is positive, 1 if dec is negative */
-uint8_t mpd_sign(const mpd_t *dec);
-/* 1 if dec is positive, -1 if dec is negative */
-int mpd_arith_sign(const mpd_t *dec);
-long mpd_radix(void);
-int mpd_isdynamic(mpd_t *dec);
-int mpd_isstatic(mpd_t *dec);
-int mpd_isdynamic_data(mpd_t *dec);
-int mpd_isstatic_data(mpd_t *dec);
-int mpd_isshared_data(mpd_t *dec);
-int mpd_isconst_data(mpd_t *dec);
-mpd_ssize_t mpd_trail_zeros(const mpd_t *dec);
-
-
-/******************************************************************************/
-/*                       Set attributes of a decimal                          */
-/******************************************************************************/
-
-/* set number of decimal digits in the coefficient */
-void mpd_setdigits(mpd_t *result);
-void mpd_set_sign(mpd_t *result, uint8_t sign);
-/* copy sign from another decimal */
-void mpd_signcpy(mpd_t *result, mpd_t *a);
-void mpd_set_infinity(mpd_t *result);
-void mpd_set_qnan(mpd_t *result);
-void mpd_set_snan(mpd_t *result);
-void mpd_set_negative(mpd_t *result);
-void mpd_set_positive(mpd_t *result);
-void mpd_set_dynamic(mpd_t *result);
-void mpd_set_static(mpd_t *result);
-void mpd_set_dynamic_data(mpd_t *result);
-void mpd_set_static_data(mpd_t *result);
-void mpd_set_shared_data(mpd_t *result);
-void mpd_set_const_data(mpd_t *result);
-void mpd_clear_flags(mpd_t *result);
-void mpd_set_flags(mpd_t *result, uint8_t flags);
-void mpd_copy_flags(mpd_t *result, const mpd_t *a);
-
-
-/******************************************************************************/
-/*                              Error Macros                                  */
-/******************************************************************************/
-
-#define mpd_err_fatal(...) \
-        do {fprintf(stderr, "%s:%d: error: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__);  fputc('\n', stderr); \
-            exit(1); \
-        } while (0)
-#define mpd_err_warn(...) \
-        do {fprintf(stderr, "%s:%d: warning: ", __FILE__, __LINE__); \
-            fprintf(stderr, __VA_ARGS__); fputc('\n', stderr); \
-        } while (0)
-
-
-/******************************************************************************/
-/*                            Memory handling                                 */
-/******************************************************************************/
-
-extern void *(* mpd_mallocfunc)(size_t size);
-extern void *(* mpd_callocfunc)(size_t nmemb, size_t size);
-extern void *(* mpd_reallocfunc)(void *ptr, size_t size);
-extern void (* mpd_free)(void *ptr);
-
-void *mpd_callocfunc_em(size_t nmemb, size_t size);
-
-void *mpd_alloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_calloc(mpd_size_t nmemb, mpd_size_t size);
-void *mpd_realloc(void *ptr, mpd_size_t nmemb, mpd_size_t size, uint8_t *err);
-void *mpd_sh_alloc(mpd_size_t struct_size, mpd_size_t nmemb, mpd_size_t size);
-
-mpd_t *mpd_qnew(void);
-mpd_t *mpd_new(mpd_context_t *ctx);
-mpd_t *mpd_qnew_size(mpd_ssize_t size);
-void mpd_del(mpd_t *dec);
-
-void mpd_uint_zero(mpd_uint_t *dest, mpd_size_t len);
-int mpd_qresize(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-int mpd_qresize_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
-void mpd_minalloc(mpd_t *result);
-
-int mpd_resize(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-int mpd_resize_zero(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
-
-
-#ifdef __cplusplus
-} /* END extern "C" */
-#endif
-
-
-#endif /* MPDECIMAL_H */
-
-
-

+ 6 - 8
myaxtls/axtls.cbp

@@ -7,7 +7,7 @@
 		<Option compiler="gcc" />
 		<Option compiler="gcc" />
 		<Build>
 		<Build>
 			<Target title="Debug">
 			<Target title="Debug">
-				<Option output="axtls" prefix_auto="1" extension_auto="1" />
+				<Option output="libaxtls" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="obj/Debug/" />
 				<Option object_output="obj/Debug/" />
 				<Option type="2" />
 				<Option type="2" />
@@ -18,22 +18,21 @@
 				</Compiler>
 				</Compiler>
 			</Target>
 			</Target>
 			<Target title="Release">
 			<Target title="Release">
-				<Option output="axtls" prefix_auto="1" extension_auto="1" />
+				<Option output="libaxtls" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="obj/Release/" />
 				<Option object_output="obj/Release/" />
 				<Option type="2" />
 				<Option type="2" />
 				<Option compiler="gcc" />
 				<Option compiler="gcc" />
 				<Option createDefFile="1" />
 				<Option createDefFile="1" />
 				<Compiler>
 				<Compiler>
-					<Add option="-march=i686" />
-					<Add option="-O2" />
+					<Add option="-O3" />
 				</Compiler>
 				</Compiler>
 				<Linker>
 				<Linker>
 					<Add option="-s" />
 					<Add option="-s" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
 			<Target title="Release-lua-jit">
 			<Target title="Release-lua-jit">
-				<Option output="axtls-lua-jit" prefix_auto="1" extension_auto="1" />
+				<Option output="libaxtls-lua-jit" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="obj/Release/" />
 				<Option object_output="obj/Release/" />
 				<Option type="2" />
 				<Option type="2" />
@@ -49,7 +48,7 @@
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
 			<Target title="Debug-lua-jit">
 			<Target title="Debug-lua-jit">
-				<Option output="axtls-lua-jit" prefix_auto="1" extension_auto="1" />
+				<Option output="libaxtls-lua-jit" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="obj/Debug/" />
 				<Option object_output="obj/Debug/" />
 				<Option type="2" />
 				<Option type="2" />
@@ -62,14 +61,13 @@
 				</Compiler>
 				</Compiler>
 			</Target>
 			</Target>
 			<Target title="Release O3">
 			<Target title="Release O3">
-				<Option output="axtls" prefix_auto="1" extension_auto="1" />
+				<Option output="libaxtls" prefix_auto="1" extension_auto="1" />
 				<Option working_dir="" />
 				<Option working_dir="" />
 				<Option object_output="obj/Release/" />
 				<Option object_output="obj/Release/" />
 				<Option type="2" />
 				<Option type="2" />
 				<Option compiler="gcc" />
 				<Option compiler="gcc" />
 				<Option createDefFile="1" />
 				<Option createDefFile="1" />
 				<Compiler>
 				<Compiler>
-					<Add option="-march=i686" />
 					<Add option="-fomit-frame-pointer" />
 					<Add option="-fomit-frame-pointer" />
 					<Add option="-fexpensive-optimizations" />
 					<Add option="-fexpensive-optimizations" />
 					<Add option="-O3" />
 					<Add option="-O3" />

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است