Updated for 64-bit. Bumped copyright year.

Pascal J. Bourguignon [2011-05-01 20:37]
Updated for 64-bit.  Bumped copyright year.
Filename
Makefile
README
bclib/interfaces/ASCII.h
bclib/interfaces/BcCStr.h
bclib/interfaces/BcDefault.h
bclib/interfaces/BcExcept.h
bclib/interfaces/BcGeom.h
bclib/interfaces/BcImplementation.h
bclib/interfaces/BcInterface.h
bclib/interfaces/BcList.h
bclib/interfaces/BcMem.h
bclib/interfaces/BcRandom.h
bclib/interfaces/BcString.h
bclib/interfaces/BcTypes.h
bclib/interfaces/names.h
bclib/sources/BcCStr.c
bclib/sources/BcDefault.c
bclib/sources/BcDefaultTest.c
bclib/sources/BcExcept.c
bclib/sources/BcList.c
bclib/sources/BcMem.c
bclib/sources/BcRandom.c
bclib/sources/BcString.c
benlib/interfaces/Bencoding.h
benlib/sources/Bencoding.c
benlib/sources/approxim.c
benlib/sources/approxim.h
benlib/sources/apraccen.c
benlib/sources/apraccen.h
benlib/sources/encascii.c
benlib/sources/encascii.h
benlib/sources/encebcdi.c
benlib/sources/encebcdi.h
benlib/sources/ench2bcd.c
benlib/sources/ench2bcd.h
benlib/sources/ench6bcd.c
benlib/sources/ench6bcd.h
benlib/sources/encibbcd.c
benlib/sources/encibbcd.h
benlib/sources/encisla1.c
benlib/sources/encisla1.h
benlib/sources/encmacos.c
benlib/sources/encmacos.h
benlib/sources/encmsdos.c
benlib/sources/encmsdos.h
benlib/sources/encmswin.c
benlib/sources/encmswin.h
benlib/sources/encnxstp.c
benlib/sources/encnxstp.h
benlib/sources/encpsstd.c
benlib/sources/encpsstd.h
benlib/sources/encsymbl.c
benlib/sources/encsymbl.h
benlib/sources/enctypes.h
benlib/sources/encunifd.c
benlib/sources/encunifd.h
bjlib/interfaces/bjarray.h
bjlib/interfaces/bjdict.h
bjlib/interfaces/bjfile.h
bjlib/interfaces/bjobject.h
bjlib/interfaces/bjstring.h
bjlib/interfaces/bjstring_list.h
bjlib/sources/bjarray.c
bjlib/sources/bjdict.c
bjlib/sources/bjfile.c
bjlib/sources/bjobject.c
bjlib/sources/bjstring.c
bjlib/sources/bjstring_file.c
bjlib/sources/bjstring_list.c
bolib/interfaces/BoArray.h
bolib/interfaces/BoList.h
bolib/interfaces/BoListNoRetain.h
bolib/interfaces/BoObject.h
bolib/interfaces/BoString.h
bolib/interfaces/BoTimer.h
bolib/sources/BoArray.m
bolib/sources/BoList.m
bolib/sources/BoListNoRetain.m
bolib/sources/BoObject.m
bolib/sources/BoString.m
bolib/sources/BoTimer.macintosh.m
bolib/sources/BoTimer.next.m
bolib/sources/BoTimer.posix.m
bolib/sources/Makefile
bpcombi/interfaces/BpArrangementSansRepeat.hh
bpcombi/interfaces/BpArrangementWithRepeat.hh
bpcombi/interfaces/BpCombination.hh
bpcombi/interfaces/BpSetEnumerator.hh
bpcombi/interfaces/BpSetFunctor.hh
bpcombi/interfaces/names.h
bpcombi/sources/BpArrangementSansRepeat.cc
bpcombi/sources/BpArrangementWithRepeat.cc
bpcombi/sources/BpCombination.cc
bpcombi/sources/BpSetEnumerator.cc
bpcombi/sources/BpSetFunctor.cc
bplib/interfaces/BpArray.hh
bplib/interfaces/BpClass.hh
bplib/interfaces/BpDict.hh
bplib/interfaces/BpList.hh
bplib/interfaces/BpObject.hh
bplib/interfaces/BpString.hh
bplib/interfaces/BpTimer.hh
bplib/interfaces/PrintOnLevel.hh
bplib/interfaces/names.h
bplib/sources/BpArray.cc
bplib/sources/BpClass.cc
bplib/sources/BpDict.cc
bplib/sources/BpList.cc
bplib/sources/BpObject.cc
bplib/sources/BpString.cc
bplib/sources/BpTimer-MacOS.cc
bplib/sources/BpTimer-NEXTSTEP.cc
bplib/sources/PrintOnLevel.cc
bplib/tests/BpClassTest/sources/BpClassTest.cc
bplib/tests/BpClassTest/sources/BpClassTest.hh
bplib/tests/BpDictTest/sources/BpDictTest.cc
bprib/interfaces/BpRIB.hh
bprib/interfaces/names.h
bprib/sources/BpRIB.cc
bprib/sources/number.c
diff --git a/Makefile b/Makefile
index 9a14d4b..e84cd30 100644
--- a/Makefile
+++ b/Makefile
@@ -90,4 +90,5 @@ etags tags:
 					-o -name \*.hh -o -name \*.cc \
 				\) -print | etags -

+
 #### Makefile                         --                     --          ####
diff --git a/README b/README
index abd30fa..5e4695a 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@

-makedir     Makefiles.
+0m0akedir     Makefiles.

 bclib       Bourguignon's C Library.  A collection of C modules.

diff --git a/bclib/interfaces/ASCII.h b/bclib/interfaces/ASCII.h
index 1364614..84bff2e 100644
--- a/bclib/interfaces/ASCII.h
+++ b/bclib/interfaces/ASCII.h
@@ -10,7 +10,7 @@ AUTHORS
 MODIFICATIONS
     1991-03-31 <PJB> Translated from Modula-2 to C.
 LEGAL
-    Copyright Pascal J. Bourguignon 1990 - 2002
+    Copyright Pascal J. Bourguignon 1990 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcCStr.h b/bclib/interfaces/BcCStr.h
index 02ed3a6..d1d496a 100644
--- a/bclib/interfaces/BcCStr.h
+++ b/bclib/interfaces/BcCStr.h
@@ -27,7 +27,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcDefault.h b/bclib/interfaces/BcDefault.h
index dcad7e0..59cbe5c 100644
--- a/bclib/interfaces/BcDefault.h
+++ b/bclib/interfaces/BcDefault.h
@@ -29,7 +29,7 @@ LEGAL
         Application Kit,Release 2.0
         Copyright (c) 1988,1989,1990,NeXT,Inc.  All rights reserved.

-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcExcept.h b/bclib/interfaces/BcExcept.h
index 8dc3cdd..18fd41b 100644
--- a/bclib/interfaces/BcExcept.h
+++ b/bclib/interfaces/BcExcept.h
@@ -32,7 +32,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcGeom.h b/bclib/interfaces/BcGeom.h
index e21bd6d..52b08e8 100644
--- a/bclib/interfaces/BcGeom.h
+++ b/bclib/interfaces/BcGeom.h
@@ -24,7 +24,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcImplementation.h b/bclib/interfaces/BcImplementation.h
index c909344..b6056ac 100644
--- a/bclib/interfaces/BcImplementation.h
+++ b/bclib/interfaces/BcImplementation.h
@@ -63,7 +63,7 @@ MODIFICATIONS
     2002-01-31 <PJB> Added #undef for all macro defined
                      either here or in BcInterface.h
 LEGAL
-    Copyright Pascal J. Bourguignon 1989 - 2002
+    Copyright Pascal J. Bourguignon 1989 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcInterface.h b/bclib/interfaces/BcInterface.h
index 954d919..e9ad5f5 100644
--- a/bclib/interfaces/BcInterface.h
+++ b/bclib/interfaces/BcInterface.h
@@ -54,7 +54,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1989 - 2002
+    Copyright Pascal J. Bourguignon 1989 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcList.h b/bclib/interfaces/BcList.h
index 86d6de4..b6f620b 100644
--- a/bclib/interfaces/BcList.h
+++ b/bclib/interfaces/BcList.h
@@ -25,7 +25,7 @@ MODIFICATIONS
     1992-10-25 <PJB> Upgraded to the same interface as NeXTstep objc/List.h.
     1992-07-21 <PJB> Creation ,(BoArray).
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2003
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcMem.h b/bclib/interfaces/BcMem.h
index af4971b..f2ef9ca 100644
--- a/bclib/interfaces/BcMem.h
+++ b/bclib/interfaces/BcMem.h
@@ -28,7 +28,7 @@ MODIFICATIONS
                     in the same sources.
     1993-12-06 <PJB> Added Fill.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcRandom.h b/bclib/interfaces/BcRandom.h
index 69931e0..1ecc09b 100644
--- a/bclib/interfaces/BcRandom.h
+++ b/bclib/interfaces/BcRandom.h
@@ -34,7 +34,7 @@ MODIFICATIONS
     1993-09-08 <PJB> Removed RANDOMFILE. Now, the random file path is found
                      from the environment variable.
 LEGAL
-    Copyright Pascal J. Bourguignon 1990 - 2002
+    Copyright Pascal J. Bourguignon 1990 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcString.h b/bclib/interfaces/BcString.h
index a842328..160fce8 100644
--- a/bclib/interfaces/BcString.h
+++ b/bclib/interfaces/BcString.h
@@ -31,7 +31,7 @@ MODIFICATIONS
     1994-10-08 <PJB> Translated from C++ to C.
     1994-10-09 <PJB> Added AppendString.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

diff --git a/bclib/interfaces/BcTypes.h b/bclib/interfaces/BcTypes.h
index e0e5b3d..ceb64d6 100644
--- a/bclib/interfaces/BcTypes.h
+++ b/bclib/interfaces/BcTypes.h
@@ -45,7 +45,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1989 - 2002
+    Copyright Pascal J. Bourguignon 1989 - 2011

     This file is part of the bclib library.

@@ -68,28 +68,109 @@ LEGAL
 #define inhibit_inhibit_BcTypes_h
 #include <limits.h> /* import CHAR_BIT */

+#define HAS_STDINT
+#ifdef HAS_STDINT
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+
+typedef intptr_t            INTPTR; /* A INT of the same size as a void* */
+typedef int64_t             INT64;
+typedef int32_t             INT32;
+typedef int16_t             INT16;
+typedef int8_t              INT8;
+typedef uintptr_t           CARDPTR; /* A CARD of the same size as a void* */
+typedef uint64_t            CARD64;
+typedef uint32_t            CARD32;
+typedef uint16_t            CARD16;
+typedef uint8_t             CARD8;
+
+
+#define FMT_INTPTR              "p"
+#define FMT_INT64               "ld"
+#define FMT_INT32               "d"
+#define FMT_INT16               "d"
+#define FMT_INT8                "d"
+
+#define FMT_CARDPTR             "p"
+#define FMT_CARD64              "lu"
+#define FMT_CARD32              "u"
+#define FMT_CARD16              "u"
+#define FMT_CARD8               "u"
+
+#define FMT_INTPTR_HEX          "x"
+#define FMT_INT64_HEX           "lx"
+#define FMT_INT32_HEX           "x"
+#define FMT_INT16_HEX           "x"
+#define FMT_INT8_HEX            "x"
+
+#define FMT_CARDPTR_HEX         "x"
+#define FMT_CARD64_HEX          "lx"
+#define FMT_CARD32_HEX          "x"
+#define FMT_CARD16_HEX          "x"
+#define FMT_CARD8_HEX           "x"
+
+
+#define MIN_INT64           INT64_MIN
+#define MAX_INT64           INT64_MAX
+#define MAX_CARD64          UINT64_MAX
+#define MIN_INT32           INT32_MIN
+#define MAX_INT32           INT32_MAX
+#define MAX_CARD32          UINT32_MAX
+#define MIN_INT16           INT16_MIN
+#define MAX_INT16           INT16_MAX
+#define MAX_CARD16          UINT16_MAX
+#define MIN_INT8            INT8_MIN
+#define MAX_INT8            INT8_MAX
+#define MAX_CARD8           UINT8_MAX
+
+#else
+
 #ifdef _WIN32
-    typedef __int64                 INT64;
-    typedef unsigned __int64        CARD64;
+typedef __int64                 INT64;
+typedef unsigned __int64        CARD64;
 #else
 #if 0
-        /* long long is not ISO C */
-    typedef long long int           INT64;
-    typedef unsigned long long int  CARD64;
+/* long long is not ISO C */
+typedef long long int           INT64;
+typedef unsigned long long int  CARD64;
 #endif
 #endif
-    typedef long int                INT32;
-    typedef short int               INT16;
-    typedef char                    INT8;
-    typedef unsigned long int       CARD32;
-    typedef unsigned short int      CARD16;
-    typedef unsigned char           CARD8;
-    typedef int                     SignT;  /* [ -1, 0,  +1 ] */
-    typedef unsigned char           CHAR;
-    typedef CARD16                  UNICODE;
-    typedef double                  DECIMAL;
-    typedef void*                   ADDRESS;
-
+typedef long int                INTPTR; /* A CARD of the same size as a void* */
+typedef long int                INT32;
+typedef short int               INT16;
+typedef char                    INT8;
+typedef unsigned long int       CARDPTR; /* A CARD of the same size as a void* */
+typedef unsigned long int       CARD32;
+typedef unsigned short int      CARD16;
+typedef unsigned char           CARD8;
+
+#define FMT_INTPTR              "p"
+#define FMT_INT64               "ld"
+#define FMT_INT32               "d"
+#define FMT_INT16               "d"
+#define FMT_INT8                "d"
+
+#define FMT_CARDPTR             "p"
+#define FMT_CARD64              "lu"
+#define FMT_CARD32              "u"
+#define FMT_CARD16              "u"
+#define FMT_CARD8               "u"
+
+#define FMT_INTPTR_HEX          "x"
+#define FMT_INT64_HEX           "lx"
+#define FMT_INT32_HEX           "x"
+#define FMT_INT16_HEX           "x"
+#define FMT_INT8_HEX            "x"
+
+#define FMT_CARDPTR_HEX         "x"
+#define FMT_CARD64_HEX          "lx"
+#define FMT_CARD32_HEX          "x"
+#define FMT_CARD16_HEX          "x"
+#define FMT_CARD8_HEX           "x"
+
+#define MIN_INT64           ((INT64)0x8000000000000000)
+#define MAX_INT64           ((INT64)0x7fffffffffffffff)
+#define MAX_CARD64          ((CARD64)0xffffffffffffffff)
 #define MIN_INT32           ((INT32)0x80000000)
 #define MAX_INT32           ((INT32)0x7fffffff)
 #define MAX_CARD32          ((CARD32)0xffffffff)
@@ -100,9 +181,18 @@ LEGAL
 #define MAX_INT8            ((INT32)0x7f)
 #define MAX_CARD8           ((CARD32)0xff)

-    typedef CHAR                CSTRING255[256];
-    typedef CHAR                CSTRING63[64];
-    typedef CHAR                CSTRING31[32];
+#endif
+
+
+typedef int                     SignT;  /* [ -1, 0,  +1 ] */
+typedef double                  DECIMAL;
+typedef void*                   ADDRESS;
+typedef CARD32                  UNICODE;
+typedef unsigned char           CHAR;
+
+typedef CHAR                    CSTRING255[256];
+typedef CHAR                    CSTRING63[64];
+typedef CHAR                    CSTRING31[32];

 #undef NIL
 #define NIL                 (0) /*((void*)(0))*/
@@ -118,14 +208,15 @@ LEGAL
 #else
 #undef  TRUE
 #undef  FALSE
-    typedef enum {FALSE=0,TRUE} BOOLEAN;
+typedef enum {FALSE=0,TRUE} BOOLEAN;
 #endif


 #define INC(i)       (++(i))
 #define DEC(i)       (--(i))
-#define INCR(i,n)    ((i)+=(n))
-#define DECR(i,n)    ((i)-=(n))
+#define TYPEOF(i)    typeof(i)
+#define INCR(i,n)    ((i)=((TYPEOF(i))((i)+(n))))
+#define DECR(i,n)    ((i)=((TYPEOF(i))((i)-(n))))
 #ifndef ODD
 #define ODD(i)       ((((CARD32)(i))&1)!=0)
 #endif
diff --git a/bclib/interfaces/names.h b/bclib/interfaces/names.h
index e4dd523..24adf2b 100644
--- a/bclib/interfaces/names.h
+++ b/bclib/interfaces/names.h
@@ -20,7 +20,7 @@ MODIFICATIONS

     1995-10-18 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/sources/BcCStr.c b/bclib/sources/BcCStr.c
index 1137a1c..2c0875c 100644
--- a/bclib/sources/BcCStr.c
+++ b/bclib/sources/BcCStr.c
@@ -27,7 +27,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

diff --git a/bclib/sources/BcDefault.c b/bclib/sources/BcDefault.c
index 403a1cb..bead309 100644
--- a/bclib/sources/BcDefault.c
+++ b/bclib/sources/BcDefault.c
@@ -25,7 +25,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

diff --git a/bclib/sources/BcDefaultTest.c b/bclib/sources/BcDefaultTest.c
index 877f4a2..6168e5a 100644
--- a/bclib/sources/BcDefaultTest.c
+++ b/bclib/sources/BcDefaultTest.c
@@ -28,7 +28,7 @@ BUGS
     The semantics of this implementation is not *exactly* the same as those
     of NeXTstep implementation. This should not be a problem for dumb use.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

diff --git a/bclib/sources/BcExcept.c b/bclib/sources/BcExcept.c
index 9d6a00f..40321e8 100644
--- a/bclib/sources/BcExcept.c
+++ b/bclib/sources/BcExcept.c
@@ -32,7 +32,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

@@ -72,7 +72,7 @@ LEGAL
     PROCEDURE(BcRAISE,(INT32 code,const void* data1,const void* data2),void)
     {
         if(BcTRY_CurrentEnvironment==NIL){
-            fprintf(stderr,"BpExcept_BcRAISE: Uncatched exception code=%ld data1=%p data2=%p\n",code,data1,data2);
+            fprintf(stderr,"BpExcept_BcRAISE: Uncatched exception code=%"FMT_INT32"data1=%p data2=%p\n",code,data1,data2);
 #ifdef UNIX
             /* We use a kill instead of exit to let the debugger catch it here. */
             signal(SIGQUIT,SIG_DFL);
diff --git a/bclib/sources/BcList.c b/bclib/sources/BcList.c
index 1d7b9ae..77b2621 100644
--- a/bclib/sources/BcList.c
+++ b/bclib/sources/BcList.c
@@ -27,7 +27,7 @@ MODIFICATIONS
     1992-10-25 <PJB> Upgraded to the same interface as NeXTstep objc/List.h.
     1992-07-21 <PJB> Creation (BoArray).
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2003
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

@@ -72,7 +72,7 @@ LEGAL
         plist=(BcList_P)BcMem_Allocate(sizeof(BcList_R));
         plist->count=0;
         plist->capacity=BcList_Minimum;
-        plist->elements=(void**)BcMem_Allocate(sizeof(void*)*plist->capacity);
+        plist->elements=(void**)BcMem_Allocate((CARD32)sizeof(void*)*plist->capacity);
         return((BcList_T)plist);
     }/*BcList_Allocate;*/

@@ -136,9 +136,9 @@ LEGAL
             newCapacity=BcList_Minimum;
         }
         if(plist->count>newCapacity){
-            BcRAISE(BcList_eCapacityTooLow,(void*)list,(void*)newCapacity);
+            BcRAISE(BcList_eCapacityTooLow,(void*)list,(void*)(CARDPTR)newCapacity);
         }else{
-            newElements=(void**)BcMem_Allocate(sizeof(void*)*newCapacity);
+            newElements=(void**)BcMem_Allocate((CARD32)sizeof(void*)*newCapacity);
             i=0;
             while(i<plist->count){
                 newElements[i]=plist->elements[i];
@@ -166,7 +166,7 @@ LEGAL

         plist=(BcList_P)list;
         if(idx>=plist->count){
-            BcRAISE(BcList_eBadIndex,list,(void*)idx);
+            BcRAISE(BcList_eBadIndex,list,(void*)(CARDPTR)idx);
         }
         return(plist->elements[idx]);
     }/*BcList_ObjectAt;*/
@@ -255,7 +255,7 @@ Console_fprintf(console,"BcList_InsertObjectAt returns TRUE\n");

         plist=(BcList_P)list;
         if(idx>=plist->count){
-            BcRAISE(BcList_eBadIndex,(void*)list,(void*)idx);
+            BcRAISE(BcList_eBadIndex,(void*)list,(void*)(CARDPTR)idx);
         }
         oldObject=plist->elements[idx];
         while(idx<plist->count){
@@ -293,7 +293,7 @@ Console_fprintf(console,"BcList_InsertObjectAt returns TRUE\n");
             BcRAISE(BcList_eNilObject,(void*)list,NIL);
         }
         if(idx>=plist->count){
-            BcRAISE(BcList_eBadIndex,(void*)list,(void*)idx);
+            BcRAISE(BcList_eBadIndex,(void*)list,(void*)(CARDPTR)idx);
         }
         oldObject=plist->elements[idx];
         plist->elements[idx]=newObject;
diff --git a/bclib/sources/BcMem.c b/bclib/sources/BcMem.c
index 984c48d..f64b952 100644
--- a/bclib/sources/BcMem.c
+++ b/bclib/sources/BcMem.c
@@ -37,7 +37,7 @@ MODIFICATIONS
                     in the same sources.
     1993-12-06 <PJB> Added Fill.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bclib library.

@@ -77,11 +77,11 @@ LEGAL
             void*       p;

         if(size==0){
-            BcRAISE(BcMem_eRequestedNullSize,(void*)size,NIL);
+            BcRAISE(BcMem_eRequestedNullSize,(void*)(CARDPTR)size,NIL);
         }
         p=malloc((size_t)size);
         if(p==NIL){
-            BcRAISE(BcMem_eMallocReturnedNIL,(void*)size,NIL);
+            BcRAISE(BcMem_eMallocReturnedNIL,(void*)(CARDPTR)size,NIL);
         }
         return(p);
     }/*BcMem_Allocate;*/
@@ -101,34 +101,34 @@ LEGAL
             CARD32*         p4;

         p1=p;
-        if((size>=sizeof(CARD8))AND((((CARD32)p1)&(sizeof(CARD8)))!=0)){
+        if((size>=sizeof(CARD8)) AND ((((CARDPTR)p1)&((CARDPTR)(sizeof(CARD8))))!=0)){
             (*p1)=(CARD8)0;
             INC(p1);
-            size-=sizeof(CARD8);
+            size-=(CARD32)sizeof(CARD8);
         }
         p2=(CARD16*)p1;
-        if((size>=sizeof(CARD16))AND((((CARD32)p2)&(sizeof(CARD16)))!=0)){
+        if((size>=sizeof(CARD16))AND((((CARDPTR)p2)&(CARDPTR)(sizeof(CARD16)))!=0)){
             (*p2)=(CARD16)0;
             INC(p2);
-            size-=sizeof(CARD16);
+            size-=(CARD32)sizeof(CARD16);
         }
         p4=(CARD32*)p2;
         while(size>=sizeof(CARD32)){
             (*p4)=0;
             INC(p4);
-            size-=sizeof(CARD32);
+            size-=(CARD32)sizeof(CARD32);
         }
         p2=(CARD16*)p4;
         if(size>=sizeof(CARD16)){
             (*p2)=(CARD16)0;
             INC(p2);
-            size-=sizeof(CARD16);
+            size-=(CARD32)sizeof(CARD16);
         }
         p1=(CARD8*)p2;
         if(size>=sizeof(CARD8)){
             (*p1)=(CARD8)0;
             INC(p1);
-            size-=sizeof(CARD8);
+            size-=(CARD32)sizeof(CARD8);
         }
     }/*BcMem_Clear;*/

@@ -147,34 +147,34 @@ LEGAL

         fill.array[0]=fill.array[1]=fill.array[2]=fill.array[3]=value;
         p1=p;
-        if((size>=sizeof(CARD8))AND((((CARD32)p1)&(sizeof(CARD8)))!=0)){
+        if((size>=sizeof(CARD8))AND((((CARDPTR)p1)&(CARDPTR)(sizeof(CARD8)))!=0)){
             (*p1)=fill.byte;
             INC(p1);
-            size-=sizeof(CARD8);
+            size-=(CARD32)sizeof(CARD8);
         }
         p2=(CARD16*)p1;
-        if((size>=sizeof(CARD16))AND((((CARD32)p2)&(sizeof(CARD16)))!=0)){
+        if((size>=sizeof(CARD16))AND((((CARDPTR)p2)&(CARDPTR)(sizeof(CARD16)))!=0)){
             (*p2)=fill.word;
             INC(p2);
-            size-=sizeof(CARD16);
+            size-=(CARD32)sizeof(CARD16);
         }
         p4=(CARD32*)p2;
         while(size>=sizeof(CARD32)){
             (*p4)=fill.longword;
             INC(p4);
-            size-=sizeof(CARD32);
+            size-=(CARD32)sizeof(CARD32);
         }
         p2=(CARD16*)p4;
         if(size>=sizeof(CARD16)){
             (*p2)=fill.word;
             INC(p2);
-            size-=sizeof(CARD16);
+            size-=(CARD32)sizeof(CARD16);
         }
         p1=(CARD8*)p2;
         if(size>=sizeof(CARD8)){
             (*p1)=fill.byte;
             INC(p1);
-            size-=sizeof(CARD8);
+            size-=(CARD32)sizeof(CARD8);
         }
     }/*BcMem_Fill;*/

@@ -186,8 +186,8 @@ LEGAL
             const CARD32*   f4;
             CARD32*         t4;

-        if((((CARD32)from)&1)!=(((CARD32)to)&1)){
-            if((CARD32)from<(CARD32)to){
+        if((((CARDPTR)from)&1)!=(((CARDPTR)to)&1)){
+            if((CARDPTR)from<(CARDPTR)to){
                 f1=((const CARD8*)from)+size;
                 t1=((CARD8*)to)+size;
                 while(size>0){
@@ -207,10 +207,10 @@ LEGAL
                 }
             }
         }else{
-            if((CARD32)from<(CARD32)to){
+            if((CARDPTR)from<(CARDPTR)to){
                 f1=((const CARD8*)from)+size;
                 t1=((CARD8*)to)+size;
-                while((size>0)&&((((CARD32)from)&3)!=0)){
+                while((size>0)&&((((CARDPTR)from)&3)!=0)){
                     DEC(f1);
                     DEC(t1);
                     (*t1)=(*f1);
@@ -222,7 +222,7 @@ LEGAL
                     DEC(f4);
                     DEC(t4);
                     (*t4)=(*f4);
-                    DECR(size,sizeof(CARD32));
+                    DECR(size,(CARD32)sizeof(CARD32));
                 }
                 f1=(const CARD8*)f4;
                 t1=(CARD8*)t4;
@@ -235,7 +235,7 @@ LEGAL
             }else{
                 f1=from;
                 t1=to;
-                while((size>0)&&((((CARD32)from)&3)!=0)){
+                while((size>0)&&((((CARDPTR)from)&3)!=0)){
                     (*t1)=(*f1);
                     INC(f1);
                     INC(t1);
@@ -247,7 +247,7 @@ LEGAL
                     (*t4)=(*f4);
                     INC(f4);
                     INC(t4);
-                    DECR(size,sizeof(CARD32));
+                    DECR(size,(CARD32)sizeof(CARD32));
                 }
                 f1=(const CARD8*)f4;
                 t1=(CARD8*)t4;
diff --git a/bclib/sources/BcRandom.c b/bclib/sources/BcRandom.c
index e89ed03..ae910e4 100644
--- a/bclib/sources/BcRandom.c
+++ b/bclib/sources/BcRandom.c
@@ -24,7 +24,7 @@ MODIFICATIONS
     1993-09-08 <PJB> Removed RANDOMFILE. Now, the random file is found
                      from environment variable.
 LEGAL
-    Copyright Pascal J. Bourguignon 1990 - 2002
+    Copyright Pascal J. Bourguignon 1990 - 2011

     This file is part of the bclib library.

@@ -124,7 +124,8 @@ LEGAL
     {
         INT32       i;
         for(i=0;i<56;i++){
-            fscanf(fd,"%lu",&(X[i]));
+            int err=fscanf(fd,"%"FMT_CARD32,&(X[i]));
+            (void)err;
         }
     }/*load; */

@@ -134,7 +135,7 @@ LEGAL
     {
         INT32       i;
         for(i=0;i<56;i++){
-            fprintf(fd,"%lu ",X[i]);
+            fprintf(fd,"%"FMT_CARD32" ",X[i]);
         }
     }/*save*/

diff --git a/bclib/sources/BcString.c b/bclib/sources/BcString.c
index fdac090..506d395 100644
--- a/bclib/sources/BcString.c
+++ b/bclib/sources/BcString.c
@@ -28,7 +28,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bclib library.

@@ -55,320 +55,316 @@ LEGAL



-    const char BcString_ID[]=
-    "$Id: BcString.c,v 1.3 2004/01/21 06:26:09 pjbpjb Exp $";
+const char BcString_ID[]=
+  "$Id: BcString.c,v 1.3 2004/01/21 06:26:09 pjbpjb Exp $";

-    typedef struct {
-        char*               data;
-        INT32               dlength;
-        INT32               allocation;
-    }                   BcString_S;
-    typedef BcString_S* BcString_P;
+typedef struct {
+    char*               data;
+    INT32               dlength;
+    INT32               allocation;
+}                   BcString_S;
+typedef BcString_S* BcString_P;


 /*
-    INVARIANTS:
-        data#NIL
-        1<=allocation
-        0<=dlength<allocation
-        data[dlength]=(char)0
-        for all i in [0..dlength-1], data[i]#(char)0
+  INVARIANTS:
+  data#NIL
+  1<=allocation
+  0<=dlength<allocation
+  data[dlength]=(char)0
+  for all i in [0..dlength-1], data[i]#(char)0
 */

 #define AllocIncrement  (128)
 #define Minimum(a,b)    (((a)<(b))?(a):(b))


-    PROCEDURE(BcString_SetCapacityCopy,
-            (BcString_T t,INT32 nAllocation,BOOLEAN copy),BcString_T)
+PROCEDURE(BcString_SetCapacityCopy,
+          (BcString_T t,INT32 nAllocation,BOOLEAN copy),BcString_T)

-    {
-            BcString_P      this=(BcString_P)t;
-            char*           nData;
-            INT32           nLength;
+{
+    BcString_P      this=(BcString_P)t;
+    char*           nData;
+    INT32           nLength;

-        if(nAllocation>1){
-            nData=BcMem_Allocate(sizeof(char)*nAllocation);
-            if(copy){
-                nLength=Minimum(nAllocation-1,this->dlength);
-                BcMem_Copy(this->data,nData,nLength*sizeof(char));
-            }else{
-                nLength=0;
-            }
+    if(nAllocation>1){
+        nData=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)nAllocation);
+        if(copy){
+            nLength=Minimum(nAllocation-1,this->dlength);
+            BcMem_Copy(this->data,nData,(CARD32)nLength*(CARD32)sizeof(char));
         }else{
-            nAllocation=1;
-            nData=BcMem_Allocate(sizeof(char)*nAllocation);
             nLength=0;
         }
-        nData[nLength]=(char)0;
-        BcMem_Deallocate((void**)(&(this->data)));
-        this->data=nData;
-        this->dlength=nLength;
-        this->allocation=nAllocation;
-        return(this);
-    }/*setCapacity;*/
+    }else{
+        nAllocation=1;
+        nData=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)nAllocation);
+        nLength=0;
+    }
+    nData[nLength]=(char)0;
+    BcMem_Deallocate((void**)(&(this->data)));
+    this->data=nData;
+    this->dlength=nLength;
+    this->allocation=nAllocation;
+    return(this);
+}/*setCapacity;*/


 /* birth and death:*/

-    PROCEDURE(BcString_Allocate,(void),BcString_T)
-    {
-            BcString_P      this;
-        this=BcMem_Allocate(sizeof(BcString_S));
-        this->allocation=1;
-        this->data=BcMem_Allocate(sizeof(char)*this->allocation);
-        this->dlength=0;
-        this->data[this->dlength]=(char)0;
-        return(this);
-    }/*BcString;*/
+PROCEDURE(BcString_Allocate,(void),BcString_T)
+{
+    BcString_P      this;
+    this=BcMem_Allocate(sizeof(BcString_S));
+    this->allocation=1;
+    this->data=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)(this->allocation));
+    this->dlength=0;
+    this->data[this->dlength]=(char)0;
+    return(this);
+}/*BcString;*/

-    PROCEDURE(BcString_Deallocate,(BcString_T* t),void)
-    {
-            BcString_P      this=(BcString_P)(*t);
+PROCEDURE(BcString_Deallocate,(BcString_T* t),void)
+{
+    BcString_P      this=(BcString_P)(*t);

-        BcString_SetCapacityCopy(this,0,FALSE);
-        BcMem_Deallocate(t);
-    }/*~BcString;*/
+    BcString_SetCapacityCopy(this,0,FALSE);
+    BcMem_Deallocate(t);
+}/*~BcString;*/


 /* override BcObject methods:*/

-    PROCEDURE(BcString_ClassName,(BcString_T t),const char*)
-    {
+PROCEDURE(BcString_ClassName,(BcString_T t),const char*)
+{
 #ifdef MSVC
-        t=t;
+    t=t;
 #endif
-        return("BcString");
-    }/*className;*/
+    return("BcString");
+}/*className;*/


-    PROCEDURE(BcString_PrintOn,(BcString_T t,FILE* file),void)
-    {
-            BcString_P      this=(BcString_P)t;
+PROCEDURE(BcString_PrintOn,(BcString_T t,FILE* file),void)
+{
+    BcString_P      this=(BcString_P)t;

-        /* BcString_SUPER::printOn(file); */
-        fprintf(file,"data=           %p\n",(void*)(this->data));
-        if(this->data!=NIL){
-            fprintf(file,"*data=          \"%s\"\n",this->data);
-        }
-        fprintf(file,"dlength=         %ld\n",this->dlength);
-        fprintf(file,"allocation=     %ld\n",this->allocation);
-    }/*printOn:;*/
+    /* BcString_SUPER::printOn(file); */
+    fprintf(file,"data=           %p\n",(void*)(this->data));
+    if(this->data!=NIL){
+        fprintf(file,"*data=          \"%s\"\n",this->data);
+    }
+    fprintf(file,"dlength=        %"FMT_INT32"\n",this->dlength);
+    fprintf(file,"allocation=     %"FMT_INT32"\n",this->allocation);
+}/*printOn:;*/


 /* new methods:*/

-    PROCEDURE(BcString_Length,(BcString_T t),INT32)
-    {
-            BcString_P      this=(BcString_P)t;
+PROCEDURE(BcString_Length,(BcString_T t),INT32)
+{
+    BcString_P      this=(BcString_P)t;

-        return(this->dlength);
-    }/*length;*/
+    return(this->dlength);
+}/*length;*/


-    PROCEDURE(BcString_String,(BcString_T t),const char*)
-    {
-            BcString_P      this=(BcString_P)t;
+PROCEDURE(BcString_String,(BcString_T t),const char*)
+{
+    BcString_P      this=(BcString_P)t;

-        return(this->data);
-    }/*string;*/
+    return(this->data);
+}/*string;*/


-    PROCEDURE(BcString_SetString,
-                (BcString_T t,const char* nString),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-            INT32           nLength;
+PROCEDURE(BcString_SetString,
+          (BcString_T t,const char* nString),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+    INT32           nLength;

-        nLength=strlen(nString);
-        if(nLength>=this->allocation){
-            BcString_SetCapacityCopy(this,nLength+1,FALSE);
-        }
-        BcMem_Copy((const void*)nString,this->data,nLength*sizeof(char));
-        this->data[nLength]=(char)0;
-        this->dlength=nLength;
-        return(this);
-    }/*setString:;*/
-
-
-    PROCEDURE(BcString_GetString,(BcString_T t,char* string),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-
-        BcMem_Copy(this->data,string,this->dlength*sizeof(char));
-        string[this->dlength]=(char)0;
-        return(this);
-    }/*getString:;*/
+    nLength=(INT32)strlen(nString);
+    if(nLength>=this->allocation){
+        BcString_SetCapacityCopy(this,nLength+1,FALSE);
+    }
+    BcMem_Copy((const void*)nString,this->data,(CARD32)nLength*(CARD32)sizeof(char));
+    this->data[nLength]=(char)0;
+    this->dlength=nLength;
+    return(this);
+}/*setString:;*/
+
+
+PROCEDURE(BcString_GetString,(BcString_T t,char* string),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+
+    BcMem_Copy(this->data,string,(CARD32)(this->dlength)*(CARD32)sizeof(char));
+    string[this->dlength]=(char)0;
+    return(this);
+}/*getString:;*/


-    PROCEDURE(BcString_AppendString,(BcString_T t,const char* str),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-            INT32           nLength;
-            INT32           sLength;
+PROCEDURE(BcString_AppendString,(BcString_T t,const char* str),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+    INT32           nLength;
+    INT32           sLength;

-        sLength=strlen(str);
-        nLength=sLength+this->dlength;
-        if(nLength>=this->allocation){
-            BcString_SetCapacityCopy(this,nLength+1,TRUE);
-        }
-        BcMem_Copy((const void*)str,
-                   this->data+this->dlength,sLength*sizeof(char));
-        this->data[nLength]=(char)0;
-        this->dlength=nLength;
-        return(this);
-    }/*BcString_AppendString*/
+    sLength=(INT32)strlen(str);
+    nLength=sLength+this->dlength;
+    if(nLength>=this->allocation){
+        BcString_SetCapacityCopy(this,nLength+1,TRUE);
+    }
+    BcMem_Copy((const void*)str,this->data+this->dlength,(CARD32)sLength*(CARD32)sizeof(char));
+    this->data[nLength]=(char)0;
+    this->dlength=nLength;
+    return(this);
+}/*BcString_AppendString*/


-    PROCEDURE(BcString_CharAt,(BcString_T t,INT32 idx),char)
-    {
-            BcString_P      this=(BcString_P)t;
-
-        if((idx<0)OR(idx>=this->dlength)){
-            return((char)0);
-        }else{
-            return(this->data[idx]);
-        }
-    }/*charAt:;*/
-
-
-    PROCEDURE(BcString_SetCharAt,
-                (BcString_T t,char nChar,INT32 idx),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-
-        if((0<=idx)AND(idx<=this->dlength)){
-            if(nChar==(char)0){
-                this->dlength=idx;
-            }else if(idx==this->dlength){
-                if(this->allocation<=this->dlength+1){
-                    BcString_SetCapacityCopy(this,
-                                    this->allocation+AllocIncrement,TRUE);
-                }
-                INC(this->dlength);
-                this->data[this->dlength]=(char)0;
+PROCEDURE(BcString_CharAt,(BcString_T t,INT32 idx),char)
+{
+    BcString_P      this=(BcString_P)t;
+
+    if((idx<0)OR(idx>=this->dlength)){
+        return((char)0);
+    }else{
+        return(this->data[idx]);
+    }
+}/*charAt:;*/
+
+
+PROCEDURE(BcString_SetCharAt,
+          (BcString_T t,char nChar,INT32 idx),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+
+    if((0<=idx)AND(idx<=this->dlength)){
+        if(nChar==(char)0){
+            this->dlength=idx;
+        }else if(idx==this->dlength){
+            if(this->allocation<=this->dlength+1){
+                BcString_SetCapacityCopy(this,
+                                         this->allocation+AllocIncrement,TRUE);
             }
-            this->data[idx]=nChar;
+            INC(this->dlength);
+            this->data[this->dlength]=(char)0;
         }
-        return(this);
-    }/*setChar:;*/
+        this->data[idx]=nChar;
+    }
+    return(this);
+}/*setChar:;*/



-    PROCEDURE(BcString_InsertAt,
-                (BcString_T t,BcString_T substring,INT32 idx),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-            BcString_P      sub=(BcString_P)substring;
-            INT32           nLength;
-
-        if(idx<0){
-            idx=0;
-        }else if(this->dlength<idx){
-            idx=this->dlength;
-        }
-        nLength=this->dlength+sub->dlength;
-        if(nLength>=this->allocation){
-            /* SEE: We copy some char of this twice !*/
-            BcString_SetCapacityCopy(this,nLength+1,TRUE);
-        }
-        BcMem_Copy(this->data+idx,
-                    this->data+idx+sub->dlength,
-                    (this->dlength-idx+1)*sizeof(char));
-        BcMem_Copy(sub->data,
-                    this->data+idx,
-                    sub->dlength*sizeof(char));
-        this->dlength=nLength;
-        return(this);
-    }/*insert:at:;*/
-
-
-    PROCEDURE(BcString_DeleteFromLength,
-                (BcString_T t,INT32 idx,INT32 delen),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-
-        if(idx<0){
-            idx=0;
-        }else if(this->dlength<=idx){
-            return(this);
-        }
-        if(this->dlength<idx+delen){
-            delen=this->dlength-idx;
-        }
-        BcMem_Copy(this->data+idx+delen,this->data+idx,
-                    (this->dlength-(idx+delen)+1)*sizeof(char));
-        this->dlength=this->dlength-delen;
+PROCEDURE(BcString_InsertAt,
+          (BcString_T t,BcString_T substring,INT32 idx),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+    BcString_P      sub=(BcString_P)substring;
+    INT32           nLength;
+
+    if(idx<0){
+        idx=0;
+    }else if(this->dlength<idx){
+        idx=this->dlength;
+    }
+    nLength=this->dlength+sub->dlength;
+    if(nLength>=this->allocation){
+        /* SEE: We copy some char of this twice !*/
+        BcString_SetCapacityCopy(this,nLength+1,TRUE);
+    }
+    BcMem_Copy(this->data+idx,
+               this->data+idx+sub->dlength,
+               (CARD32)(this->dlength-idx+1)*(CARD32)sizeof(char));
+    BcMem_Copy(sub->data,
+               this->data+idx,
+               (CARD32)(sub->dlength)*(CARD32)sizeof(char));
+    this->dlength=nLength;
+    return(this);
+}/*insert:at:;*/
+
+
+PROCEDURE(BcString_DeleteFromLength,
+          (BcString_T t,INT32 idx,INT32 delen),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+
+    if(idx<0){
+        idx=0;
+    }else if(this->dlength<=idx){
         return(this);
-    }/*deleteFrom:dlength:;*/
-
-
-    PROCEDURE(BcString_PositionFrom,
-                (BcString_T t,BcString_T substring,INT32 idx),INT32)
-    {
-        /* SEE: could we use the FastStringSearch algorithm?*/
-            BcString_P      this=(BcString_P)t;
-            BcString_P      sub=(BcString_P)substring;
-            INT32           pos;
-            INT32           i;
-            INT32           max;
+    }
+    if(this->dlength<idx+delen){
+        delen=this->dlength-idx;
+    }
+    BcMem_Copy(this->data+idx+delen,this->data+idx,
+               (CARD32)(this->dlength-(idx+delen)+1)*(CARD32)sizeof(char));
+    this->dlength=this->dlength-delen;
+    return(this);
+}/*deleteFrom:dlength:;*/
+
+
+PROCEDURE(BcString_PositionFrom,
+          (BcString_T t,BcString_T substring,INT32 idx),INT32)
+{
+    /* SEE: could we use the FastStringSearch algorithm?*/
+    BcString_P      this=(BcString_P)t;
+    BcString_P      sub=(BcString_P)substring;
+    INT32           pos;
+    INT32           i;
+    INT32           max;

-        max=this->dlength-sub->dlength;
-        if(idx<0){
-            pos=0;
-        }else{
-            pos=idx;
-        }
-        while(pos<=max){
-            i=0;
-            while(this->data[pos+i]==sub->data[i]){
-                INC(i);
-            }
-            if(sub->data[i]==(char)0){
-                return(pos);
-            }
-            INC(pos);
-        }
-        /* not found*/
-        return(-1);
-    }/*position:;*/
-
-
-    PROCEDURE(BcString_CopyFromLength,
-            (BcString_T t,BcString_T string,INT32 idx,INT32 copylen),
-            BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-            BcString_P      str=(BcString_P)string;
-
-        if(idx+copylen>str->dlength){
-            copylen=str->dlength-idx;
+    max=this->dlength-sub->dlength;
+    if(idx<0){
+        pos=0;
+    }else{
+        pos=idx;
+    }
+    while(pos<=max){
+        i=0;
+        while(this->data[pos+i]==sub->data[i]){
+            INC(i);
         }
-        if(copylen<=0){
-            this->data[0]=(char)0;
-            this->dlength=0;
-            return(this);
+        if(sub->data[i]==(char)0){
+            return(pos);
         }
-        if(copylen>=this->allocation){
-            BcString_SetCapacityCopy(this,copylen+1,FALSE);
-        }
-        BcMem_Copy(str->data+idx,this->data,copylen*sizeof(char));
-        this->data[copylen]=(char)0;
-        this->dlength=copylen;
+        INC(pos);
+    }
+    /* not found*/
+    return(-1);
+}/*position:;*/
+
+
+PROCEDURE(BcString_CopyFromLength,
+          (BcString_T t,BcString_T string,INT32 idx,INT32 copylen),
+          BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+    BcString_P      str=(BcString_P)string;
+
+    if(idx+copylen>str->dlength){
+        copylen=str->dlength-idx;
+    }
+    if(copylen<=0){
+        this->data[0]=(char)0;
+        this->dlength=0;
         return(this);
-    }/*copy:from:dlength:;*/
-
-
-    PROCEDURE(BcString_Append,(BcString_T t,BcString_T tail),BcString_T)
-    {
-            BcString_P      this=(BcString_P)t;
-
-        return(BcString_InsertAt(this,tail,this->dlength));
-    }/*append:;*/
+    }
+    if(copylen>=this->allocation){
+        BcString_SetCapacityCopy(this,copylen+1,FALSE);
+    }
+    BcMem_Copy(str->data+idx,this->data,(CARD32)copylen*(CARD32)sizeof(char));
+    this->data[copylen]=(char)0;
+    this->dlength=copylen;
+    return(this);
+}/*copy:from:dlength:;*/
+
+
+PROCEDURE(BcString_Append,(BcString_T t,BcString_T tail),BcString_T)
+{
+    BcString_P      this=(BcString_P)t;
+
+    return(BcString_InsertAt(this,tail,this->dlength));
+}/*append:;*/



 /*END BcString.*/
-
-
-/*** BcString.c                       -- 2003-11-30 07:25:46 -- pascal   ***/
diff --git a/benlib/interfaces/Bencoding.h b/benlib/interfaces/Bencoding.h
index d4e67b1..83fed84 100644
--- a/benlib/interfaces/Bencoding.h
+++ b/benlib/interfaces/Bencoding.h
@@ -15,7 +15,7 @@ MODIFICATIONS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon 1991 - 2003
+    Copyright Pascal J. Bourguignon 1991 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/benlib/sources/Bencoding.c b/benlib/sources/Bencoding.c
index 364a5e6..decaa04 100644
--- a/benlib/sources/Bencoding.c
+++ b/benlib/sources/Bencoding.c
@@ -14,7 +14,7 @@ MODIFICATIONS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 2003 - 2003
+    Copyright Pascal Bourguignon 2003 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -69,17 +69,13 @@ LEGAL
     {
         eSize=32;
         eCount=0;
-        encodingTableNames=(const char**)
-            malloc(sizeof(const char*)*eSize);
-        encodingTables=(BenEncodingTableT**)
-            malloc(sizeof(BenEncodingTableT*)*eSize);
+        encodingTableNames=(const char**)malloc(sizeof(const char*)*(size_t)eSize);
+        encodingTables=(BenEncodingTableT**)malloc(sizeof(BenEncodingTableT*)*(size_t)eSize);

         aSize=8;
         aCount=0;
-        approximationTableNames=(const char**)
-            malloc(sizeof(const char*)*aSize);
-        approximationTables=(BenApproximationTableT**)
-            malloc(sizeof(BenApproximationTableT*)*aSize);
+        approximationTableNames=(const char**)malloc(sizeof(const char*)*(size_t)aSize);
+        approximationTables=(BenApproximationTableT**)malloc(sizeof(BenApproximationTableT*)*(size_t)aSize);

         initialized=TRUE;

@@ -145,9 +141,8 @@ LEGAL
             const char**         nNames;
             BenEncodingTableT** nTables;
             eSize*=2;
-            nNames=(const char**)malloc(sizeof(const char*)*eSize);
-            nTables=(BenEncodingTableT**)
-                malloc(sizeof(BenEncodingTableT*)*eSize);
+            nNames=(const char**)malloc(sizeof(const char*)*(size_t)eSize);
+            nTables=(BenEncodingTableT**)malloc(sizeof(BenEncodingTableT*)*(size_t)eSize);
             for(i=0;i<eCount;i++){
                 nNames[i]=encodingTableNames[i];
                 nTables[i]=encodingTables[i];
@@ -219,9 +214,8 @@ LEGAL
             const char**              nNames;
             BenApproximationTableT** nTables;
             aSize*=2;
-            nNames=(const char**)malloc(sizeof(const char*)*aSize);
-            nTables=(BenApproximationTableT**)
-                malloc(sizeof(BenApproximationTableT*)*aSize);
+            nNames=(const char**)malloc(sizeof(const char*)*(size_t)aSize);
+            nTables=(BenApproximationTableT**)malloc(sizeof(BenApproximationTableT*)*(size_t)aSize);
             for(i=0;i<aCount;i++){
                 nNames[i]=approximationTableNames[i];
                 nTables[i]=approximationTables[i];
@@ -392,12 +386,12 @@ LEGAL
     {
         BcString_T result=BcString_Allocate();
         char buffer[1024];
-        int ml=0;
+        size_t ml=0;
         int i;

         /* Get the longest converted string */
         for(i=0;i<256;i++){
-            int l=strlen((*table)[i]);
+            size_t l=strlen((*table)[i]);
             if(l>ml){
                 ml=l;
             }
diff --git a/benlib/sources/approxim.c b/benlib/sources/approxim.c
index 37bfc21..5208812 100644
--- a/benlib/sources/approxim.c
+++ b/benlib/sources/approxim.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/approxim.h b/benlib/sources/approxim.h
index 8aed8ee..d664442 100644
--- a/benlib/sources/approxim.h
+++ b/benlib/sources/approxim.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/apraccen.c b/benlib/sources/apraccen.c
index 4a9f016..adff609 100644
--- a/benlib/sources/apraccen.c
+++ b/benlib/sources/apraccen.c
@@ -21,7 +21,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1999
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/apraccen.h b/benlib/sources/apraccen.h
index e6f0b9c..680a08c 100644
--- a/benlib/sources/apraccen.h
+++ b/benlib/sources/apraccen.h
@@ -21,7 +21,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1999
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encascii.c b/benlib/sources/encascii.c
index bfb3b39..7d9bf35 100644
--- a/benlib/sources/encascii.c
+++ b/benlib/sources/encascii.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encascii.h b/benlib/sources/encascii.h
index aad6c80..c884a41 100644
--- a/benlib/sources/encascii.h
+++ b/benlib/sources/encascii.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encebcdi.c b/benlib/sources/encebcdi.c
index 2bd8e1e..dcdd303 100644
--- a/benlib/sources/encebcdi.c
+++ b/benlib/sources/encebcdi.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encebcdi.h b/benlib/sources/encebcdi.h
index 42ee305..700fba2 100644
--- a/benlib/sources/encebcdi.h
+++ b/benlib/sources/encebcdi.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/ench2bcd.c b/benlib/sources/ench2bcd.c
index f778a5f..81124bf 100644
--- a/benlib/sources/ench2bcd.c
+++ b/benlib/sources/ench2bcd.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/ench2bcd.h b/benlib/sources/ench2bcd.h
index b9a1145..74975fd 100644
--- a/benlib/sources/ench2bcd.h
+++ b/benlib/sources/ench2bcd.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/ench6bcd.c b/benlib/sources/ench6bcd.c
index 1072a5c..7fd8b4a 100644
--- a/benlib/sources/ench6bcd.c
+++ b/benlib/sources/ench6bcd.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/ench6bcd.h b/benlib/sources/ench6bcd.h
index 7280ba5..2bdc017 100644
--- a/benlib/sources/ench6bcd.h
+++ b/benlib/sources/ench6bcd.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encibbcd.c b/benlib/sources/encibbcd.c
index 4cbdb66..24437ef 100644
--- a/benlib/sources/encibbcd.c
+++ b/benlib/sources/encibbcd.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encibbcd.h b/benlib/sources/encibbcd.h
index e440d5c..e508b0e 100644
--- a/benlib/sources/encibbcd.h
+++ b/benlib/sources/encibbcd.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encisla1.c b/benlib/sources/encisla1.c
index f22c619..557df4b 100644
--- a/benlib/sources/encisla1.c
+++ b/benlib/sources/encisla1.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encisla1.h b/benlib/sources/encisla1.h
index 27deb0a..8fa2674 100644
--- a/benlib/sources/encisla1.h
+++ b/benlib/sources/encisla1.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmacos.c b/benlib/sources/encmacos.c
index 7b7489a..39499a9 100644
--- a/benlib/sources/encmacos.c
+++ b/benlib/sources/encmacos.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmacos.h b/benlib/sources/encmacos.h
index 996cff0..4b4e4f0 100644
--- a/benlib/sources/encmacos.h
+++ b/benlib/sources/encmacos.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmsdos.c b/benlib/sources/encmsdos.c
index f83d136..209bb2b 100644
--- a/benlib/sources/encmsdos.c
+++ b/benlib/sources/encmsdos.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmsdos.h b/benlib/sources/encmsdos.h
index 0f9838d..a57d477 100644
--- a/benlib/sources/encmsdos.h
+++ b/benlib/sources/encmsdos.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmswin.c b/benlib/sources/encmswin.c
index 651b4e1..645c165 100644
--- a/benlib/sources/encmswin.c
+++ b/benlib/sources/encmswin.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encmswin.h b/benlib/sources/encmswin.h
index 0a0d4c6..140440e 100644
--- a/benlib/sources/encmswin.h
+++ b/benlib/sources/encmswin.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encnxstp.c b/benlib/sources/encnxstp.c
index 1beaa45..8a066b1 100644
--- a/benlib/sources/encnxstp.c
+++ b/benlib/sources/encnxstp.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encnxstp.h b/benlib/sources/encnxstp.h
index 01fd05a..873d03b 100644
--- a/benlib/sources/encnxstp.h
+++ b/benlib/sources/encnxstp.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encpsstd.c b/benlib/sources/encpsstd.c
index 186b465..f922431 100644
--- a/benlib/sources/encpsstd.c
+++ b/benlib/sources/encpsstd.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encpsstd.h b/benlib/sources/encpsstd.h
index 58f310f..ce6fa70 100644
--- a/benlib/sources/encpsstd.h
+++ b/benlib/sources/encpsstd.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encsymbl.c b/benlib/sources/encsymbl.c
index 413cda3..56b25ce 100644
--- a/benlib/sources/encsymbl.c
+++ b/benlib/sources/encsymbl.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encsymbl.h b/benlib/sources/encsymbl.h
index dea153d..601fb0f 100644
--- a/benlib/sources/encsymbl.h
+++ b/benlib/sources/encsymbl.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/enctypes.h b/benlib/sources/enctypes.h
index 59a2381..310a370 100644
--- a/benlib/sources/enctypes.h
+++ b/benlib/sources/enctypes.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encunifd.c b/benlib/sources/encunifd.c
index a26db0c..3678853 100644
--- a/benlib/sources/encunifd.c
+++ b/benlib/sources/encunifd.c
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/benlib/sources/encunifd.h b/benlib/sources/encunifd.h
index d7587a2..a99d329 100644
--- a/benlib/sources/encunifd.h
+++ b/benlib/sources/encunifd.h
@@ -19,7 +19,7 @@ MODIFICATIONS
     Fist check-in.

 LEGAL
-    Copyright Pascal J. Bourguignon 1991 - 1994
+    Copyright Pascal J. Bourguignon 1991 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bjlib/interfaces/bjarray.h b/bjlib/interfaces/bjarray.h
index f103c0e..5b9799a 100644
--- a/bjlib/interfaces/bjarray.h
+++ b/bjlib/interfaces/bjarray.h
@@ -18,7 +18,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     2000 - 2001
+    Copyright Pascal J. Bourguignon 2000 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/interfaces/bjdict.h b/bjlib/interfaces/bjdict.h
index a184a4a..3636dfc 100644
--- a/bjlib/interfaces/bjdict.h
+++ b/bjlib/interfaces/bjdict.h
@@ -20,7 +20,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1995 - 2001
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/interfaces/bjfile.h b/bjlib/interfaces/bjfile.h
index 5131229..5330d15 100644
--- a/bjlib/interfaces/bjfile.h
+++ b/bjlib/interfaces/bjfile.h
@@ -16,7 +16,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon 2000 - 2001
+    Copyright Pascal J. Bourguignon 2000 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/interfaces/bjobject.h b/bjlib/interfaces/bjobject.h
index 551a34c..5452f71 100644
--- a/bjlib/interfaces/bjobject.h
+++ b/bjlib/interfaces/bjobject.h
@@ -82,7 +82,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1992 - 2001
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/interfaces/bjstring.h b/bjlib/interfaces/bjstring.h
index 70adc1d..0d00480 100644
--- a/bjlib/interfaces/bjstring.h
+++ b/bjlib/interfaces/bjstring.h
@@ -34,7 +34,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1993 - 2003
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/interfaces/bjstring_list.h b/bjlib/interfaces/bjstring_list.h
index af60b5b..9bf2977 100644
--- a/bjlib/interfaces/bjstring_list.h
+++ b/bjlib/interfaces/bjstring_list.h
@@ -15,7 +15,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 2003 - 2003
+    Copyright Pascal Bourguignon 2003 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/sources/bjarray.c b/bjlib/sources/bjarray.c
index bcb3ae8..c9136f9 100644
--- a/bjlib/sources/bjarray.c
+++ b/bjlib/sources/bjarray.c
@@ -18,7 +18,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     2000 - 2001
+    Copyright Pascal J. Bourguignon 2000 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -80,8 +80,7 @@ LEGAL
         bjarray_t* that=bjobject_new(sizeof(*that),&bjarray_methods);
         that->size=size;
         that->count=0;
-        that->elements=(void**)bjobject_new(
-            sizeof(*(that->elements))*that->size,0);
+        that->elements=(void**)bjobject_new((int)sizeof(*(that->elements))*that->size,0);
         bjobject_retain(that->elements);
         for(i=that->count;i<that->size;i++){
             that->elements[i]=0;
@@ -125,7 +124,7 @@ LEGAL
             minSize=that->size;
         }
         that->size=newSize;
-        elements=(void**)bjobject_new(sizeof(*elements)*that->size,0);
+        elements=(void**)bjobject_new((int)sizeof(*elements)*that->size,0);
         /* We're just transfering the elements[i], no need to release/retain! */
         for(i=0;i<minSize;i++){
             elements[i]=that->elements[i];
diff --git a/bjlib/sources/bjdict.c b/bjlib/sources/bjdict.c
index dfa59fc..dd2974b 100644
--- a/bjlib/sources/bjdict.c
+++ b/bjlib/sources/bjdict.c
@@ -20,7 +20,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1995 - 2001
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bjlib/sources/bjfile.c b/bjlib/sources/bjfile.c
index 8e6f3fd..e314573 100644
--- a/bjlib/sources/bjfile.c
+++ b/bjlib/sources/bjfile.c
@@ -18,7 +18,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon 2000 - 2001
+    Copyright Pascal J. Bourguignon 2000 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -80,7 +80,7 @@ LEGAL
         if((that==0)||(that->error!=0)){
             return(-1);
         }else{
-            return(that->statistics.st_size);
+            return((int)(that->statistics.st_size));
         }
     }/*bjfile_size*/

@@ -114,7 +114,7 @@ LEGAL
         if(errno!=0){
             return(0);
         }else{
-            path->length=strlen(path->data);
+            path->length=(unsigned int)strlen(path->data);
             return(path);
         }
     }/*bjfile_current_directory_path*/
diff --git a/bjlib/sources/bjobject.c b/bjlib/sources/bjobject.c
index 9fbc617..4886122 100644
--- a/bjlib/sources/bjobject.c
+++ b/bjlib/sources/bjobject.c
@@ -49,7 +49,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1992 - 2001
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -116,7 +116,7 @@ LEGAL
         that=(bcpurgatory_t*)malloc(sizeof(*that));
         that->count=0;
         that->size=256;
-        that->objects=(bjobject_t**)malloc(sizeof(*(that->objects))*that->size);
+        that->objects=(bjobject_t**)malloc(sizeof(*(that->objects))*(size_t)(that->size));
         return(that);
     }/*bcpurgatory_new*/

@@ -144,7 +144,7 @@ LEGAL
             bjobject_t**       objects;
             int                 i;
             that->size*=2;
-            objects=(bjobject_t**)malloc(sizeof(*objects)*that->size);
+            objects=(bjobject_t**)malloc(sizeof(*objects)*(size_t)(that->size));
             for(i=0;i<that->count;i++){
                 objects[i]=that->objects[i];
             }
diff --git a/bjlib/sources/bjstring.c b/bjlib/sources/bjstring.c
index a1e138f..42af091 100644
--- a/bjlib/sources/bjstring.c
+++ b/bjlib/sources/bjstring.c
@@ -34,7 +34,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1993 - 2003
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -64,7 +64,7 @@ LEGAL
     const char bjstring_id[]=
     "$Id: bjstring.c,v 1.2 2004/10/27 03:38:20 pupjb Exp $";

-    static const int AllocIncrement=128;
+    static const unsigned int AllocIncrement=128;

 /*
     INVARIANTS:
@@ -155,12 +155,12 @@ LEGAL
     bjstring_t*  bjstring_new_repeat(const char* string,unsigned int count)
     {
         bjstring_t* that=bjstring_new();
-        unsigned int length=strlen(string);
-        unsigned int pos=0;
+        size_t length=strlen(string);
+        size_t pos=0;
         if(count<0){
             count=0;
         }
-        bjstring_set_capacity_copy(that,length*count,no);
+        bjstring_set_capacity_copy(that,(unsigned int)(length*count),no);
         while(count>0){
             memmove(/*dst*/that->data+pos,
                     /*src*/string,
@@ -168,7 +168,7 @@ LEGAL
             pos+=length;
             count--;
         }
-        that->length=pos;
+        that->length=(unsigned int)pos;
         that->data[that->length]='\0';
         return(that);
     }/*bjstring_new_repeat*/
@@ -276,7 +276,7 @@ LEGAL

     void bjstring_set_string(bjstring_t* that,const char* nString)
     {
-        bjstring_set_chars(that,nString,strlen(nString));
+        bjstring_set_chars(that,nString,(unsigned int)strlen(nString));
     }/*set_string*/


@@ -295,8 +295,8 @@ LEGAL

     void bjstring_append_string(bjstring_t* that,const char* str)
     {
-        unsigned int    nLength;
-        unsigned int    sLength;
+        size_t    nLength;
+        size_t    sLength;

         if((that==0)||(str==0)){
             return;
@@ -304,13 +304,13 @@ LEGAL
         sLength=strlen(str);
         nLength=that->length+sLength;
         if(nLength>=that->allocation){
-            bjstring_set_capacity_copy(that,nLength,yes);
+            bjstring_set_capacity_copy(that,(unsigned int)nLength,yes);
         }
         if(that->data!=empty_data){
             memmove(/*dst*/that->data+that->length,
                     /*src*/str,
                     /*len*/sizeof(*(that->data))*sLength);
-            that->length=nLength;
+            that->length=(unsigned int)nLength;
             that->data[that->length]='\0';
         }
     }/*bjstring_append_string*/
@@ -342,8 +342,7 @@ LEGAL
                 }
             }else if(idx==that->length){
                 if(that->allocation<=that->length+1){
-                    bjstring_set_capacity_copy(
-                        that,that->allocation+AllocIncrement,yes);
+                    bjstring_set_capacity_copy(that,that->allocation+AllocIncrement,yes);
                 }
                 that->data[idx]=nChar;
                 that->length++;
@@ -690,8 +689,8 @@ LEGAL
         */
     {
         va_list save_ap;
-        int available; /* to vsnprintf ; up to then, it's "willBeNeeded". */
-        int formatlen;
+        size_t available; /* to vsnprintf ; up to then, it's "willBeNeeded". */
+        size_t formatlen;
         int inc;
         bool firstTime=yes;
         va_copy(save_ap,ap);
@@ -716,9 +715,9 @@ LEGAL
                 }
             }else{
                 /* We know exactly how many bytes are needed. */
-                available=inc+1;
+                available=(unsigned int)(inc+1);
             }
-            bjstring_set_capacity_copy(that,that->length+available,yes);
+            bjstring_set_capacity_copy(that,(unsigned int)(that->length+available),yes);
             ap=save_ap;
             /*
                 We would like to do something like {va_start(ap,format);}
@@ -729,7 +728,7 @@ LEGAL
                           (unsigned)available,format,ap);
             /* va_end(ap); */
         }while((inc<0)||(available<=inc));
-        that->length+=inc;
+        that->length+=(unsigned int)inc;
     }/*bjstring_set_format_va*/


diff --git a/bjlib/sources/bjstring_file.c b/bjlib/sources/bjstring_file.c
index ff083c2..af32e6e 100644
--- a/bjlib/sources/bjstring_file.c
+++ b/bjlib/sources/bjstring_file.c
@@ -20,7 +20,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal J. Bourguignon     1993 - 2001
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -52,7 +52,7 @@ LEGAL
     bjstring_t*  bjstring_new_from_file(const bjstring_t* path)
     {
         bjstring_t* that;
-        int         size;
+        int size;
         FILE*       file;
         size=bjfile_size(bjfile_new_with_path(path));
         if(size<0){
@@ -64,8 +64,7 @@ LEGAL
         }
         that=bjstring_new();
         bjstring_set_capacity_copy(that,(unsigned)size,no);
-        that->length=fread(that->data,sizeof(*(that->data)),
-                           (unsigned)size,file);
+        that->length=(unsigned int)fread(that->data,sizeof(*(that->data)),(size_t)size,file);
         if (that->length!=0)
             that->data[that->length]='\0';
         fclose(file);
@@ -81,7 +80,7 @@ LEGAL
         if(file==0){
             return(-1);
         }
-        result=fwrite(that->data,sizeof(*(that->data)),that->length,file);
+        result=(int)fwrite(that->data,sizeof(*(that->data)),that->length,file);
         fclose(file);
         return(result);
     }/*bjstring_save_to_file*/
@@ -130,7 +129,7 @@ LEGAL
         }else{
             /* read at least part of the line */

-            that->length=strlen(that->data);
+            that->length=(unsigned int)strlen(that->data);
             /*  Note that if the line contains null bytes,
                 it will be truncated and it may be cut if it's longer
                 than the buffer.
@@ -145,17 +144,17 @@ LEGAL
                              (signed)(that->allocation-that->length),input)==0){
                         if(feof(input)){
                             /* end-of-file without end-of-line*/
-                            return(that->length);
+                            return((int)(that->length));
                         }else{
                             /* error */
                             return(-1);
                         }
                     }else{
-                        that->length+=strlen(that->data+that->length);
+                        that->length+=(unsigned int)strlen(that->data+that->length);
                     }
                 }
             }
-            return(that->length);
+            return((int)(that->length));
         }
     }/*bjstring_read_a_line_from_file*/

diff --git a/bjlib/sources/bjstring_list.c b/bjlib/sources/bjstring_list.c
index 1569619..564e67b 100644
--- a/bjlib/sources/bjstring_list.c
+++ b/bjlib/sources/bjstring_list.c
@@ -15,7 +15,7 @@ BUGS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 2003 - 2003
+    Copyright Pascal Bourguignon 2003 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bolib/interfaces/BoArray.h b/bolib/interfaces/BoArray.h
index 31cb962..7895ea5 100644
--- a/bolib/interfaces/BoArray.h
+++ b/bolib/interfaces/BoArray.h
@@ -14,7 +14,7 @@ MODIFICATIONS
     1993/01/18 <PJB> Refined, added exceptions.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1993
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/interfaces/BoList.h b/bolib/interfaces/BoList.h
index 236c52a..901e591 100644
--- a/bolib/interfaces/BoList.h
+++ b/bolib/interfaces/BoList.h
@@ -20,7 +20,7 @@ MODIFICATIONS
                      non-retaining ones. Once created, we cannot change
                      their kind.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1992
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/interfaces/BoListNoRetain.h b/bolib/interfaces/BoListNoRetain.h
index 7dcbd46..328a80c 100644
--- a/bolib/interfaces/BoListNoRetain.h
+++ b/bolib/interfaces/BoListNoRetain.h
@@ -17,7 +17,7 @@ AUTHOR
 MODIFICATIONS
     1996/09/17 <PJB> Creation (from BoList, which becomes a subclass).
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1996
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/interfaces/BoObject.h b/bolib/interfaces/BoObject.h
index 161ec47..b719923 100644
--- a/bolib/interfaces/BoObject.h
+++ b/bolib/interfaces/BoObject.h
@@ -12,7 +12,7 @@ MODIFICATIONS
     1992/10/22 <PJB> Renamed printOn to printOn.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1992
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/interfaces/BoString.h b/bolib/interfaces/BoString.h
index d3a9c43..8965766 100644
--- a/bolib/interfaces/BoString.h
+++ b/bolib/interfaces/BoString.h
@@ -12,7 +12,7 @@ MODIFICATIONS
     1993/01/29 <PJB> Creation.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 1993
+    Copyright Pascal J. Bourguignon 1993 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/interfaces/BoTimer.h b/bolib/interfaces/BoTimer.h
index 87a88b1..e532e9b 100644
--- a/bolib/interfaces/BoTimer.h
+++ b/bolib/interfaces/BoTimer.h
@@ -18,7 +18,7 @@ MODIFICATIONS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 1992 - 2003
+    Copyright Pascal Bourguignon 1992 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bolib/sources/BoArray.m b/bolib/sources/BoArray.m
index f2ac503..411a03b 100644
--- a/bolib/sources/BoArray.m
+++ b/bolib/sources/BoArray.m
@@ -14,7 +14,7 @@ MODIFICATIONS
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
     1996/04/20 <PJB> Updated to use retain/release BoObjects.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1996
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -38,11 +38,11 @@ LEGAL
             CARD32          i;

         [super printOn:file];
-        fprintf(file,"size=           %8lu\n",size);
-        fprintf(file,"psize=          %8lu\n",psize);
+        fprintf(file,"size=           %8"FMT_CARD32"\n",size);
+        fprintf(file,"psize=          %8"FMT_CARD32"\n",psize);
         i=0;
         while(i<size){
-            fprintf(file,"[%4lu]=         %p\n",i,(void*)(elements[i]));
+            fprintf(file,"[%4"FMT_CARD32"]=         %p\n",i,(void*)(elements[i]));
             INC(i);
         }
     }/*printOn:;*/
@@ -53,7 +53,7 @@ LEGAL
             CARD32          i;

         if(newSize>0){
-            elements=BcMem_Allocate(sizeof(id)*newSize);
+            elements=BcMem_Allocate((CARD32)sizeof(id)*newSize);
             psize=newSize;
             size=newSize;
             i=0;
@@ -92,7 +92,7 @@ LEGAL
             CARD32          i;

         if(newSize>psize){
-            newElements=BcMem_Allocate(sizeof(id)*newSize);
+            newElements=BcMem_Allocate((CARD32)sizeof(id)*newSize);
             psize=newSize;
             i=0;
             while(i<size){
@@ -128,7 +128,7 @@ LEGAL
     -(id)objectAt:(CARD32)idx
     {
         if(idx>=size){
-            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         return(elements[idx]);
     }/*objectAt:;*/
@@ -139,7 +139,7 @@ LEGAL
             id          old;

         if(idx>=size){
-            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         old=elements[idx];
         elements[idx]=newObject;
@@ -154,7 +154,7 @@ LEGAL
             CARD32              i;

         if(idx>=size){
-            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         i=size-1;
         [elements[i] release];
@@ -174,7 +174,7 @@ LEGAL
             id                  old;

         if(idx>=size){
-            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoArray_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         old=elements[idx];
         [old release];
diff --git a/bolib/sources/BoList.m b/bolib/sources/BoList.m
index bb9e038..90ebad7 100644
--- a/bolib/sources/BoList.m
+++ b/bolib/sources/BoList.m
@@ -20,7 +20,7 @@ MODIFICATIONS
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
     1996/04/20 <PJB> Updated to use retain/release BoObjects.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1996
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/sources/BoListNoRetain.m b/bolib/sources/BoListNoRetain.m
index 67564ca..2ec5388 100644
--- a/bolib/sources/BoListNoRetain.m
+++ b/bolib/sources/BoListNoRetain.m
@@ -17,7 +17,7 @@ AUTHOR
 MODIFICATIONS
     1996/09/17 <PJB> Creation (from BoList, which becomes a subclass).
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1996
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -43,7 +43,7 @@ LEGAL
         }else{
             capacity=newCapacity;
         }
-        elements=(id*)BcMem_Allocate(sizeof(id)*capacity);
+        elements=(id*)BcMem_Allocate((CARD32)sizeof(id)*capacity);
         return(self);
     }/*initCount:;*/

@@ -76,11 +76,11 @@ LEGAL
             CARD32          i;

         [super printOn:file];
-        fprintf(file,"count=          %8lu\n",count);
-        fprintf(file,"capacity=       %8lu\n",capacity);
+        fprintf(file,"count=          %8"FMT_CARD32"\n",count);
+        fprintf(file,"capacity=       %8"FMT_CARD32"\n",capacity);
         i=0;
         while(i<count){
-            fprintf(file,"[%4lu]=         %p\n",i,(void*)(elements[i]));
+            fprintf(file,"[%4"FMT_CARD32"]=         %p\n",i,(void*)(elements[i]));
             INC(i);
         }
     }/*printOn:;*/
@@ -119,9 +119,9 @@ LEGAL
             newCapacity=BoListNoRetain_Minimum;
         }
         if(count>newCapacity){
-            BcRAISE(BoListNoRetain_eCapacityTooLow,(void*)self,(void*)newCapacity);
+            BcRAISE(BoListNoRetain_eCapacityTooLow,(void*)self,(void*)(CARDPTR)newCapacity);
         }else{
-            newElements=(id*)BcMem_Allocate(sizeof(id)*newCapacity);
+            newElements=(id*)BcMem_Allocate((CARD32)sizeof(id)*newCapacity);
             i=0;
             while(i<count){
                 newElements[i]=elements[i];
@@ -150,7 +150,7 @@ LEGAL
     -(id)objectAt:(CARD32)idx
     {
         if(idx>=count){
-            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         return(elements[idx]);
     }/*objectAt:;*/
@@ -206,7 +206,7 @@ LEGAL
             id          oldObject;

         if(idx>=count){
-            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         oldObject=elements[idx];
         while(idx<count){
@@ -237,7 +237,7 @@ LEGAL
             BcRAISE(BoListNoRetain_eNilObject,(void*)self,NIL);
         }
         if(idx>=count){
-            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)idx);
+            BcRAISE(BoListNoRetain_eBadIndex,(void*)self,(void*)(CARDPTR)idx);
         }
         oldObject=elements[idx];
         elements[idx]=newObject;
diff --git a/bolib/sources/BoObject.m b/bolib/sources/BoObject.m
index f78bb9f..4e9b08c 100644
--- a/bolib/sources/BoObject.m
+++ b/bolib/sources/BoObject.m
@@ -12,7 +12,7 @@ MODIFICATIONS
     1992/10/22 <PJB> Renamed printOn to printOn.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1993
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -24,12 +24,12 @@ LEGAL
 @interface DeletePool:Object
 {
     BoObject**      pool;
-    long            poolCapacity;
-    long            poolCount;
+    CARD32          poolCapacity;
+    CARD32          poolCount;
 }
     -(id)init;
     -(id)free;
-    -(long)count;
+    -(CARD32)count;
     -(void)addObject:(BoObject*)obj;
     -(void)removeObject:(BoObject*)obj;
     -(void)deleteObjects;
@@ -43,7 +43,7 @@ LEGAL
         [super init];
         poolCount=0;
         poolCapacity=256;
-        pool=(BoObject**)BcMem_Allocate(sizeof(BoObject*)*poolCapacity);
+        pool=(BoObject**)BcMem_Allocate((CARD32)sizeof(BoObject*)*poolCapacity);
         return(self);
     }/*init;*/

@@ -57,7 +57,7 @@ LEGAL
     }/*free;*/


-    -(long)count
+    -(CARD32)count
     {
         return(poolCount);
     }/*count;*/
@@ -70,8 +70,7 @@ LEGAL
                 long            i;

             poolCapacity*=2;
-            newPool=(BoObject**)BcMem_Allocate((sizeof(BoObject*)
-                                        *poolCapacity));
+            newPool=(BoObject**)BcMem_Allocate((CARD32)sizeof(BoObject*)*poolCapacity);
             for(i=0;i<poolCount;i++){
                 newPool[i]=pool[i];
             }
diff --git a/bolib/sources/BoString.m b/bolib/sources/BoString.m
index 1f4c55e..4df438d 100644
--- a/bolib/sources/BoString.m
+++ b/bolib/sources/BoString.m
@@ -12,7 +12,7 @@ MODIFICATIONS
     1993/01/29 <PJB> Creation.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 1993
+    Copyright Pascal J. Bourguignon 1993 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -25,255 +25,253 @@ LEGAL

 @implementation BoString
 /*
-    char*           data
-    INT32           length
-    INT32           allocation
+  char*           data
+  INT32           length
+  INT32           allocation
 */

 /*
-    INVARIANTS:
-        data#NIL
-        1<=allocation
-        0<=length<allocation
-        data[length]=(char)0
-        for all i in [0..length-1], data[i]#(char)0
+  INVARIANTS:
+  data#NIL
+  1<=allocation
+  0<=length<allocation
+  data[length]=(char)0
+  for all i in [0..length-1], data[i]#(char)0
 */

 #define AllocIncrement  (128)
 #define Minimum(a,b)    (((a)<(b))?(a):(b))

-    -(id)setCapacity:(INT32)nAllocation copy:(BOOLEAN)copy
-    {
-            char*       nData;
-            INT32       nLength;
+-(id)setCapacity:(INT32)nAllocation copy:(BOOLEAN)copy
+{
+    char*       nData;
+    INT32       nLength;

-        if(nAllocation>1){
-            nData=BcMem_Allocate(sizeof(char)*nAllocation);
-            if(copy){
-                nLength=Minimum(nAllocation-1,length);
-                BcMem_Copy(data,nData,nLength*sizeof(char));
-            }else{
-                nLength=0;
-            }
+    if(nAllocation>1){
+        nData=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)nAllocation);
+        if(copy){
+            nLength=Minimum(nAllocation-1,length);
+            BcMem_Copy(data,nData,(CARD32)nLength*(CARD32)sizeof(char));
         }else{
-            nAllocation=1;
-            nData=BcMem_Allocate(sizeof(char)*nAllocation);
             nLength=0;
         }
-        nData[nLength]=(char)0;
-        BcMem_Deallocate((void**)(&data));
-        data=nData;
-        length=nLength;
-        allocation=nAllocation;
-        return(self);
-    }/*setCapacity;*/
+    }else{
+        nAllocation=1;
+        nData=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)nAllocation);
+        nLength=0;
+    }
+    nData[nLength]=(char)0;
+    BcMem_Deallocate((void**)(&data));
+    data=nData;
+    length=nLength;
+    allocation=nAllocation;
+    return(self);
+}/*setCapacity;*/


 /* Object:*/

-    -(id)init
-    {
-        [super init];
-        allocation=1;
-        data=BcMem_Allocate(sizeof(char)*allocation);
-        length=0;
-        data[length]=(char)0;
-        return(self);
-    }/*init;*/
-
-
-    -(id)initCapacity:(INT32)size
-    {
-        [self init];
-        [self setCapacity:size copy:FALSE];
-        return(self);
-    }/*initCapacity:;*/
+-(id)init
+{
+    [super init];
+    allocation=1;
+    data=BcMem_Allocate((CARD32)sizeof(char)*(CARD32)allocation);
+    length=0;
+    data[length]=(char)0;
+    return(self);
+}/*init;*/
+
+
+-(id)initCapacity:(INT32)size
+{
+    [self init];
+    [self setCapacity:size copy:FALSE];
+    return(self);
+}/*initCapacity:;*/


-    -(id)free
-    {
-        [self setCapacity:0 copy:FALSE];
-        return([super free]);
-    }/*free;*/
+-(id)free
+{
+    [self setCapacity:0 copy:FALSE];
+    return([super free]);
+}/*free;*/


 /* BoObject:*/


-    -(void)printOn:(FILE*)file
-    {
-        [super printOn:file];
-        fprintf(file,"data=           %p\n",(void*)data);
-        if(data!=NIL){
-            fprintf(file,"*data=          \"%s\"\n",data);
-        }
-        fprintf(file,"length=         %ld\n",length);
-        fprintf(file,"allocation=     %ld\n",allocation);
-    }/*printOn:;*/
+-(void)printOn:(FILE*)file
+{
+    [super printOn:file];
+    fprintf(file,"data=           %p\n",(void*)data);
+    if(data!=NIL){
+        fprintf(file,"*data=          \"%s\"\n",data);
+    }
+    fprintf(file,"length=         %"FMT_CARD32"\n",length);
+    fprintf(file,"allocation=     %"FMT_CARD32"\n",allocation);
+}/*printOn:;*/


 /* BoString:*/

-    -(INT32)length
-    {
-        return(length);
-    }/*length;*/
+-(INT32)length
+{
+    return(length);
+}/*length;*/


-    -(const char*)string
-    {
-        return(data);
-    }/*string;*/
+-(const char*)string
+{
+    return(data);
+}/*string;*/


-    -(id)setString:(const char*)nString
-    {
-            INT32       nLength;
+-(id)setString:(const char*)nString
+{
+    INT32       nLength;

-        nLength=strlen(nString);
-        if(nLength>=allocation){
-            [self setCapacity:nLength+1 copy:FALSE];
-        }
-        BcMem_Copy((const void*)nString,data,nLength*sizeof(char));
-        data[nLength]=(char)0;
-        length=nLength;
-        return(self);
-    }/*setString:;*/
-
-
-    -(id)getString:(char*)string
-    {
-        BcMem_Copy(data,string,length*sizeof(char));
-        string[length]=(char)0;
-        return(self);
-    }/*getString:;*/
-
-
-    -(char)charAt:(INT32)idx
-    {
-        if((idx<0)OR(idx>=length)){
-            return((char)0);
-        }else{
-            return(data[idx]);
-        }
-    }/*charAt:;*/
-
-
-    -(id)setChar:(char)nChar at:(INT32)idx
-    {
-        if((0<=idx)AND(idx<=length)){
-            if(nChar==(char)0){
-                length=idx;
-            }else if(idx==length){
-                if(allocation<=length+1){
-                    [self setCapacity:allocation+AllocIncrement copy:TRUE];
-                }
-                INC(length);
-                data[length]=(char)0;
+    nLength=(INT32)strlen(nString);
+    if(nLength>=allocation){
+        [self setCapacity:nLength+1 copy:FALSE];
+    }
+    BcMem_Copy((const void*)nString,data,(CARD32)nLength*(CARD32)sizeof(char));
+    data[nLength]=(char)0;
+    length=nLength;
+    return(self);
+}/*setString:;*/
+
+
+-(id)getString:(char*)string
+{
+    BcMem_Copy(data,string,(CARD32)length*(CARD32)sizeof(char));
+    string[length]=(char)0;
+    return(self);
+}/*getString:;*/
+
+
+-(char)charAt:(INT32)idx
+{
+    if((idx<0)OR(idx>=length)){
+        return((char)0);
+    }else{
+        return(data[idx]);
+    }
+}/*charAt:;*/
+
+
+-(id)setChar:(char)nChar at:(INT32)idx
+{
+    if((0<=idx)AND(idx<=length)){
+        if(nChar==(char)0){
+            length=idx;
+        }else if(idx==length){
+            if(allocation<=length+1){
+                [self setCapacity:allocation+AllocIncrement copy:TRUE];
             }
-            data[idx]=nChar;
+            INC(length);
+            data[length]=(char)0;
         }
+        data[idx]=nChar;
+    }
+    return(self);
+}/*setChar:;*/
+
+
+-(id)insert:(BoString*)substring at:(INT32)idx
+{
+    INT32       nLength;
+
+    if(idx<0){
+        idx=0;
+    }else if(length<idx){
+        idx=length;
+    }
+    nLength=length+substring->length;
+    if(nLength>=allocation){
+        /* SEE: We copy some char of self twice !*/
+        [self setCapacity:nLength+1 copy:TRUE];
+    }
+    BcMem_Copy(data+idx,data+idx+substring->length,(CARD32)(length-idx+1)*(CARD32)sizeof(char));
+    BcMem_Copy(substring->data,data+idx,(CARD32)(substring->length)*(CARD32)sizeof(char));
+    length=nLength;
+    return(self);
+}/*insert:at:;*/
+
+
+-(id)deleteFrom:(INT32)idx length:(INT32)delen
+{
+    if(idx<0){
+        idx=0;
+    }else if(length<=idx){
         return(self);
-    }/*setChar:;*/
-
-
-    -(id)insert:(BoString*)substring at:(INT32)idx
-    {
-            INT32       nLength;
-
-        if(idx<0){
-            idx=0;
-        }else if(length<idx){
-            idx=length;
-        }
-        nLength=length+substring->length;
-        if(nLength>=allocation){
-            /* SEE: We copy some char of self twice !*/
-            [self setCapacity:nLength+1 copy:TRUE];
-        }
-        BcMem_Copy(data+idx,data+idx+substring->length,
-                        (length-idx+1)*sizeof(char));
-        BcMem_Copy(substring->data,data+idx,substring->length*sizeof(char));
-        length=nLength;
-        return(self);
-    }/*insert:at:;*/
-
-
-    -(id)deleteFrom:(INT32)idx length:(INT32)delen
-    {
-        if(idx<0){
-            idx=0;
-        }else if(length<=idx){
-            return(self);
-        }
-        if(length<idx+delen){
-            delen=length-idx;
-        }
-        BcMem_Copy(data+idx+delen,data+idx,
-                    (length-(idx+delen)+1)*sizeof(char));
-        length=length-delen;
-        return(self);
-    }/*deleteFrom:length:;*/
-
-
-    -(INT32)position:(BoString*)substring from:(INT32)idx
-    {
-        /* SEE: could we use the FastStringSearch algorithm?*/
-            INT32           pos;
-            INT32           i;
-            INT32           max;
+    }
+    if(length<idx+delen){
+        delen=length-idx;
+    }
+    BcMem_Copy(data+idx+delen,data+idx,(CARD32)(length-(idx+delen)+1)*(CARD32)sizeof(char));
+    length=length-delen;
+    return(self);
+}/*deleteFrom:length:;*/
+
+
+-(INT32)position:(BoString*)substring from:(INT32)idx
+{
+    /* SEE: could we use the FastStringSearch algorithm?*/
+    INT32           pos;
+    INT32           i;
+    INT32           max;

-        max=length-substring->length;
-        if(idx<0){
-            pos=0;
-        }else{
-            pos=idx;
+    max=length-substring->length;
+    if(idx<0){
+        pos=0;
+    }else{
+        pos=idx;
+    }
+    while(pos<=max){
+        i=0;
+        while(data[pos+i]==substring->data[i]){
+            INC(i);
         }
-        while(pos<=max){
-            i=0;
-            while(data[pos+i]==substring->data[i]){
-                INC(i);
-            }
-            if(substring->data[i]==(char)0){
-                return(pos);
-            }
-            INC(pos);
+        if(substring->data[i]==(char)0){
+            return(pos);
         }
-        /* not found*/
-        return(-1);
-    }/*position:;*/
-
-
-    -(id)copy:(BoString*)string from:(INT32)idx length:(INT32)copylen
-    {
-        if(idx+copylen>string->length){
-            copylen=string->length-idx;
-        }
-        if(copylen<=0){
-            data[0]=(char)0;
-            length=0;
-            return(self);
-        }
-        if(copylen>=allocation){
-            [self setCapacity:copylen+1 copy:FALSE];
-        }
-        BcMem_Copy(string->data+idx,data,copylen*sizeof(char));
-        data[copylen]=(char)0;
-        length=copylen;
+        INC(pos);
+    }
+    /* not found*/
+    return(-1);
+}/*position:;*/
+
+
+-(id)copy:(BoString*)string from:(INT32)idx length:(INT32)copylen
+{
+    if(idx+copylen>string->length){
+        copylen=string->length-idx;
+    }
+    if(copylen<=0){
+        data[0]=(char)0;
+        length=0;
         return(self);
-    }/*copy:from:length:;*/
-
-
-    -(id)append:(BoString*)tail
-    {
-        return([self insert:tail at:length]);
-    }/*append:;*/
-
-
-    -(int)compare:(BoString*)other
-    {
-        return(strcmp([self string],[other string]));
-    }/*compare:;*/
+    }
+    if(copylen>=allocation){
+        [self setCapacity:copylen+1 copy:FALSE];
+    }
+    BcMem_Copy(string->data+idx,data,(CARD32)copylen*(CARD32)sizeof(char));
+    data[copylen]=(char)0;
+    length=copylen;
+    return(self);
+}/*copy:from:length:;*/
+
+
+-(id)append:(BoString*)tail
+{
+    return([self insert:tail at:length]);
+}/*append:;*/
+
+
+-(int)compare:(BoString*)other
+{
+    return(strcmp([self string],[other string]));
+}/*compare:;*/

 @end
 /*** BoString.m                       -- 2004-01-01 09:58:19 -- pascal   ***/
diff --git a/bolib/sources/BoTimer.macintosh.m b/bolib/sources/BoTimer.macintosh.m
index d24ee98..defeac1 100644
--- a/bolib/sources/BoTimer.macintosh.m
+++ b/bolib/sources/BoTimer.macintosh.m
@@ -23,7 +23,7 @@ MODIFICATIONS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 1992 - 2003
+    Copyright Pascal Bourguignon 1992 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bolib/sources/BoTimer.next.m b/bolib/sources/BoTimer.next.m
index 5a04dc9..db0380c 100644
--- a/bolib/sources/BoTimer.next.m
+++ b/bolib/sources/BoTimer.next.m
@@ -20,7 +20,7 @@ MODIFICATIONS
     1993/01/17 <PJB> Converted from C++ to Objective-C.
     1993/03/19 <PJB> Updated to use newly Bc- prefixed interfaces.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1993
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bolib/sources/BoTimer.posix.m b/bolib/sources/BoTimer.posix.m
index 3ab8258..f3e0aa1 100644
--- a/bolib/sources/BoTimer.posix.m
+++ b/bolib/sources/BoTimer.posix.m
@@ -21,7 +21,7 @@ MODIFICATIONS
 LEGAL
     GPL

-    Copyright Pascal Bourguignon 1992 - 2003
+    Copyright Pascal Bourguignon 1992 - 2011

     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
diff --git a/bolib/sources/Makefile b/bolib/sources/Makefile
index f4c2cc7..18c1387 100644
--- a/bolib/sources/Makefile
+++ b/bolib/sources/Makefile
@@ -21,7 +21,7 @@
 #LEGAL
 #    GPL
 #
-#    Copyright Pascal Bourguignon 1992 - 2003
+#    Copyright Pascal Bourguignon 1992 - 2011
 #
 #    This program is free software; you can redistribute it and/or
 #    modify it under the terms of the GNU General Public License
diff --git a/bpcombi/interfaces/BpArrangementSansRepeat.hh b/bpcombi/interfaces/BpArrangementSansRepeat.hh
index b2913d5..046a781 100644
--- a/bpcombi/interfaces/BpArrangementSansRepeat.hh
+++ b/bpcombi/interfaces/BpArrangementSansRepeat.hh
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/interfaces/BpArrangementWithRepeat.hh b/bpcombi/interfaces/BpArrangementWithRepeat.hh
index 7b7db0c..03220bf 100644
--- a/bpcombi/interfaces/BpArrangementWithRepeat.hh
+++ b/bpcombi/interfaces/BpArrangementWithRepeat.hh
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/interfaces/BpCombination.hh b/bpcombi/interfaces/BpCombination.hh
index 83db6ad..0b3a72f 100644
--- a/bpcombi/interfaces/BpCombination.hh
+++ b/bpcombi/interfaces/BpCombination.hh
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/interfaces/BpSetEnumerator.hh b/bpcombi/interfaces/BpSetEnumerator.hh
index 47c4f18..8a78554 100644
--- a/bpcombi/interfaces/BpSetEnumerator.hh
+++ b/bpcombi/interfaces/BpSetEnumerator.hh
@@ -20,7 +20,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/interfaces/BpSetFunctor.hh b/bpcombi/interfaces/BpSetFunctor.hh
index 9ae01d2..33e0bc6 100644
--- a/bpcombi/interfaces/BpSetFunctor.hh
+++ b/bpcombi/interfaces/BpSetFunctor.hh
@@ -20,7 +20,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/interfaces/names.h b/bpcombi/interfaces/names.h
index f276bd7..68d77d6 100644
--- a/bpcombi/interfaces/names.h
+++ b/bpcombi/interfaces/names.h
@@ -18,7 +18,7 @@ MODIFICATIONS
     Updated with changes from MAPTREE on bclib/bplib/makedir.

 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/sources/BpArrangementSansRepeat.cc b/bpcombi/sources/BpArrangementSansRepeat.cc
index b4ea55e..910fb00 100644
--- a/bpcombi/sources/BpArrangementSansRepeat.cc
+++ b/bpcombi/sources/BpArrangementSansRepeat.cc
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/sources/BpArrangementWithRepeat.cc b/bpcombi/sources/BpArrangementWithRepeat.cc
index 655fd66..4bbbaa1 100644
--- a/bpcombi/sources/BpArrangementWithRepeat.cc
+++ b/bpcombi/sources/BpArrangementWithRepeat.cc
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -85,7 +85,7 @@ LEGAL
             CARD32      r;
         r=1;
         while(exponent>0){
-            if(exponent&1==0){
+            if((exponent&1)==0){
                 x*=x;
                 exponent/=2;
             }else{
diff --git a/bpcombi/sources/BpCombination.cc b/bpcombi/sources/BpCombination.cc
index 9a76ccb..a5fd5d3 100644
--- a/bpcombi/sources/BpCombination.cc
+++ b/bpcombi/sources/BpCombination.cc
@@ -19,7 +19,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/sources/BpSetEnumerator.cc b/bpcombi/sources/BpSetEnumerator.cc
index 070ed6d..e419234 100644
--- a/bpcombi/sources/BpSetEnumerator.cc
+++ b/bpcombi/sources/BpSetEnumerator.cc
@@ -20,7 +20,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bpcombi/sources/BpSetFunctor.cc b/bpcombi/sources/BpSetFunctor.cc
index 7451456..9f3df2d 100644
--- a/bpcombi/sources/BpSetFunctor.cc
+++ b/bpcombi/sources/BpSetFunctor.cc
@@ -20,7 +20,7 @@ MODIFICATIONS

     1996/08/04 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1996 - 1996
+    Copyright Pascal J. Bourguignon 1996 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bplib/interfaces/BpArray.hh b/bplib/interfaces/BpArray.hh
index 4a469b5..f8fcd3f 100644
--- a/bplib/interfaces/BpArray.hh
+++ b/bplib/interfaces/BpArray.hh
@@ -33,7 +33,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/BpClass.hh b/bplib/interfaces/BpClass.hh
index 5537bd3..0963b6d 100644
--- a/bplib/interfaces/BpClass.hh
+++ b/bplib/interfaces/BpClass.hh
@@ -38,7 +38,7 @@ MODIFICATIONS

     1995-11-19 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

@@ -97,7 +97,7 @@ public:
             NOTE:       to test direct superClass use:
                             (aClass==this->superClass())
         */
-
+    CLASSMETHOD(BpClass,createMetaClasses,(void),BpClass*)
 protected:
     const char*     fName;
     BpClass*        fSuperClass;
@@ -106,6 +106,7 @@ protected:
 };


+
 /*
     In each constructor of subclasses of BpObject, use this macro
     to initialize the BpClass instance associated to the constructed
diff --git a/bplib/interfaces/BpDict.hh b/bplib/interfaces/BpDict.hh
index 568e3d5..188a437 100644
--- a/bplib/interfaces/BpDict.hh
+++ b/bplib/interfaces/BpDict.hh
@@ -27,7 +27,7 @@ MODIFICATIONS
     Initial revision

 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/BpList.hh b/bplib/interfaces/BpList.hh
index ba704c7..af78f66 100644
--- a/bplib/interfaces/BpList.hh
+++ b/bplib/interfaces/BpList.hh
@@ -38,7 +38,7 @@ MODIFICATIONS
                     in the same sources.
     1994-12-30 <PJB> Added sort.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/BpObject.hh b/bplib/interfaces/BpObject.hh
index 24e8744..c044712 100644
--- a/bplib/interfaces/BpObject.hh
+++ b/bplib/interfaces/BpObject.hh
@@ -44,7 +44,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/BpString.hh b/bplib/interfaces/BpString.hh
index f12909a..b42e452 100644
--- a/bplib/interfaces/BpString.hh
+++ b/bplib/interfaces/BpString.hh
@@ -35,7 +35,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bplib library..

@@ -83,22 +83,21 @@ public:

 // BpString methods:

-    METHOD(BpString,length,(void),INT32)
+    METHOD(BpString,length,(void),CARD32)
     METHOD(BpString,string,(void),const char*)
     METHOD(BpString,setString,(const char* nString),BpString*)
     METHOD(BpString,getString,(char* string),BpString*)
-    METHOD(BpString,setStringNoCopy,(char* data,INT32 byteCount),void)
+    METHOD(BpString,setStringNoCopy,(char* data,CARD32 byteCount),void)

-    METHOD(BpString,charAt,(INT32 index),char)
-    METHOD(BpString,setCharAt,(char nChar,INT32 index),BpString*)
+    METHOD(BpString,charAt,(CARD32 index),char)
+    METHOD(BpString,setCharAt,(char nChar,CARD32 index),BpString*)

     METHOD(BpString,compare,(BpString* otherString),SignT)
-    METHOD(BpString,insertAt,(BpString* substring,INT32 index),BpString*)
-    METHOD(BpString,deleteFromLength,(INT32 index,INT32 delen),BpString*)
-    METHOD(BpString,positionFrom,(BpString* substring,INT32 index),INT32)
+    METHOD(BpString,insertAt,(BpString* substring,CARD32 index),BpString*)
+    METHOD(BpString,deleteFromLength,(CARD32 index,CARD32 delen),BpString*)
+    METHOD(BpString,positionFrom,(BpString* substring,CARD32 index),CARD32)
     METHOD(BpString,copyFrom,(BpString* source),BpString*)
-    METHOD(BpString,copyFromLength,
-            (BpString* string,INT32 index,INT32 copylen),BpString*)
+    METHOD(BpString,copyFromLength,(BpString* string,CARD32 index,CARD32 copylen),BpString*)
     METHOD(BpString,append,(BpString* tail),BpString*)
     METHOD(BpString,appendString,(const char* nString),BpString*)

@@ -116,11 +115,11 @@ public:

 protected:
     char*           data;
-    INT32           dlength;
-    INT32           allocation;
-    METHOD(BpString,setCapacityCopy,(INT32 nAllocation,BOOLEAN copy),BpString*)
+    CARD32          dlength;
+    CARD32          allocation;
+    METHOD(BpString,setCapacityCopy,(CARD32 nAllocation,BOOLEAN copy),BpString*)
     METHOD(BpString,_insertStringAt,
-                    (const char* sString,INT32 sLength,INT32 index),BpString*)
+                    (const char* sString,CARD32 sLength,CARD32 index),BpString*)
 };//BpString


diff --git a/bplib/interfaces/BpTimer.hh b/bplib/interfaces/BpTimer.hh
index 40ab17f..c1a58db 100644
--- a/bplib/interfaces/BpTimer.hh
+++ b/bplib/interfaces/BpTimer.hh
@@ -35,7 +35,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/PrintOnLevel.hh b/bplib/interfaces/PrintOnLevel.hh
index 2a90ec5..bf840b4 100644
--- a/bplib/interfaces/PrintOnLevel.hh
+++ b/bplib/interfaces/PrintOnLevel.hh
@@ -23,7 +23,7 @@ AUTHORS
 MODIFICATIONS
     1992-08-16 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/interfaces/names.h b/bplib/interfaces/names.h
index bfc0587..af6c33b 100644
--- a/bplib/interfaces/names.h
+++ b/bplib/interfaces/names.h
@@ -32,7 +32,7 @@ MODIFICATIONS

     1995-10-18 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/sources/BpArray.cc b/bplib/sources/BpArray.cc
index 5afc422..12680d6 100644
--- a/bplib/sources/BpArray.cc
+++ b/bplib/sources/BpArray.cc
@@ -48,7 +48,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

@@ -75,270 +75,269 @@ extern "C"{
 }
 #include BcImplementation_h

-    static const char rcsid[]="$Id: BpArray.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";
+static const char rcsid[]="$Id: BpArray.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";



 // birth and death:

-    CONSTRUCTOR(BpArray)
-    {
-        BpClass_PLUG(BpArray);
-        psize=0;
-        lsize=0;
-        elements=(BpObject**)NIL;
-    }//BpArray:;
+CONSTRUCTOR(BpArray)
+{
+    BpClass_PLUG(BpArray);
+    psize=0;
+    lsize=0;
+    elements=(BpObject**)NIL;
+}//BpArray:;


-    DESTRUCTOR(BpArray) // void
-    {
-        if(elements!=NIL){
-                CARD32      i;
-            for(i=0;i<lsize;i++){
-                if(elements[i]!=NIL){
-                    elements[i]->release();
-                }
+DESTRUCTOR(BpArray) // void
+{
+    if(elements!=NIL){
+        CARD32      i;
+        for(i=0;i<lsize;i++){
+            if(elements[i]!=NIL){
+                elements[i]->release();
             }
-            BcMem_Deallocate((void**)&elements);
         }
-    }//~BpArray;
+        BcMem_Deallocate((void**)&elements);
+    }
+}//~BpArray;


 // overrBpObject*e BpObject methods:

-    METHOD(BpArray,makeBrother,(void),BpObject*)
-    {
-        return(NEW(BpArray));
-    }//makeBrother;
+METHOD(BpArray,makeBrother,(void),BpObject*)
+{
+    return(NEW(BpArray));
+}//makeBrother;


-    METHOD(BpArray,printOnLevel,(FILE* file,CARD32 level),void)
-    {
-            CARD32          i;
+METHOD(BpArray,printOnLevel,(FILE* file,CARD32 level),void)
+{
+    CARD32          i;

-        BpArray_SUPER::printOnLevel(file,level);
-        PRINTONLEVEL(file,level,"%8lu",lsize,lsize);
-        PRINTONLEVEL(file,level,"%8lu",psize,psize);
-        i=0;
-        while(i<lsize){
-            PRINTONLEVEL_ELEMENT(file,level,"%p",elements,i,
-                                            (void*)(elements[i]));
-            INC(i);
-        }
-    }//printOnLevel;
+    BpArray_SUPER::printOnLevel(file,level);
+    PRINTONLEVEL(file,level,"%8lu",lsize,lsize);
+    PRINTONLEVEL(file,level,"%8lu",psize,psize);
+    i=0;
+    while(i<lsize){
+        PRINTONLEVEL_ELEMENT(file,level,"%p",elements,i,
+                             (void*)(elements[i]));
+        INC(i);
+    }
+}//printOnLevel;


 // new methods:

-    METHOD(BpArray,initWithObjectsCount,(BpObject** objects,CARD32 count),void)
-    {
-            CARD32      i;
+METHOD(BpArray,initWithObjectsCount,(BpObject** objects,CARD32 count),void)
+{
+    CARD32      i;

-        this->resize(count);
-        for(i=0;i<count;i++){
-            objects[i]->retain();
-            if(elements[i]!=NIL){
-                elements[i]->release();
-            }
-            elements[i]=objects[i];
+    this->resize(count);
+    for(i=0;i<count;i++){
+        objects[i]->retain();
+        if(elements[i]!=NIL){
+            elements[i]->release();
         }
-        selfChanged(BpArray_cInitializedWithObjects);
-    }//initWithObjectsCount;
+        elements[i]=objects[i];
+    }
+    selfChanged(BpArray_cInitializedWithObjects);
+}//initWithObjectsCount;


-    METHOD(BpArray,size,(void),CARD32)
-    {
-        return(lsize);
-    }//size;
+METHOD(BpArray,size,(void),CARD32)
+{
+    return(lsize);
+}//size;


-    METHOD(BpArray,resize,(CARD32 newSize),BpArray*)
-    {
-            BpObject**      newElements;
-            CARD32          i;
+METHOD(BpArray,resize,(CARD32 newSize),BpArray*)
+{
+    BpObject**      newElements;
+    CARD32          i;

-        if(newSize>psize){
-            newElements=(BpObject**)BcMem_Allocate(sizeof(BpObject*)*newSize);
-            psize=newSize;
-            i=0;
-            while(i<lsize){
-                newElements[i]=elements[i];
-                INC(i);
-            }
-            while(i<psize){
-                newElements[i]=(BpObject*)NIL;
-                INC(i);
-            }
-            if(elements!=NIL){
-                BcMem_Deallocate((void**)&elements);
-            }
-            elements=newElements;
-            lsize=newSize;
-        }else if(newSize>lsize){
-            // lsize < newSize <= psize
-            i=lsize;
-            while(i<newSize){
-                elements[i]=(BpObject*)NIL;
-                INC(i);
-            }
-            lsize=newSize;
-        }else{
-            // newSize <= lsize
-            for(i=newSize;i<lsize;i++){
-                if(elements[i]!=NIL){
-                    elements[i]->release();
-                }
+    if(newSize>psize){
+        newElements=(BpObject**)BcMem_Allocate((CARD32)sizeof(BpObject*)*newSize);
+        psize=newSize;
+        i=0;
+        while(i<lsize){
+            newElements[i]=elements[i];
+            INC(i);
+        }
+        while(i<psize){
+            newElements[i]=(BpObject*)NIL;
+            INC(i);
+        }
+        if(elements!=NIL){
+            BcMem_Deallocate((void**)&elements);
+        }
+        elements=newElements;
+        lsize=newSize;
+    }else if(newSize>lsize){
+        // lsize < newSize <= psize
+        i=lsize;
+        while(i<newSize){
+            elements[i]=(BpObject*)NIL;
+            INC(i);
+        }
+        lsize=newSize;
+    }else{
+        // newSize <= lsize
+        for(i=newSize;i<lsize;i++){
+            if(elements[i]!=NIL){
+                elements[i]->release();
             }
-            lsize=newSize;
         }
-        selfChanged(BpArray_cResized);
-        return(this);
-    }//resize:;
+        lsize=newSize;
+    }
+    selfChanged(BpArray_cResized);
+    return(this);
+}//resize:;


-    METHOD(BpArray,objectAt,(CARD32 index),BpObject*)
-    {
-        if(index>=lsize){
-            BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
-        }
-        return(elements[index]);
-    }//objectAt:;
+METHOD(BpArray,objectAt,(CARD32 index),BpObject*)
+{
+    if(index>=lsize){
+        BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
+    }
+    return(elements[index]);
+}//objectAt:;


-    METHOD(BpArray,replaceObjectAtWith,
-                (CARD32 index,BpObject* newObject), BpObject*)
-    {
-            BpObject*           old;
+METHOD(BpArray,replaceObjectAtWith,
+       (CARD32 index,BpObject* newObject), BpObject*)
+{
+    BpObject*           old;

-        if(index>=lsize){
-            BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
-        }
-        old=elements[index];
-        elements[index]=newObject;
-        if(old!=NIL){
-            old->release();
-        }
-        if(newObject!=NIL){
-            newObject->retain();
-        }
-        selfChanged(BpArray_cObjectReplaced);
-        return(old);
-    }//replaceObjectAt:with:;
+    if(index>=lsize){
+        BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
+    }
+    old=elements[index];
+    elements[index]=newObject;
+    if(old!=NIL){
+        old->release();
+    }
+    if(newObject!=NIL){
+        newObject->retain();
+    }
+    selfChanged(BpArray_cObjectReplaced);
+    return(old);
+}//replaceObjectAt:with:;


-    METHOD(BpArray,insertObjectAt,(BpObject* newObject,CARD32 index),BpArray*)
-    {
-            CARD32              i;
+METHOD(BpArray,insertObjectAt,(BpObject* newObject,CARD32 index),BpArray*)
+{
+    CARD32              i;

-        if(index>=lsize){
-            BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
-        }
-        i=lsize-1;
-        while(i>index){
-            elements[i]=elements[i-1];
-            DEC(i);
-        }
-        elements[i]=newObject;
-        if(newObject!=NIL){
-            newObject->retain();
-        }
-        selfChanged(BpArray_cObjectInserted);
-        return(this);
-    }//insertObject:at:;
+    if(index>=lsize){
+        BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
+    }
+    i=lsize-1;
+    while(i>index){
+        elements[i]=elements[i-1];
+        DEC(i);
+    }
+    elements[i]=newObject;
+    if(newObject!=NIL){
+        newObject->retain();
+    }
+    selfChanged(BpArray_cObjectInserted);
+    return(this);
+}//insertObject:at:;


-    METHOD(BpArray,removeObjectAt,(CARD32 index),BpObject*)
-    {
-            CARD32              i;
-            BpObject*           old;
+METHOD(BpArray,removeObjectAt,(CARD32 index),BpObject*)
+{
+    CARD32              i;
+    BpObject*           old;

-        if(index>=lsize){
-            BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
-        }
-        old=elements[index];
-        i=index;
-        while(i<lsize-1){
-            elements[i]=elements[i+1];
-            INC(i);
-        }
-        elements[i]=(BpObject*)NIL;
-        if(old!=NIL){
-            old->release();
-        }
-        selfChanged(BpArray_cObjectRemoved);
-        return(old);
-    }//removeObjectAt:;
+    if(index>=lsize){
+        BcRAISE(BpArray_eBadIndex,(void*)this,(void*)index);
+    }
+    old=elements[index];
+    i=index;
+    while(i<lsize-1){
+        elements[i]=elements[i+1];
+        INC(i);
+    }
+    elements[i]=(BpObject*)NIL;
+    if(old!=NIL){
+        old->release();
+    }
+    selfChanged(BpArray_cObjectRemoved);
+    return(old);
+}//removeObjectAt:;


-    METHOD(BpArray,indexOf,(BpObject* oldObject),CARD32)
-    {
-            CARD32          i;
+METHOD(BpArray,indexOf,(BpObject* oldObject),CARD32)
+{
+    CARD32          i;

-        i=0;
-        while((i<lsize)AND(elements[i]!=oldObject)){
-            INC(i);
-        }
-        if(i==lsize){
-            return(MAX_CARD32);
-        }else{
-            return(i);
-        }
-    }//indexOf:;
+    i=0;
+    while((i<lsize)AND(elements[i]!=oldObject)){
+        INC(i);
+    }
+    if(i==lsize){
+        return(MAX_CARD32);
+    }else{
+        return(i);
+    }
+}//indexOf:;


-    METHOD(BpArray,makeObjectsPerform,(BpArray_ActionPr proc),BpArray*)
-    {
-            CARD32                  i;
+METHOD(BpArray,makeObjectsPerform,(BpArray_ActionPr proc),BpArray*)
+{
+    CARD32                  i;

-        i=0;
-        while(i<lsize){
-            proc(elements[i]);
-            INC(i);
-        }
-        return(this);
-    }//makeOjectsPerform:;
+    i=0;
+    while(i<lsize){
+        proc(elements[i]);
+        INC(i);
+    }
+    return(this);
+}//makeOjectsPerform:;


-    METHOD(BpArray,makeObjectsPerformWith,
-            (BpArray_ActionWithPr proc,BpObject* anObject),BpArray*)
-    {
-            CARD32                  i;
+METHOD(BpArray,makeObjectsPerformWith,(BpArray_ActionWithPr proc,BpObject* anObject),BpArray*)
+{
+    CARD32                  i;

-        i=0;
-        while(i<lsize){
-            proc(elements[i],anObject);
-            INC(i);
-        }
-        return(this);
-    }//makeOjectsPerform:with:;
+    i=0;
+    while(i<lsize){
+        proc(elements[i],anObject);
+        INC(i);
+    }
+    return(this);
+}//makeOjectsPerform:with:;


-    METHOD(BpArray,withEachMakePerform,
-            (BpObject* receiver,BpArray_ActionWithPr proc),BpArray*)
-    {
-            CARD32                  i;
+METHOD(BpArray,withEachMakePerform,
+       (BpObject* receiver,BpArray_ActionWithPr proc),BpArray*)
+{
+    CARD32                  i;

-        i=0;
-        while(i<lsize){
-            proc(receiver,elements[i]);
-            INC(i);
-        }
-        return(this);
-    }//withEachMake:perform:;
+    i=0;
+    while(i<lsize){
+        proc(receiver,elements[i]);
+        INC(i);
+    }
+    return(this);
+}//withEachMake:perform:;


-    METHOD(BpArray,withEachMakePerformWithAndWith,
-            (BpObject* receiver,BpArray_ActionWithAndWithPr proc,
-             BpObject* obj),BpArray*)
-    {
-            CARD32                  i;
+METHOD(BpArray,withEachMakePerformWithAndWith,
+       (BpObject* receiver,BpArray_ActionWithAndWithPr proc,
+        BpObject* obj),BpArray*)
+{
+    CARD32                  i;

-        i=0;
-        while(i<lsize){
-            proc(receiver,elements[i],obj);
-            INC(i);
-        }
-        return(this);
-    }//withEachMake:perform:andWith:;
+    i=0;
+    while(i<lsize){
+        proc(receiver,elements[i],obj);
+        INC(i);
+    }
+    return(this);
+}//withEachMake:perform:andWith:;

 //END BpArray.
diff --git a/bplib/sources/BpClass.cc b/bplib/sources/BpClass.cc
index f0312ea..9b48022 100644
--- a/bplib/sources/BpClass.cc
+++ b/bplib/sources/BpClass.cc
@@ -33,7 +33,7 @@ MODIFICATIONS

     1995-11-19 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

@@ -56,173 +56,177 @@ LEGAL
 #include BpClass_hh
 #include BcImplementation_h

-    static const char rcsid[]="$Id";
+static const char rcsid[]="$Id";

 // birth and death:

-    /*
-        The instances must retain their isa BpClass.
-        The BpClasses retains their superclass and their factory.
-        As a instance, the factories retain their isa BpClass. This set
-        up a loop in the retain dependancy that prevent the BpClasses to
-        be freed. This is intentional.
-    */
+/*
+  The instances must retain their isa BpClass.
+  The BpClasses retains their superclass and their factory.
+  As a instance, the factories retain their isa BpClass. This set
+  up a loop in the retain dependancy that prevent the BpClasses to
+  be freed. This is intentional.
+*/

-    static BpClass* BpClassClass=NIL;
+static BpClass* BpClassClass=NIL;

-    FRIENDPROC(BpClass_CreateMetaClasses,(void),BpClass*)
-    {
-            BpClass*        objectClass;
+PROCEDURE(BpClass_CreateMetaClasses,(void),BpClass*)
+{
+    BpClass*        objectClass;

-        objectClass=NEW(BpClass);
-        BpClassClass=NEW(BpClass);
+    objectClass=NEW(BpClass);
+    BpClassClass=NEW(BpClass);

-        if(objectClass->isa!=NIL){  // this should not happen.
-            objectClass->isa->release();
-        }
-        objectClass->isa=BpClassClass;
-        objectClass->isa->retain();
-        objectClass->superClassSet(objectClass);
+    if(objectClass->isa!=NIL){  // this should not happen.
+        objectClass->isa->release();
+    }
+    objectClass->isa=BpClassClass;
+    objectClass->isa->retain();
+    objectClass->superClassSet(objectClass);

-        if(BpClassClass->isa!=NIL){ // this should not happen.
-            BpClassClass->isa->release();
-        }
-        BpClassClass->isa=BpClassClass;
-        BpClassClass->isa->retain();
-        BpClassClass->superClassSet(objectClass);
+    if(BpClassClass->isa!=NIL){ // this should not happen.
+        BpClassClass->isa->release();
+    }
+    BpClassClass->isa=BpClassClass;
+    BpClassClass->isa->retain();
+    BpClassClass->superClassSet(objectClass);

-        BpClassClass->nameSet("BpClass");
-        BpClassClass->factorySet(BpClassClass);
+    BpClassClass->nameSet("BpClass");
+    BpClassClass->factorySet(BpClassClass);

-        return(objectClass);
-    }//BpClass_CreateMetaClasses;
-
-
-    CONSTRUCTOR(BpClass)
-    {
-        // No BpClass_PLUG here: it's done by BpClass_CreateMetaClasses,
-        // called by BpObject constructor.
-        if((isa!=NIL)&&(isa!=(BpClass*)1)){
-            isa->release();
-        }
-        isa=BpClassClass;
-        if(isa!=NIL){
-            isa->retain();
-        }
-        fName=NIL;
-        fSuperClass=NIL;
-        fFactory=NIL;
-    }//BpClass;
+    return(objectClass);
+}//BpClass_CreateMetaClasses;
+
+CLASSMETHOD(BpClass,createMetaClasses,(void),BpClass*)
+{
+    return(BpClass_CreateMetaClasses());
+}
+
+CONSTRUCTOR(BpClass)
+{
+    // No BpClass_PLUG here: it's done by BpClass_CreateMetaClasses,
+    // called by BpObject constructor.
+    if((isa!=NIL)&&(isa!=(BpClass*)1)){
+        isa->release();
+    }
+    isa=BpClassClass;
+    if(isa!=NIL){
+        isa->retain();
+    }
+    fName=NIL;
+    fSuperClass=NIL;
+    fFactory=NIL;
+}//BpClass;


-    DESTRUCTOR(BpClass)
-    {
-        if(fFactory!=NIL){
-            fFactory->release();
-        }
-        if(fSuperClass!=NIL){
-            fSuperClass->release();
-        }
-    }//~BpClass;
+DESTRUCTOR(BpClass)
+{
+    if(fFactory!=NIL){
+        fFactory->release();
+    }
+    if(fSuperClass!=NIL){
+        fSuperClass->release();
+    }
+}//~BpClass;


-    METHOD(BpClass,nameSet,(const char* nName),void)
-    {
-        fName=nName;
-    }//nameSet;
+METHOD(BpClass,nameSet,(const char* nName),void)
+{
+    fName=nName;
+}//nameSet;


-    METHOD(BpClass,superClassSet,(BpClass* nSuper),void)
-    {
-        if(fSuperClass!=NIL){
-            fSuperClass->release();
-        }
-        fSuperClass=nSuper;
-        fSuperClass->retain();
-    }//superClassSet;
+METHOD(BpClass,superClassSet,(BpClass* nSuper),void)
+{
+    if(fSuperClass!=NIL){
+        fSuperClass->release();
+    }
+    fSuperClass=nSuper;
+    fSuperClass->retain();
+}//superClassSet;


-    METHOD(BpClass,factorySet,(BpObject* nFactory),void)
-    {
-        if(fFactory!=NIL){
-            fFactory->release();
-        }
-        fFactory=nFactory;
-        fFactory->retain();
-    }//factorySet;
+METHOD(BpClass,factorySet,(BpObject* nFactory),void)
+{
+    if(fFactory!=NIL){
+        fFactory->release();
+    }
+    fFactory=nFactory;
+    fFactory->retain();
+}//factorySet;


 // override of BpObject methods:

-    METHOD(BpClass,makeBrother,(void),BpObject*)
-    {
-        return(NEW(BpClass));
-    }//makeBrother;
+METHOD(BpClass,makeBrother,(void),BpObject*)
+{
+    return(NEW(BpClass));
+}//makeBrother;


-    METHOD(BpClass,printOnLevel,(FILE* file,CARD32 level),void)
-    {
-        BpClass_SUPER::printOnLevel(file,level);
-        PRINTONLEVEL(file,level,"%s",fName,fName);
-        PRINTONLEVEL(file,level,"%p",fSuperClass,fSuperClass);
-        PRINTONLEVEL(file,level,"%p",fFactory,fFactory);
-    }//printOnLevel;
+METHOD(BpClass,printOnLevel,(FILE* file,CARD32 level),void)
+{
+    BpClass_SUPER::printOnLevel(file,level);
+    PRINTONLEVEL(file,level,"%s",fName,fName);
+    PRINTONLEVEL(file,level,"%p",fSuperClass,fSuperClass);
+    PRINTONLEVEL(file,level,"%p",fFactory,fFactory);
+}//printOnLevel;


 // BpClass methods:

-    METHOD(BpClass,name,(void),const char*)
-    {
-        return(fName);
-    }//name;
+METHOD(BpClass,name,(void),const char*)
+{
+    return(fName);
+}//name;


-    METHOD(BpClass,superClass,(void),BpClass*)
-    {
-        if(fSuperClass==NIL){
-            return(this);
-        }else{
-            return(fSuperClass);
-        }
-    }//superClass;
+METHOD(BpClass,superClass,(void),BpClass*)
+{
+    if(fSuperClass==NIL){
+        return(this);
+    }else{
+        return(fSuperClass);
+    }
+}//superClass;


-    METHOD(BpClass,factory,(void),BpObject*)
-    {
-        return(fFactory);
-    }//factory;
+METHOD(BpClass,factory,(void),BpObject*)
+{
+    return(fFactory);
+}//factory;


-    METHOD(BpClass,makeInstance,(void),BpObject*)
-    {
-        return(fFactory->makeBrother());
-    }//makeInstance;
+METHOD(BpClass,makeInstance,(void),BpObject*)
+{
+    return(fFactory->makeBrother());
+}//makeInstance;


-    METHOD(BpClass,isSubClassOf,(BpClass* aClass),BOOLEAN)
-    {
-            BpClass*    current;
-            BpClass*    next;
+METHOD(BpClass,isSubClassOf,(BpClass* aClass),BOOLEAN)
+{
+    BpClass*    current;
+    BpClass*    next;

-        current=this;
+    current=this;
+    next=current->superClass();
+    while((current!=next)&&(current!=aClass)){
+        current=next;
         next=current->superClass();
-        while((current!=next)&&(current!=aClass)){
-            current=next;
-            next=current->superClass();
-        }
-        return(current==aClass);
-    }//isSubClassOf;
-
-
-
-    PROCEDURE(BpClass_classNamed,(const char* className),BpClass*)
-    {
-        // SEE: BpClass_classNamed is not implemented.
-        /*
-            We should use our own hashtable.
-        */
-        return(NIL);
-    }//BpClass_classNamed;
+    }
+    return(current==aClass);
+}//isSubClassOf;
+
+
+
+PROCEDURE(BpClass_classNamed,(const char* className),BpClass*)
+{
+    // SEE: BpClass_classNamed is not implemented.
+    /*
+      We should use our own hashtable.
+    */
+    return(NIL);
+}//BpClass_classNamed;


 //END BpClass.
diff --git a/bplib/sources/BpDict.cc b/bplib/sources/BpDict.cc
index a485bed..a3fa870 100644
--- a/bplib/sources/BpDict.cc
+++ b/bplib/sources/BpDict.cc
@@ -34,7 +34,7 @@ MODIFICATIONS
     Initial revision

 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

diff --git a/bplib/sources/BpList.cc b/bplib/sources/BpList.cc
index c48a95b..5817f64 100644
--- a/bplib/sources/BpList.cc
+++ b/bplib/sources/BpList.cc
@@ -52,7 +52,7 @@ MODIFICATIONS
                     in the same sources.
     1994-12-30 <PJB> Added sort.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

@@ -89,7 +89,7 @@ extern "C"{
         BpClass_PLUG(BpList);
         lcount=0;
         lcapacity=BpList_Minimum;
-        elements=(BpObject**)BcMem_Allocate(sizeof(BpObject*)*lcapacity);
+        elements=(BpObject**)BcMem_Allocate((CARD32)sizeof(BpObject*)*lcapacity);
     }//BpList;


@@ -190,7 +190,7 @@ extern "C"{
         if(lcount>newCapacity){
             BcRAISE(BpList_eCapacityTooLow,(void*)this,(void*)newCapacity);
         }else{
-            newElements=(BpObject**)BcMem_Allocate(sizeof(BpObject*)*newCapacity);
+            newElements=(BpObject**)BcMem_Allocate((CARD32)sizeof(BpObject*)*newCapacity);
             i=0;
             while(i<lcount){
                 newElements[i]=elements[i];
diff --git a/bplib/sources/BpObject.cc b/bplib/sources/BpObject.cc
index d47c12f..d49f421 100644
--- a/bplib/sources/BpObject.cc
+++ b/bplib/sources/BpObject.cc
@@ -69,7 +69,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

@@ -102,7 +102,7 @@ extern "C"{

 //define DEBUG_POOL

-    static const char rcsid[]="$Id: BpObject.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";
+static const char rcsid[]="$Id: BpObject.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";

 class BpObject;

@@ -115,7 +115,7 @@ public:
     METHOD(DeletePool,addObject,(BpObject* obj),void)
     METHOD(DeletePool,removeObject,(BpObject* obj),void)
     METHOD(DeletePool,deleteObjects,(void),void)
-protected:
+    protected:
     BpObject**      pool;
     CARD32          poolCapacity;
     CARD32          poolCount;
@@ -125,359 +125,359 @@ protected:
 #include BcImplementation_h


-    CONSTRUCTOR(DeletePool)
-    {
-        poolCount=0;
-        poolCapacity=256;
-        pool=(BpObject**)BcMem_Allocate(sizeof(BpObject*)*poolCapacity);
-    }//DeletePool;
+CONSTRUCTOR(DeletePool)
+{
+    poolCount=0;
+    poolCapacity=256;
+    pool=(BpObject**)BcMem_Allocate((CARD32)sizeof(BpObject*)*poolCapacity);
+}//DeletePool;


-    DESTRUCTOR(DeletePool)
-    {
-        this->deleteObjects();
-        BcMem_Deallocate((void**)&pool);
-    }//~DeletePool;
+DESTRUCTOR(DeletePool)
+{
+    this->deleteObjects();
+    BcMem_Deallocate((void**)&pool);
+}//~DeletePool;


-    METHOD(DeletePool,count,(),CARD32)
-    {
-        return(poolCount);
-    }//count;
+METHOD(DeletePool,count,(),CARD32)
+{
+    return(poolCount);
+}//count;


-    METHOD(DeletePool,addObject,(BpObject* obj),void)
-    {
+METHOD(DeletePool,addObject,(BpObject* obj),void)
+{
 #ifdef DEBUG_POOL
-            CARD32      i;
-        for(i=0;i<poolCount;i++){
-            if(pool[i]==obj){
-                BcRAISE(BpObject_eDeleteInternal,obj,0);
-            }
+    CARD32      i;
+    for(i=0;i<poolCount;i++){
+        if(pool[i]==obj){
+            BcRAISE(BpObject_eDeleteInternal,obj,0);
         }
-fprintf(stderr,"%p %s [%d] added to delete pool.\n",
-obj,obj->className(),obj->retainCount());
+    }
+    fprintf(stderr,"%p %s [%d] added to delete pool.\n",
+            obj,obj->className(),obj->retainCount());
 #endif
-        if(poolCount>=poolCapacity){
-                BpObject**      newPool;
-                CARD32          i;
+    if(poolCount>=poolCapacity){
+        BpObject**      newPool;
+        CARD32          i;

-            poolCapacity*=2;
-            newPool=(BpObject**)BcMem_Allocate(sizeof(BpObject*)*poolCapacity);
-            for(i=0;i<poolCount;i++){
-                newPool[i]=pool[i];
-            }
-            BcMem_Deallocate((void**)&pool);
-            pool=newPool;
+        poolCapacity*=2;
+        newPool=(BpObject**)BcMem_Allocate((CARD32)sizeof(BpObject*)*poolCapacity);
+        for(i=0;i<poolCount;i++){
+            newPool[i]=pool[i];
         }
-        pool[poolCount++]=obj;
-    }//addObject;
+        BcMem_Deallocate((void**)&pool);
+        pool=newPool;
+    }
+    pool[poolCount++]=obj;
+}//addObject;


-    METHOD(DeletePool,removeObject,(BpObject* obj),void)
-    {
-            CARD32          i;
+METHOD(DeletePool,removeObject,(BpObject* obj),void)
+{
+    CARD32          i;

-        // we are optimist: obj should be in the pool
-        i=poolCount;
-        while(i>0){
-            i--;
-            if(pool[i]==obj){
+    // we are optimist: obj should be in the pool
+    i=poolCount;
+    while(i>0){
+        i--;
+        if(pool[i]==obj){
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s [%d] removed from delete pool %d/%d = %5.3f %%.\n",
-obj,obj->className(),obj->retainCount(),
-poolCount-i,poolCount,(float)(poolCount-i)/(float)poolCount);
+            fprintf(stderr,"%p %s [%d] removed from delete pool %d/%d = %5.3f %%.\n",
+                    obj,obj->className(),obj->retainCount(),
+                    poolCount-i,poolCount,(float)(poolCount-i)/(float)poolCount);
 #endif
-                // ok remove it by moving upper obj down on it.
-                poolCount--;
-                while(i<poolCount){
-                    pool[i]=pool[i+1];
-                    i++;
-                }
-                return;
+            // ok remove it by moving upper obj down on it.
+            poolCount--;
+            while(i<poolCount){
+                pool[i]=pool[i+1];
+                i++;
             }
+            return;
         }
-        BcRAISE(BpObject_eDeleteInternal,obj,(void*)1);
-    }//removeObject;
+    }
+    BcRAISE(BpObject_eDeleteInternal,obj,(void*)1);
+}//removeObject;


-    METHOD(DeletePool,deleteObjects,(void),void)
-    {
-            CARD32          i;
+METHOD(DeletePool,deleteObjects,(void),void)
+{
+    CARD32          i;

-        for(i=0;i<poolCount;i++){
+    for(i=0;i<poolCount;i++){
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s [%d] deleted for good.\n",
-pool[i],pool[i]->className(),pool[i]->retainCount());
+        fprintf(stderr,"%p %s [%d] deleted for good.\n",
+                pool[i],pool[i]->className(),pool[i]->retainCount());
 #endif
-            DELETE(pool[i]);
-        }
-        poolCount=0;
-    }//deleteObjects;
+        DELETE(pool[i]);
+    }
+    poolCount=0;
+}//deleteObjects;



-    static DeletePool*      deletePool=NEW(DeletePool);
-    static DeletePool*      secondPool=NEW(DeletePool);
-    // secondPool is used while freeing objects in deletePool.
+static DeletePool*      deletePool=NEW(DeletePool);
+static DeletePool*      secondPool=NEW(DeletePool);
+// secondPool is used while freeing objects in deletePool.


 // birth and death:

-    CONSTRUCTOR(BpObject)
-    {
-        isa=NIL;
-        fDependants=NIL;
-        fRetainCount=0;
+CONSTRUCTOR(BpObject)
+{
+    isa=NIL;
+    fDependants=NIL;
+    fRetainCount=0;
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s [%d] construction.\n",(void*)this,this->className(),fRetainCount);
+    fprintf(stderr,"%p %s [%d] construction.\n",(void*)this,this->className(),fRetainCount);
 #endif
-        deletePool->addObject(this);
-        {
-            static BpClass* BpObjectClass=NIL;
-            if(BpObjectClass==NIL){
-                BpObjectClass=(BpClass*)1;
-                BpObjectClass=BpClass_CreateMetaClasses();
-                BpObjectClass->nameSet("BpObject");
-                BpObjectClass->factorySet(NEW(BpObject));
-            }
-            // isa is NIL. BpObjectClass is not NIL. BpObjectClass may be 1.
-            isa=BpObjectClass;
-            if(isa!=(BpClass*)1){
-                isa->retain();
-            }
-        }
-    }//BpObject;
-
-
-    DESTRUCTOR(BpObject)
+    deletePool->addObject(this);
     {
-        if(isa!=NIL){
-            isa->release();
+        static BpClass* BpObjectClass=NIL;
+        if(BpObjectClass==NIL){
+            BpObjectClass=(BpClass*)1;
+            BpObjectClass=BpClass::createMetaClasses();
+            BpObjectClass->nameSet("BpObject");
+            BpObjectClass->factorySet(NEW(BpObject));
         }
-        if(fDependants!=NIL){
-            fDependants->release();
+        // isa is NIL. BpObjectClass is not NIL. BpObjectClass may be 1.
+        isa=BpObjectClass;
+        if(isa!=(BpClass*)1){
+            isa->retain();
         }
+    }
+}//BpObject;
+
+
+DESTRUCTOR(BpObject)
+{
+    if(isa!=NIL){
+        isa->release();
+    }
+    if(fDependants!=NIL){
+        fDependants->release();
+    }
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s [%d] destruction.\n",(void*)this,this->className(),fRetainCount);
+    fprintf(stderr,"%p %s [%d] destruction.\n",(void*)this,this->className(),fRetainCount);
 #endif
-        if(fRetainCount!=0){
-            BcRAISE(BpObject_eDeleteRetained,(void*)this,(void*)fRetainCount);
-        }
-    }//~BpObject;
+    if(fRetainCount!=0){
+        BcRAISE(BpObject_eDeleteRetained,(void*)this,(void*)fRetainCount);
+    }
+}//~BpObject;


-    METHOD(BpObject,retain,(void),BpObject*)
-    {
-        if(fRetainCount==0){
-            deletePool->removeObject(this);
-        }
-        fRetainCount++;
+METHOD(BpObject,retain,(void),BpObject*)
+{
+    if(fRetainCount==0){
+        deletePool->removeObject(this);
+    }
+    fRetainCount++;
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s retain -> %d\n",(void*)this,this->className(),fRetainCount);
+    fprintf(stderr,"%p %s retain -> %d\n",(void*)this,this->className(),fRetainCount);
 #endif
-        return(this);
-    }//retain;
+    return(this);
+}//retain;


-    METHOD(BpObject,release,(void),BpObject*)
-    {
-        fRetainCount--;
-        if(fRetainCount==0){
-            deletePool->addObject(this);
-        }
+METHOD(BpObject,release,(void),BpObject*)
+{
+    fRetainCount--;
+    if(fRetainCount==0){
+        deletePool->addObject(this);
+    }
 #ifdef DEBUG_POOL
-fprintf(stderr,"%p %s release -> %d\n",(void*)this,this->className(),fRetainCount);
+    fprintf(stderr,"%p %s release -> %d\n",(void*)this,this->className(),fRetainCount);
 #endif
-        return(this);
-    }//release;
+    return(this);
+}//release;


-    METHOD(BpObject,retainCount,(void),INT32)
-    {
-        return(fRetainCount);
-    }//retainCount;
+METHOD(BpObject,retainCount,(void),INT32)
+{
+    return(fRetainCount);
+}//retainCount;


-    METHOD(BpObject,processDeletePool,(void),void)
-    {
-            CARD32          c;
-            DeletePool*     swap;
+METHOD(BpObject,processDeletePool,(void),void)
+{
+    CARD32          c;
+    DeletePool*     swap;

+    c=deletePool->count();
+    while(c>0){
+        swap=deletePool;
+        deletePool=secondPool;
+        secondPool=swap;
+        secondPool->deleteObjects();
         c=deletePool->count();
-        while(c>0){
-            swap=deletePool;
-            deletePool=secondPool;
-            secondPool=swap;
-            secondPool->deleteObjects();
-            c=deletePool->count();
-        }
-    }//processDeletePool;
+    }
+}//processDeletePool;


 // utility methods:

-    METHOD(BpObject,makeBrother,(void),BpObject*)
-    {
-        return(NEW(BpObject));
-    }//makeBrother;
+METHOD(BpObject,makeBrother,(void),BpObject*)
+{
+    return(NEW(BpObject));
+}//makeBrother;


-    METHOD(BpObject,className,(void),const char*)
-    {
-        return(isa->name());
-    }//className;
+METHOD(BpObject,className,(void),const char*)
+{
+    return(isa->name());
+}//className;


-    METHOD(BpObject,runtimeClass,(void),BpClass*)
-    {
-        return(isa);
-    }//runtimeClass;
+METHOD(BpObject,runtimeClass,(void),BpClass*)
+{
+    return(isa);
+}//runtimeClass;


-    METHOD(BpObject,superClass,(void),BpClass*)
-    {
-        return(isa->superClass());
-    }//superClass;
+METHOD(BpObject,superClass,(void),BpClass*)
+{
+    return(isa->superClass());
+}//superClass;


-    METHOD(BpObject,isKindOf,(const BpClass* aClass),BOOLEAN)
-    {
-        if(aClass==isa){
-            return(TRUE);
-        }else{
-            BpClass* curClass=isa;
-            BpClass* aSuperClass=curClass->superClass();
-            while(aSuperClass!=curClass){
-                if(aClass==curClass){
-                    return(TRUE);
-                }
-                curClass=aSuperClass;
-                aSuperClass=curClass->superClass();
+METHOD(BpObject,isKindOf,(const BpClass* aClass),BOOLEAN)
+{
+    if(aClass==isa){
+        return(TRUE);
+    }else{
+        BpClass* curClass=isa;
+        BpClass* aSuperClass=curClass->superClass();
+        while(aSuperClass!=curClass){
+            if(aClass==curClass){
+                return(TRUE);
             }
-            return((BOOLEAN)(aClass==curClass));
+            curClass=aSuperClass;
+            aSuperClass=curClass->superClass();
         }
-    }//isKindOf;
+        return((BOOLEAN)(aClass==curClass));
+    }
+}//isKindOf;


-    METHOD(BpObject,isKindOfClassNamed,(const char* aClassName),BOOLEAN)
-    {
-        if(strcmp(aClassName,isa->name())==0){
-            return(TRUE);
-        }else{
-            BpClass* curClass=isa;
-            BpClass* aSuperClass=curClass->superClass();
-            while(aSuperClass!=curClass){
-                if(strcmp(aClassName,curClass->name())==0){
-                    return(TRUE);
-                }
-                curClass=aSuperClass;
-                aSuperClass=curClass->superClass();
+METHOD(BpObject,isKindOfClassNamed,(const char* aClassName),BOOLEAN)
+{
+    if(strcmp(aClassName,isa->name())==0){
+        return(TRUE);
+    }else{
+        BpClass* curClass=isa;
+        BpClass* aSuperClass=curClass->superClass();
+        while(aSuperClass!=curClass){
+            if(strcmp(aClassName,curClass->name())==0){
+                return(TRUE);
             }
-            return((BOOLEAN)(strcmp(aClassName,curClass->name())==0));
+            curClass=aSuperClass;
+            aSuperClass=curClass->superClass();
         }
-    }//isKindOfClassNamed;
+        return((BOOLEAN)(strcmp(aClassName,curClass->name())==0));
+    }
+}//isKindOfClassNamed;


-    METHOD(BpObject,isMemberOf,(const BpClass* aClass),BOOLEAN)
-    {
-        return((BOOLEAN)(isa==aClass));
-    }//isMemberOf;
+METHOD(BpObject,isMemberOf,(const BpClass* aClass),BOOLEAN)
+{
+    return((BOOLEAN)(isa==aClass));
+}//isMemberOf;


-    METHOD(BpObject,isMemberOfClassNamed,(const char* aClassName),BOOLEAN)
-    {
-        return(strcmp(aClassName,isa->name())==0);
-    }//isMemberOfClassNamed;
+METHOD(BpObject,isMemberOfClassNamed,(const char* aClassName),BOOLEAN)
+{
+    return(strcmp(aClassName,isa->name())==0);
+}//isMemberOfClassNamed;


-    METHOD(BpObject,dependantCount,(void),CARD32)
-    {
-        if(fDependants==NIL){
-            return(0);
-        }else{
-            return(fDependants->count());
-        }
-    }//dependantCount;
+METHOD(BpObject,dependantCount,(void),CARD32)
+{
+    if(fDependants==NIL){
+        return(0);
+    }else{
+        return(fDependants->count());
+    }
+}//dependantCount;


-    METHOD(BpObject,dependantAt,(CARD32 index),BpObject*)
-    {
-        if(fDependants==NIL){
-            return(NIL);
-        }else{
-            return(fDependants->objectAt(index));
-        }
-    }//dependantAt;
+METHOD(BpObject,dependantAt,(CARD32 index),BpObject*)
+{
+    if(fDependants==NIL){
+        return(NIL);
+    }else{
+        return(fDependants->objectAt(index));
+    }
+}//dependantAt;


-    METHOD(BpObject,dependantAdd,(BpObject* nDependant),void)
-    {
-        if(fDependants==NIL){
-            fDependants=NEW(BpList);
-            fDependants->retain();
-        }
-        fDependants->addObject(nDependant);
-    }//dependantAdd;
+METHOD(BpObject,dependantAdd,(BpObject* nDependant),void)
+{
+    if(fDependants==NIL){
+        fDependants=NEW(BpList);
+        fDependants->retain();
+    }
+    fDependants->addObject(nDependant);
+}//dependantAdd;


-    METHOD(BpObject,dependantRemove,(BpObject* nDependant),void)
-    {
-        if(fDependants!=NIL){
-            fDependants->removeObject(nDependant);
-            if(fDependants->count()==0){
-                fDependants->release();
-                fDependants=NIL;
-            }
+METHOD(BpObject,dependantRemove,(BpObject* nDependant),void)
+{
+    if(fDependants!=NIL){
+        fDependants->removeObject(nDependant);
+        if(fDependants->count()==0){
+            fDependants->release();
+            fDependants=NIL;
         }
-    }//dependantRemove;
+    }
+}//dependantRemove;


-    METHOD(BpObject,dependantRemoveAt,(CARD32 index),BpObject*)
-    {
-        if(fDependants!=NIL){
-                BpObject*       oldObject;
-            oldObject=fDependants->removeObjectAt(index);
-            if(fDependants->count()==0){
-                fDependants->release();
-                fDependants=NIL;
-            }
-            return(oldObject);
-        }else{
-            return(NIL);
+METHOD(BpObject,dependantRemoveAt,(CARD32 index),BpObject*)
+{
+    if(fDependants!=NIL){
+        BpObject*       oldObject;
+        oldObject=fDependants->removeObjectAt(index);
+        if(fDependants->count()==0){
+            fDependants->release();
+            fDependants=NIL;
         }
-    }//dependantRemoveAt;
+        return(oldObject);
+    }else{
+        return(NIL);
+    }
+}//dependantRemoveAt;


-    METHOD(BpObject,selfChanged,(INT32 cause),void)
-    {
-            CARD32      i;
-            CARD32      c;
+METHOD(BpObject,selfChanged,(INT32 cause),void)
+{
+    CARD32      i;
+    CARD32      c;

-        c=dependantCount();
-        for(i=0;i<c;i++){
-            dependantAt(i)->dependeeChanged(this,cause);
-        }
-    }//selfChanged;
+    c=dependantCount();
+    for(i=0;i<c;i++){
+        dependantAt(i)->dependeeChanged(this,cause);
+    }
+}//selfChanged;


-    METHOD(BpObject,dependeeChanged,(BpObject* dependee,INT32 cause),void)
-    {
-        //NOP.
-    }//dependeeChanged;
+METHOD(BpObject,dependeeChanged,(BpObject* dependee,INT32 cause),void)
+{
+    //NOP.
+}//dependeeChanged;


-    METHOD(BpObject,printOnLevel,(FILE* file,CARD32 level),void)
-    {
-        PRINTONLEVEL(file,level,"%s",class,this->className());
-        PRINTONLEVEL(file,level,"%p",address,(void*)this);
-    }//printOnLevel;
+METHOD(BpObject,printOnLevel,(FILE* file,CARD32 level),void)
+{
+    PRINTONLEVEL(file,level,"%s",class,this->className());
+    PRINTONLEVEL(file,level,"%p",address,(void*)this);
+}//printOnLevel;


-    METHOD(BpObject,printOn,(FILE* file),void)
-    {
-        printOnLevel(file,0);
-    }//print;
+METHOD(BpObject,printOn,(FILE* file),void)
+{
+    printOnLevel(file,0);
+}//print;


 //END BpObject.
diff --git a/bplib/sources/BpString.cc b/bplib/sources/BpString.cc
index c62174f..c1320cf 100644
--- a/bplib/sources/BpString.cc
+++ b/bplib/sources/BpString.cc
@@ -41,7 +41,7 @@ MODIFICATIONS
                     This is needed for we can mix Objective-C with CPlusPlus
                     in the same sources.
 LEGAL
-    Copyright Pascal J. Bourguignon 1993 - 2002
+    Copyright Pascal J. Bourguignon 1993 - 2011

     This file is part of the bplib library..

@@ -71,18 +71,18 @@ extern "C"{
 }
 #include BcImplementation_h

-    static const char rcsid[]="$Id: BpString.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";
+static const char rcsid[]="$Id: BpString.cc,v 1.1 2003/12/04 04:52:58 pjbpjb Exp $";




 /*
-    INVARIANTS:
-        data#NIL
-        1<=allocation
-        0<=dlength<allocation
-        data[dlength]=(char)0
-        for all i in [0..dlength-1], data[i]#(char)0
+  INVARIANTS:
+  data#NIL
+  1<=allocation
+  0<=dlength<allocation
+  data[dlength]=(char)0
+  for all i in [0..dlength-1], data[i]#(char)0
 */

 #define AllocIncrement  (128)
@@ -90,338 +90,330 @@ extern "C"{

 // birth and death:

-    CONSTRUCTOR(BpString)
-    {
-        BpClass_PLUG(BpString);
-        allocation=1;
-        data=(char*)BcMem_Allocate(sizeof(char)*allocation);
-        dlength=0;
-        data[dlength]=(char)0;
-    }//BpString;
+CONSTRUCTOR(BpString)
+{
+    BpClass_PLUG(BpString);
+    allocation=1;
+    data=(char*)BcMem_Allocate(sizeof(char)*allocation);
+    dlength=0;
+    data[dlength]=(char)0;
+}//BpString;

-    DESTRUCTOR(BpString)
-    {
-        BcMem_Deallocate((void**)(&data));
-    }//~BpString;
-
-
-    BpString::BpString(const char* cString)
-    {
-        BpClass_PLUG(BpString);
-        allocation=1;
-        data=(char*)BcMem_Allocate(sizeof(char)*allocation);
-        dlength=0;
-        data[dlength]=(char)0;
-        this->setString(cString);
-    }//BpString;
+DESTRUCTOR(BpString)
+{
+    BcMem_Deallocate((void**)(&data));
+}//~BpString;
+
+
+BpString::BpString(const char* cString)
+{
+    BpClass_PLUG(BpString);
+    allocation=1;
+    data=(char*)BcMem_Allocate(sizeof(char)*allocation);
+    dlength=0;
+    data[dlength]=(char)0;
+    this->setString(cString);
+}//BpString;

 // override BpObject methods:

-    METHOD(BpString,makeBrother,(void),BpObject*)
-    {
-        return(NEW(BpString));
-    }//makeBrother;
+METHOD(BpString,makeBrother,(void),BpObject*)
+{
+    return(NEW(BpString));
+}//makeBrother;


-    METHOD(BpString,printOnLevel,(FILE* file,CARD32 level),void)
-    {
-        BpString_SUPER::printOnLevel(file,level);
-        PRINTONLEVEL(file,level,"%p",data,(void*)data);
-        if(data!=NIL){
-            PRINTONLEVEL(file,level,"\"%s\"",*data,data);
-        }
-        PRINTONLEVEL(file,level,"%ld",dlength,dlength);
-        PRINTONLEVEL(file,level,"%ld",allocation,allocation);
-    }//printOnLevel;
+METHOD(BpString,printOnLevel,(FILE* file,CARD32 level),void)
+{
+    BpString_SUPER::printOnLevel(file,level);
+    PRINTONLEVEL(file,level,"%p",data,(void*)data);
+    if(data!=NIL){
+        PRINTONLEVEL(file,level,"\"%s\"",*data,data);
+    }
+    PRINTONLEVEL(file,level,"%ld",dlength,dlength);
+    PRINTONLEVEL(file,level,"%ld",allocation,allocation);
+}//printOnLevel;


 // new methods:

-    METHOD(BpString,length,(void),INT32)
-    {
-        return(dlength);
-    }//length;
+METHOD(BpString,length,(void),CARD32)
+{
+    return(dlength);
+}//length;


-    METHOD(BpString,string,(void),const char*)
-    {
-        return(data);
-    }//string;
+METHOD(BpString,string,(void),const char*)
+{
+    return(data);
+}//string;


-    METHOD(BpString,setString,(const char* nString),BpString*)
-    {
-            INT32       nLength;
+METHOD(BpString,setString,(const char* nString),BpString*)
+{
+    CARD32       nLength;

-        nLength=strlen(nString);
-        if(nLength>=allocation){
-            this->setCapacityCopy(nLength+1,FALSE);
-        }
-        BcMem_Copy((const void*)nString,data,nLength*sizeof(char));
-        data[nLength]=(char)0;
-        dlength=nLength;
-        selfChanged(0);
-        return(this);
-    }//setString:;
-
-
-    METHOD(BpString,setStringNoCopy,(char* someData,INT32 byteCount),void)
-    {
-        BcMem_Deallocate((void**)(&data));
-        data=someData;
-        dlength=strlen(someData);
-        allocation=byteCount;
-        if(dlength>=allocation){
-            dlength=allocation-1;
-        }
-        data[dlength]='\0';
-        selfChanged(0);
-    }//setStringNoCopy;
-
-
-    METHOD(BpString,getString,(char* str),BpString*)
-    {
-        BcMem_Copy(data,str,dlength*sizeof(char));
-        str[dlength]=(char)0;
-        return(this);
-    }//getString:;
-
-
-    METHOD(BpString,copyFrom,(BpString* source),BpString*)
-    {
-        dlength=0;
-        data[0]='\0';
-        _insertStringAt(source->data,source->dlength,0);
-        selfChanged(0);
-        return(this);
-    }//copyFrom;
+    nLength=(CARD32)strlen(nString);
+    if(nLength>=allocation){
+        this->setCapacityCopy(nLength+1,FALSE);
+    }
+    BcMem_Copy((const void*)nString,data,nLength*sizeof(char));
+    data[nLength]=(char)0;
+    dlength=nLength;
+    selfChanged(0);
+    return(this);
+}//setString:;
+
+
+METHOD(BpString,setStringNoCopy,(char* someData,CARD32 byteCount),void)
+{
+    BcMem_Deallocate((void**)(&data));
+    data=someData;
+    dlength=(CARD32)strlen(someData);
+    allocation=byteCount;
+    if(dlength>=allocation){
+        dlength=allocation-1;
+    }
+    data[dlength]='\0';
+    selfChanged(0);
+}//setStringNoCopy;
+
+
+METHOD(BpString,getString,(char* str),BpString*)
+{
+    BcMem_Copy(data,str,dlength*sizeof(char));
+    str[dlength]=(char)0;
+    return(this);
+}//getString:;
+
+
+METHOD(BpString,copyFrom,(BpString* source),BpString*)
+{
+    dlength=0;
+    data[0]='\0';
+    _insertStringAt(source->data,source->dlength,0);
+    selfChanged(0);
+    return(this);
+}//copyFrom;


-    METHOD(BpString,charAt,(INT32 index),char)
-    {
-        if((index<0)OR(index>=dlength)){
-            return((char)0);
-        }else{
-            return(data[index]);
-        }
-    }//charAt:;
-
-
-    METHOD(BpString,setCharAt,(char nChar,INT32 index),BpString*)
-    {
-        if((0<=index)AND(index<=dlength)){
-            if(nChar==(char)0){
-                dlength=index;
-            }else if(index==dlength){
-                if(allocation<=dlength+1){
-                    this->setCapacityCopy(allocation+AllocIncrement,TRUE);
-                }
-                INC(dlength);
-                data[dlength]=(char)0;
+METHOD(BpString,charAt,(CARD32 index),char)
+{
+    if((index<0)OR(index>=dlength)){
+        return((char)0);
+    }else{
+        return(data[index]);
+    }
+}//charAt:;
+
+
+METHOD(BpString,setCharAt,(char nChar,CARD32 index),BpString*)
+{
+    if((0<=index)AND(index<=dlength)){
+        if(nChar==(char)0){
+            dlength=index;
+        }else if(index==dlength){
+            if(allocation<=dlength+1){
+                this->setCapacityCopy(allocation+AllocIncrement,TRUE);
             }
-            data[index]=nChar;
-            selfChanged(0);
+            INC(dlength);
+            data[dlength]=(char)0;
         }
-        return(this);
-    }//setChar:;
+        data[index]=nChar;
+        selfChanged(0);
+    }
+    return(this);
+}//setChar:;


-    METHOD(BpString,compare,(BpString* otherString),SignT)
-    {
-        return(strcmp(this->data,otherString->data));
-    }//compare;
+METHOD(BpString,compare,(BpString* otherString),SignT)
+{
+    return(strcmp(this->data,otherString->data));
+}//compare;


-    METHOD(BpString,_insertStringAt,
-                    (const char* sString,INT32 sLength,INT32 index),BpString*)
-    {
-            INT32       nLength;
-
-        if(index<0){
-            index=0;
-        }else if(dlength<index){
-            index=dlength;
-        }
-        nLength=dlength+sLength;
-        if(nLength>=allocation){
-            // SEE: We copy some char of this twice !
-            this->setCapacityCopy(nLength+1,TRUE);
-        }
-        BcMem_Copy(data+index,data+index+sLength,
-                    (dlength-index+1)*sizeof(char));
-        BcMem_Copy((const void*)sString,data+index,sLength*sizeof(char));
-        dlength=nLength;
-        return(this);
-    }//_insertStringAt;
+METHOD(BpString,_insertStringAt,(const char* sString,CARD32 sLength,CARD32 index),BpString*)
+{
+    CARD32       nLength;
+
+    if(index<0){
+        index=0;
+    }else if(dlength<index){
+        index=dlength;
+    }
+    nLength=dlength+sLength;
+    if(nLength>=allocation){
+        // SEE: We copy some char of this twice !
+        this->setCapacityCopy(nLength+1,TRUE);
+    }
+    BcMem_Copy(data+index,data+index+sLength,
+               (dlength-index+1)*sizeof(char));
+    BcMem_Copy((const void*)sString,data+index,sLength*sizeof(char));
+    dlength=nLength;
+    return(this);
+}//_insertStringAt;


-    METHOD(BpString,insertAt,(BpString* substring,INT32 index),BpString*)
-    {
-        _insertStringAt(substring->data,substring->dlength,index);
-        selfChanged(0);
-        return(this);
-    }//insert:at:;
-
-
-    METHOD(BpString,deleteFromLength,(INT32 index,INT32 delen),BpString*)
-    {
-        if(index<0){
-            index=0;
-        }else if(dlength<=index){
-            return(this);
-        }
-        if(dlength<index+delen){
-            delen=dlength-index;
-        }
-        BcMem_Copy(data+index+delen,data+index,
-                    (dlength-(index+delen)+1)*sizeof(char));
-        dlength=dlength-delen;
-        selfChanged(0);
+METHOD(BpString,insertAt,(BpString* substring,CARD32 index),BpString*)
+{
+    _insertStringAt(substring->data,substring->dlength,index);
+    selfChanged(0);
+    return(this);
+}//insert:at:;
+
+
+METHOD(BpString,deleteFromLength,(CARD32 index,CARD32 delen),BpString*)
+{
+    if(index<0){
+        index=0;
+    }else if(dlength<=index){
         return(this);
-    }//deleteFrom:dlength:;
-
-
-    METHOD(BpString,positionFrom,(BpString* substring,INT32 index),INT32)
-    {
-        // SEE: could we use the FastStringSearch algorithm?
-            INT32           pos;
-            INT32           i;
-            INT32           max;
+    }
+    if(dlength<index+delen){
+        delen=dlength-index;
+    }
+    BcMem_Copy(data+index+delen,data+index,(dlength-(index+delen)+1)*sizeof(char));
+    dlength=dlength-delen;
+    selfChanged(0);
+    return(this);
+}//deleteFrom:dlength:;
+
+
+METHOD(BpString,positionFrom,(BpString* substring,CARD32 index),CARD32)
+{
+    // SEE: could we use the FastStringSearch algorithm?
+    CARD32           pos;
+    CARD32           i;
+    CARD32           max;

-        max=dlength-substring->dlength;
-        if(index<0){
-            pos=0;
-        }else{
-            pos=index;
+    max=dlength-substring->dlength;
+    if(index<0){
+        pos=0;
+    }else{
+        pos=index;
+    }
+    while(pos<=max){
+        i=0;
+        while(data[pos+i]==substring->data[i]){
+            INC(i);
         }
-        while(pos<=max){
-            i=0;
-            while(data[pos+i]==substring->data[i]){
-                INC(i);
-            }
-            if(substring->data[i]==(char)0){
-                return(pos);
-            }
-            INC(pos);
-        }
-        // not found
-        return(-1);
-    }//position:;
-
-
-    METHOD(BpString,copyFromLength,
-            (BpString* str,INT32 index,INT32 copylen),BpString*)
-    {
-        if(index+copylen>str->dlength){
-            copylen=str->dlength-index;
+        if(substring->data[i]==(char)0){
+            return(pos);
         }
-        if(copylen<=0){
-            data[0]=(char)0;
-            dlength=0;
-            selfChanged(0);
-            return(this);
-        }
-        if(copylen>=allocation){
-            this->setCapacityCopy(copylen+1,FALSE);
-        }
-        BcMem_Copy(str->data+index,data,copylen*sizeof(char));
-        data[copylen]=(char)0;
-        dlength=copylen;
-        selfChanged(0);
-        return(this);
-    }//copy:from:dlength:;
-
-
-    METHOD(BpString,append,(BpString* tail),BpString*)
-    {
-        _insertStringAt(tail->data,tail->dlength,dlength);
+        INC(pos);
+    }
+    // not found
+    return(MAX_CARD32);
+}//position:;
+
+
+METHOD(BpString,copyFromLength,(BpString* str,CARD32 index,CARD32 copylen),BpString*)
+{
+    if(index+copylen>str->dlength){
+        copylen=str->dlength-index;
+    }
+    if(copylen<=0){
+        data[0]=(char)0;
+        dlength=0;
         selfChanged(0);
         return(this);
-    }//append:;
+    }
+    if(copylen>=allocation){
+        this->setCapacityCopy(copylen+1,FALSE);
+    }
+    BcMem_Copy(str->data+index,data,copylen*sizeof(char));
+    data[copylen]=(char)0;
+    dlength=copylen;
+    selfChanged(0);
+    return(this);
+}//copy:from:dlength:;
+
+
+METHOD(BpString,append,(BpString* tail),BpString*)
+{
+    _insertStringAt(tail->data,tail->dlength,dlength);
+    selfChanged(0);
+    return(this);
+}//append:;


-    METHOD(BpString,appendString,(const char* nString),BpString*)
-    {
-        _insertStringAt(nString,strlen(nString),dlength);
-        selfChanged(0);
-        return(this);
-    }//appendString;
+METHOD(BpString,appendString,(const char* nString),BpString*)
+{
+    _insertStringAt(nString,(CARD32)strlen(nString),dlength);
+    selfChanged(0);
+    return(this);
+}//appendString;


-    METHOD(BpString,setCapacityCopy,(INT32 nAllocation,BOOLEAN copy),BpString*)
-    {
-            char*       nData;
-            INT32       nLength;
+METHOD(BpString,setCapacityCopy,(CARD32 nAllocation,BOOLEAN copy),BpString*)
+{
+    char*       nData;
+    CARD32      nLength;

-        if(nAllocation>1){
-            nData=(char*)BcMem_Allocate(sizeof(char)*nAllocation);
-            if(copy){
-                nLength=Minimum(nAllocation-1,dlength);
-                BcMem_Copy(data,nData,nLength*sizeof(char));
-            }else{
-                nLength=0;
-            }
+    if(nAllocation>1){
+        nData=(char*)BcMem_Allocate(sizeof(char)*nAllocation);
+        if(copy){
+            nLength=Minimum(nAllocation-1,dlength);
+            BcMem_Copy(data,nData,nLength*sizeof(char));
         }else{
-            nAllocation=1;
-            nData=(char*)BcMem_Allocate(sizeof(char)*nAllocation);
             nLength=0;
         }
-        nData[nLength]=(char)0;
-        BcMem_Deallocate((void**)(&data));
-        data=nData;
-        dlength=nLength;
-        allocation=nAllocation;
-        return(this);
-    }//setCapacity;
-
-
-
-    METHOD(BpString,shellQuoted,(void),BpString*)
-    {
-        static const char acceptedSpecials[]="+,-./:=@^_";
-        const char*       p=data;
-        BOOLEAN           containsSpecial=FALSE;
-        CARD32            quoteCount=0;
-
-        while(*p!='\0'){
-            if(!((isalnum(*p))||(strchr(acceptedSpecials,*p)!=0))){
-                if(*p=='\''){
-                    quoteCount++;
-                }
-                containsSpecial=TRUE;
+    }else{
+        nAllocation=1;
+        nData=(char*)BcMem_Allocate(sizeof(char)*nAllocation);
+        nLength=0;
+    }
+    nData[nLength]=(char)0;
+    BcMem_Deallocate((void**)(&data));
+    data=nData;
+    dlength=nLength;
+    allocation=nAllocation;
+    return(this);
+}//setCapacity;
+
+
+
+METHOD(BpString,shellQuoted,(void),BpString*)
+{
+    static const char acceptedSpecials[]="+,-./:=@^_";
+    const char*       p=data;
+    BOOLEAN           containsSpecial=FALSE;
+    CARD32            quoteCount=0;
+
+    while(*p!='\0'){
+        if(!((isalnum(*p))||(strchr(acceptedSpecials,*p)!=0))){
+            if(*p=='\''){
+                quoteCount++;
             }
-            p++;
+            containsSpecial=TRUE;
         }
-        if(containsSpecial){
-            char* d;
-            BpString* quotedString=NEW(BpString);
-            quotedString->setCapacityCopy(this->length()+2+3*quoteCount+1,
-                                          FALSE);
-            p=data;
-            d=quotedString->data;
-            (*d++)='\'';
-            while(*p!='\0'){
-              if(*p=='\''){
-                  (*d++)='\'';
-                  (*d++)='\\';
-                  (*d++)='\'';
-                  (*d++)='\'';
-                  p++;
-              }else{
-                  (*d++)=(*p++);
-              }
+        p++;
+    }
+    if(containsSpecial){
+        char* d;
+        BpString* quotedString=NEW(BpString);
+        quotedString->setCapacityCopy(this->length()+2+3*quoteCount+1,FALSE);
+        p=data;
+        d=quotedString->data;
+        (*d++)='\'';
+        while(*p!='\0'){
+            if(*p=='\''){
+                (*d++)='\'';
+                (*d++)='\\';
+                (*d++)='\'';
+                (*d++)='\'';
+                p++;
+            }else{
+                (*d++)=(*p++);
             }
-            (*d++)='\'';
-            (*d++)='\0';
-            quotedString->dlength=d-quotedString->data;
-            return(quotedString);
-        }else{
-            return(this);
         }
-    }//shellQuoted;
-
-
-//END BpString.
-
+        (*d++)='\'';
+        (*d++)='\0';
+        quotedString->dlength=(CARD32)(d-quotedString->data);
+        return(quotedString);
+    }else{
+        return(this);
+    }
+}//shellQuoted;

-/*** BpString.cc                      -- 2003-11-30 07:38:26 -- pascal   ***/
+//// THE END ////
diff --git a/bplib/sources/BpTimer-MacOS.cc b/bplib/sources/BpTimer-MacOS.cc
index f129de1..cfd4a9b 100644
--- a/bplib/sources/BpTimer-MacOS.cc
+++ b/bplib/sources/BpTimer-MacOS.cc
@@ -47,7 +47,7 @@ MODIFICATIONS
                     in the same sources.
     1994-02-05 <PJB> Allowed NIL parameters to start() method.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/sources/BpTimer-NEXTSTEP.cc b/bplib/sources/BpTimer-NEXTSTEP.cc
index f0ba1e1..b5fb05e 100644
--- a/bplib/sources/BpTimer-NEXTSTEP.cc
+++ b/bplib/sources/BpTimer-NEXTSTEP.cc
@@ -42,7 +42,7 @@ MODIFICATIONS
                     in the same sources.
     1994-02-05 <PJB> Allowed NIL parameters to start() method.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

diff --git a/bplib/sources/PrintOnLevel.cc b/bplib/sources/PrintOnLevel.cc
index 5c78525..92abe28 100644
--- a/bplib/sources/PrintOnLevel.cc
+++ b/bplib/sources/PrintOnLevel.cc
@@ -23,7 +23,7 @@ AUTHORS
 MODIFICATIONS
     1992-08-16 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 2002
+    Copyright Pascal J. Bourguignon 1992 - 2011

     This file is part of the bplib library..

@@ -72,11 +72,11 @@ LEGAL


     void PrintOnLevel_elementPrintf(FILE* file,CARD32 level,const char* name,
-            CARD32 index,const char* format,...)
+                                    CARD32 index,const char* format,...)
     {
         va_list parameters;
         va_start(parameters,format);
-        fprintf(file,"%*s%-16s[%4lu]=",asSize(level),"",name,index);
+        fprintf(file,"%*s%-16s[%4"FMT_CARD32"]=",asSize(level),"",name,index);
         vfprintf(file,format,parameters);
         fprintf(file,"\n");
         va_end(parameters);
diff --git a/bplib/tests/BpClassTest/sources/BpClassTest.cc b/bplib/tests/BpClassTest/sources/BpClassTest.cc
index 646a3b1..32df7a1 100644
--- a/bplib/tests/BpClassTest/sources/BpClassTest.cc
+++ b/bplib/tests/BpClassTest/sources/BpClassTest.cc
@@ -9,7 +9,7 @@ AUTHOR
 MODIFICATIONS
     1995-11-19 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

diff --git a/bplib/tests/BpClassTest/sources/BpClassTest.hh b/bplib/tests/BpClassTest/sources/BpClassTest.hh
index a3a5a48..476f5c3 100644
--- a/bplib/tests/BpClassTest/sources/BpClassTest.hh
+++ b/bplib/tests/BpClassTest/sources/BpClassTest.hh
@@ -9,7 +9,7 @@ AUTHOR
 MODIFICATIONS
     1995-11-19 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

diff --git a/bplib/tests/BpDictTest/sources/BpDictTest.cc b/bplib/tests/BpDictTest/sources/BpDictTest.cc
index b81a682..b9a36a0 100644
--- a/bplib/tests/BpDictTest/sources/BpDictTest.cc
+++ b/bplib/tests/BpDictTest/sources/BpDictTest.cc
@@ -15,7 +15,7 @@ MODIFICATIONS
     Added common libraries and dosname utility to the repository.

 LEGAL
-    Copyright Pascal J. Bourguignon 1995 - 2002
+    Copyright Pascal J. Bourguignon 1995 - 2011

     This file is part of the bplib library..

diff --git a/bprib/interfaces/BpRIB.hh b/bprib/interfaces/BpRIB.hh
index 9565ff8..f481756 100644
--- a/bprib/interfaces/BpRIB.hh
+++ b/bprib/interfaces/BpRIB.hh
@@ -12,7 +12,7 @@ AUTHORS
 MODIFICATIONS
     1994/12/28 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1994 - 1995
+    Copyright Pascal J. Bourguignon 1994 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bprib/interfaces/names.h b/bprib/interfaces/names.h
index e04d4b6..b2fb041 100644
--- a/bprib/interfaces/names.h
+++ b/bprib/interfaces/names.h
@@ -11,7 +11,7 @@ AUTHOR
 MODIFICATIONS
     1995/10/18 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1992 - 1993
+    Copyright Pascal J. Bourguignon 1992 - 2011
     All rights reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
diff --git a/bprib/sources/BpRIB.cc b/bprib/sources/BpRIB.cc
index d03872e..7b7978a 100644
--- a/bprib/sources/BpRIB.cc
+++ b/bprib/sources/BpRIB.cc
@@ -12,7 +12,7 @@ AUTHORS
 MODIFICATIONS
     1994/12/28 <PJB> Creation.
 LEGAL
-    Copyright Pascal J. Bourguignon 1994 - 1995
+    Copyright Pascal J. Bourguignon 1994 - 2011
     All Rights Reserved.
     This program may not be included in any commercial product without the
     author written permission. It may be used freely for any non-commercial
@@ -30,311 +30,311 @@ extern "C"{


 /*
-    We test and convert to upper case letters ourselves, because
-    the RIB may contain only the following characters:
-        0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
-    and ctype macro may classify and process also accented letters.
+  We test and convert to upper case letters ourselves, because
+  the RIB may contain only the following characters:
+  0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
+  and ctype macro may classify and process also accented letters.
 */


 #ifndef TARGET_USE_ASCII
-    static const char*  alphabet_from=
-            "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-    static const char   alphabet_value[]=
-            "012345678912345678912345678923456789";
+static const char*  alphabet_from=
+  "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+static const char   alphabet_value[]=
+  "012345678912345678912345678923456789";
 #endif


-    PROCEDURE(inRibAlphabet,(char c),BOOLEAN)
-        /*
-            RETURN:     c in {'0',...,'9','A',...,'Z','a',...,'z'}.
-        */
-    {
+PROCEDURE(inRibAlphabet,(char c),BOOLEAN)
+/*
+  RETURN:     c in {'0',...,'9','A',...,'Z','a',...,'z'}.
+*/
+{
 #ifdef TARGET_USE_ASCII
-        return((('0'<=c)&&(c<='9'))
-            ||(('A'<=c)&&(c<='Z'))
-            ||(('a'<=c)&&(c<='z')));
+    return((('0'<=c)&&(c<='9'))
+           ||(('A'<=c)&&(c<='Z'))
+           ||(('a'<=c)&&(c<='z')));
 #else
-            int     i;
+    int     i;

-        for(i=0;alphabet_from[i]!='\0';i++){
-            if(alphabet_from[i]==c){
-                return(TRUE);
-            }
+    for(i=0;alphabet_from[i]!='\0';i++){
+        if(alphabet_from[i]==c){
+            return(TRUE);
         }
-        return(FALSE);
+    }
+    return(FALSE);
 #endif
-    }//inRibAlphabet;
+}//inRibAlphabet;



-    PROCEDURE(convertToRibCase,(char c),char)
-        /*
-            PRE:        inRibAlphabet(c).
-            POST:       d=convertToRibCase(c) =>
-                            c in {'0',...,'9','A',...,'Z'} => d=c.
-                            c='a' => d='A',
-                            c='b' => d='b',
-                            ...
-                            c='z' => d='Z'.
-        */
-    {
+PROCEDURE(convertToRibCase,(char c),char)
+/*
+  PRE:        inRibAlphabet(c).
+  POST:       d=convertToRibCase(c) =>
+  c in {'0',...,'9','A',...,'Z'} => d=c.
+  c='a' => d='A',
+  c='b' => d='b',
+  ...
+  c='z' => d='Z'.
+*/
+{
 #ifdef TARGET_USE_ASCII
-        if(('a'<=c)&&(c<='z')){
-            return(c-'a'+'A');
-        }else{
-            return(c);
-        }
+    if(('a'<=c)&&(c<='z')){
+        return(c-'a'+'A');
+    }else{
+        return(c);
+    }
 #else
-            int     i;
+    int     i;

-        for(i=0;alphabet_from[i]!='\0';i++){
-            if(alphabet_from[i]==c){
-                if(i<10+26){
-                    return(c);
-                }else{
-                    return(alphabet_from[i-26]);
-                }
+    for(i=0;alphabet_from[i]!='\0';i++){
+        if(alphabet_from[i]==c){
+            if(i<10+26){
+                return(c);
+            }else{
+                return(alphabet_from[i-26]);
             }
         }
-        // If pre-condition is fullfilled, then we never pass here.
-        // SEE: we should raise an exception here.
-        return('0');
+    }
+    // If pre-condition is fullfilled, then we never pass here.
+    // SEE: we should raise an exception here.
+    return('0');
 #endif
-    }//convertToRibCase;
+}//convertToRibCase;


-    PROCEDURE(ribValue,(char c),char)
-        /*
-            PRE:        inRibAlphabet(c), convertToRibCase(c)=c.
-            POST:       d=convertToRibCase(c) =>
-                            c in {'0',...,'9'} => d=c.
-                            c='A' => d='1',
-                            ...
-                            c='I' => d='9',
-                            c='J' => d='1',
-                            ...
-                            c='R' => d='9',
-                            c='S' => d='2',
-                            ...
-                            c='Z' => d='9'.
-        */
-    {
+PROCEDURE(ribValue,(char c),char)
+/*
+  PRE:        inRibAlphabet(c), convertToRibCase(c)=c.
+  POST:       d=convertToRibCase(c) =>
+  c in {'0',...,'9'} => d=c.
+  c='A' => d='1',
+  ...
+  c='I' => d='9',
+  c='J' => d='1',
+  ...
+  c='R' => d='9',
+  c='S' => d='2',
+  ...
+  c='Z' => d='9'.
+*/
+{
 #ifdef TARGET_USE_ASCII
-        if(c<='9'){
-            return(c);
-        }else if(c<='I'){
-            return(c-'A'+'1');
-        }else if(c<='R'){
-            return(c-'J'+'1');
-        }else{
-            return(c-'S'+'2');
-        }
+    if(c<='9'){
+        return(c);
+    }else if(c<='I'){
+        return(c-'A'+'1');
+    }else if(c<='R'){
+        return(c-'J'+'1');
+    }else{
+        return(c-'S'+'2');
+    }
 #else
-            int     i;
+    int     i;

-        for(i=0;alphabet_from[i]!='\0';i++){
-            if(alphabet_from[i]==c){
-                return(alphabet_value[i]);
-            }
+    for(i=0;alphabet_from[i]!='\0';i++){
+        if(alphabet_from[i]==c){
+            return(alphabet_value[i]);
         }
-        // If pre-condition is fullfilled, then we never pass here.
-        // SEE: we should raise an exception here.
-        return('0');
+    }
+    // If pre-condition is fullfilled, then we never pass here.
+    // SEE: we should raise an exception here.
+    return('0');
 #endif
-    }//ribValue;
+}//ribValue;


-    PROCEDURE(getAndCheckAlphaNum,(int cnt,char* a,const char* s),BOOLEAN)
-    {
-            int     i,j;
+PROCEDURE(getAndCheckAlphaNum,(int cnt,char* a,const char* s),BOOLEAN)
+{
+    int     i,j;

-        i=0;
-        j=0;
-        while((i<cnt)&&(s[j]!='\0')){
-            if(s[j]!=' '){
-                if(inRibAlphabet(s[j])){
-                    a[i++]=convertToRibCase(s[j]);
-                }else{
-                    a[i]='\0';
-                    return(FALSE);
-                }
-            }
-            j++;
-        }
-        a[i]='\0';
-        return((i==cnt)&&(s[j]=='\0'));
-    }//getAndCheckAlphaNum;
+    i=0;
+    j=0;
+    while((i<cnt)&&(s[j]!='\0')){
+        if(s[j]!=' '){
+            if(inRibAlphabet(s[j])){
+                a[i++]=convertToRibCase(s[j]);
+            }else{
+                a[i]='\0';
+                return(FALSE);
+            }
+        }
+        j++;
+    }
+    a[i]='\0';
+    return((i==cnt)&&(s[j]=='\0'));
+}//getAndCheckAlphaNum;


-    PROCEDURE(computeCle,(const char* nBanque,const char* nGuichet,
-                            const char* nCompte),const char*)
-    {
-            static BOOLEAN  number_inited=FALSE;
-            static bc_num   quatrevingtdixsept;
+PROCEDURE(computeCle,(const char* nBanque,const char* nGuichet,
+                      const char* nCompte),const char*)
+{
+    static BOOLEAN  number_inited=FALSE;
+    static bc_num   quatrevingtdixsept;

-            int             i;
-            char            rib[23+1];
-            static char     rescle[BUFSIZ];
-            bc_num          ribnum;
-            bc_num          remainder;
-            int             r;
+    int             i;
+    char            rib[23+1];
+    static char     rescle[BUFSIZ];
+    bc_num          ribnum;
+    bc_num          remainder;
+    long int        r;

-        if(!number_inited){
-            init_numbers();
-            quatrevingtdixsept=new_num(2,0);
-            int2num(&quatrevingtdixsept,97);
-            number_inited=TRUE;
-        }
+    if(!number_inited){
+        init_numbers();
+        quatrevingtdixsept=new_num(2,0);
+        int2num(&quatrevingtdixsept,97);
+        number_inited=TRUE;
+    }

-        sprintf(rib,"%5s%5s%11s00",nBanque,nGuichet,nCompte);
-        for(i=0;rib[i]!='\0';i++){
-            rib[i]=ribValue(rib[i]);
-        }
+    sprintf(rib,"%5s%5s%11s00",nBanque,nGuichet,nCompte);
+    for(i=0;rib[i]!='\0';i++){
+        rib[i]=ribValue(rib[i]);
+    }

-        ribnum=new_num(23,0);
-        str2num(&ribnum,rib,0);
-        remainder=new_num(2,0);
-        bc_modulo(ribnum,quatrevingtdixsept,&remainder,0);
-        r=num2long(remainder);
-        sprintf(rescle,"%02d",(r==0)?r:97-r);
-        return(rescle);
-    }//computeCle;
+    ribnum=new_num(23,0);
+    str2num(&ribnum,rib,0);
+    remainder=new_num(2,0);
+    bc_modulo(ribnum,quatrevingtdixsept,&remainder,0);
+    r=num2long(remainder);
+    sprintf(rescle,"%02ld",(r==0)?r:97-r);
+    return(rescle);
+}//computeCle;


-    CONSTRUCTOR(BpRIB)
-    {
-        strcpy(fBanque,"00000");
-        strcpy(fGuichet,"00000");
-        strcpy(fCompte,"00000000000");
-        strcpy(fCle,computeCle(fBanque,fGuichet,fCompte));
-        cleChanged=FALSE;
-    }//BpRIB;
+CONSTRUCTOR(BpRIB)
+{
+    strcpy(fBanque,"00000");
+    strcpy(fGuichet,"00000");
+    strcpy(fCompte,"00000000000");
+    strcpy(fCle,computeCle(fBanque,fGuichet,fCompte));
+    cleChanged=FALSE;
+}//BpRIB;


-    DESTRUCTOR(BpRIB)
-    {
-        // NOP
-    }//~RIB;
+DESTRUCTOR(BpRIB)
+{
+    // NOP
+}//~RIB;


-    METHOD(BpRIB,banque,(void),const char*)
-    {
-        return(fBanque);
-    }//banque;
+METHOD(BpRIB,banque,(void),const char*)
+{
+    return(fBanque);
+}//banque;


-    METHOD(BpRIB,guichet,(void),const char*)
-    {
-        return(fGuichet);
-    }//guichet;
+METHOD(BpRIB,guichet,(void),const char*)
+{
+    return(fGuichet);
+}//guichet;


-    METHOD(BpRIB,compte,(void),const char*)
-    {
-        return(fCompte);
-    }//compte;
+METHOD(BpRIB,compte,(void),const char*)
+{
+    return(fCompte);
+}//compte;


-    METHOD(BpRIB,cle,(void),const char*)
-    {
-        if(cleChanged){
-            strcpy(fCle,computeCle(fBanque,fGuichet,fCompte));
-            cleChanged=FALSE;
-        }
-        return(fCle);
-    }//cle;
+METHOD(BpRIB,cle,(void),const char*)
+{
+    if(cleChanged){
+        strcpy(fCle,computeCle(fBanque,fGuichet,fCompte));
+        cleChanged=FALSE;
+    }
+    return(fCle);
+}//cle;


-    METHOD(BpRIB,getRIB,(BOOLEAN withSpaces,char* oRib),void)
-    {
-        if(withSpaces){
-            sprintf(oRib,"%5s %5s %11s %2s",fBanque,fGuichet,fCompte,cle());
-        }else{
-            sprintf(oRib,"%5s%5s%11s%2s",fBanque,fGuichet,fCompte,cle());
-        }
-    }//getRIB;
+METHOD(BpRIB,getRIB,(BOOLEAN withSpaces,char* oRib),void)
+{
+    if(withSpaces){
+        sprintf(oRib,"%5s %5s %11s %2s",fBanque,fGuichet,fCompte,cle());
+    }else{
+        sprintf(oRib,"%5s%5s%11s%2s",fBanque,fGuichet,fCompte,cle());
+    }
+}//getRIB;


-    METHOD(BpRIB,setBanque,(const char* nBanque),BOOLEAN)
-    {
-            char    temp[5+1];
+METHOD(BpRIB,setBanque,(const char* nBanque),BOOLEAN)
+{
+    char    temp[5+1];

-        if(getAndCheckAlphaNum(5,temp,nBanque)){
-            strcpy(fBanque,temp);
-            cleChanged=TRUE;
-            return(TRUE);
-        }else{
-            return(FALSE);
-        }
-    }//setBanque;
+    if(getAndCheckAlphaNum(5,temp,nBanque)){
+        strcpy(fBanque,temp);
+        cleChanged=TRUE;
+        return(TRUE);
+    }else{
+        return(FALSE);
+    }
+}//setBanque;


-    METHOD(BpRIB,setGuichet,(const char* nGuichet),BOOLEAN)
-    {
-            char    temp[5+1];
+METHOD(BpRIB,setGuichet,(const char* nGuichet),BOOLEAN)
+{
+    char    temp[5+1];

-        if(getAndCheckAlphaNum(5,temp,nGuichet)){
-            strcpy(fGuichet,temp);
-            cleChanged=TRUE;
-            return(TRUE);
-        }else{
-            return(FALSE);
-        }
-    }//setGuichet;
+    if(getAndCheckAlphaNum(5,temp,nGuichet)){
+        strcpy(fGuichet,temp);
+        cleChanged=TRUE;
+        return(TRUE);
+    }else{
+        return(FALSE);
+    }
+}//setGuichet;


-    METHOD(BpRIB,setCompte,(const char* nCompte),BOOLEAN)
-    {
-            char    temp[11+1];
+METHOD(BpRIB,setCompte,(const char* nCompte),BOOLEAN)
+{
+    char    temp[11+1];

-        if(getAndCheckAlphaNum(11,temp,nCompte)){
-            strcpy(fCompte,temp);
-            cleChanged=TRUE;
-            return(TRUE);
-        }else{
-            return(FALSE);
-        }
-    }//setCompte;
+    if(getAndCheckAlphaNum(11,temp,nCompte)){
+        strcpy(fCompte,temp);
+        cleChanged=TRUE;
+        return(TRUE);
+    }else{
+        return(FALSE);
+    }
+}//setCompte;


-    METHOD(BpRIB,setRIB,(const char* nRIB,BOOLEAN withCle),BOOLEAN)
-    {
-            char    temp[23+1];
-            char    tBanque[5+1];
-            char    tGuichet[5+1];
-            char    tCompte[11+1];
-            char    tCle[2+1];
-            int     len;
+METHOD(BpRIB,setRIB,(const char* nRIB,BOOLEAN withCle),BOOLEAN)
+{
+    char    temp[23+1];
+    char    tBanque[5+1];
+    char    tGuichet[5+1];
+    char    tCompte[11+1];
+    char    tCle[2+1];
+    int     len;

-        len=withCle?23:21;
-        if(getAndCheckAlphaNum(len,temp,nRIB)){
-            strncpy(tBanque,temp,5);        tBanque[5]='\0';
-            strncpy(tGuichet,temp+5,5);     tGuichet[5]='\0';
-            strncpy(tCompte,temp+10,11);    tCompte[11]='\0';
-            if(withCle){
-                strncpy(tCle,temp+21,2);        tCle[2]='\0';
-                if(strcmp(tCle,computeCle(tBanque,tGuichet,tCompte))!=0){
-                    return(FALSE);
-                }
-            }else{
-                strcpy(tCle,computeCle(tBanque,tGuichet,tCompte));
+    len=withCle?23:21;
+    if(getAndCheckAlphaNum(len,temp,nRIB)){
+        strncpy(tBanque,temp,5);        tBanque[5]='\0';
+        strncpy(tGuichet,temp+5,5);     tGuichet[5]='\0';
+        strncpy(tCompte,temp+10,11);    tCompte[11]='\0';
+        if(withCle){
+            strncpy(tCle,temp+21,2);        tCle[2]='\0';
+            if(strcmp(tCle,computeCle(tBanque,tGuichet,tCompte))!=0){
+                return(FALSE);
             }
-            strcpy(fBanque,tBanque);
-            strcpy(fGuichet,tGuichet);
-            strcpy(fCompte,tCompte);
-            strcpy(fCle,tCle);
-            cleChanged=FALSE;
-            return(TRUE);
         }else{
-            return(FALSE);
+            strcpy(tCle,computeCle(tBanque,tGuichet,tCompte));
         }
-    }//setRIB;
+        strcpy(fBanque,tBanque);
+        strcpy(fGuichet,tGuichet);
+        strcpy(fCompte,tCompte);
+        strcpy(fCle,tCle);
+        cleChanged=FALSE;
+        return(TRUE);
+    }else{
+        return(FALSE);
+    }
+}//setRIB;


 /*
-    The following functions should not be called by number module for
-    a simple bc_modulo.
+  The following functions should not be called by number module for
+  a simple bc_modulo.
 */
 extern "C"{

diff --git a/bprib/sources/number.c b/bprib/sources/number.c
index f730049..0ced611 100644
--- a/bprib/sources/number.c
+++ b/bprib/sources/number.c
@@ -18,17 +18,20 @@
     the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

     You may contact the author by:
-       e-mail:  phil@cs.wwu.edu
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
+    e-mail:  phil@cs.wwu.edu
+    us-mail:  Philip A. Nelson
+    Computer Science Department, 9062
+    Western Washington University
+    Bellingham, WA 98226-9062

 *************************************************************************/

 #include "number.h"
 #include "bcdefs.h"

+#define malloc(x) (malloc((size_t)(x)))
+#define sizeof(x) ((int)(sizeof(x)))
+
 /* Storage used for special numbers. */
 bc_num _zero_;
 bc_num _one_;
@@ -40,32 +43,32 @@ bc_num _two_;

 void
 free_num (num)
-    bc_num *num;
+     bc_num *num;
 {
-  if (*num == NULL) return;
-  (*num)->n_refs--;
-  if ((*num)->n_refs == 0) free(*num);
-  *num = NULL;
+    if (*num == NULL) return;
+    (*num)->n_refs--;
+    if ((*num)->n_refs == 0) free(*num);
+    *num = NULL;
 }


 /* new_num allocates a number and sets fields to known values. */
-    void out_of_memory(void);
+void out_of_memory(void);

 bc_num
 new_num (length, scale)
      int length, scale;
 {
-  bc_num temp;
-
-  temp = (bc_num) malloc (sizeof(bc_struct)+length+scale);
-  if (temp == NULL) out_of_memory ();
-  temp->n_sign = PLUS;
-  temp->n_len = length;
-  temp->n_scale = scale;
-  temp->n_refs = 1;
-  temp->n_value[0] = 0;
-  return temp;
+    bc_num temp;
+
+    temp = (bc_num) malloc (sizeof(bc_struct)+length+scale);
+    if (temp == NULL) out_of_memory ();
+    temp->n_sign = PLUS;
+    temp->n_len = length;
+    temp->n_scale = scale;
+    temp->n_refs = 1;
+    temp->n_value[0] = 0;
+    return temp;
 }


@@ -74,11 +77,11 @@ new_num (length, scale)
 void
 init_numbers ()
 {
-  _zero_ = new_num (1,0);
-  _one_  = new_num (1,0);
-  _one_->n_value[0] = 1;
-  _two_  = new_num (1,0);
-  _two_->n_value[0] = 2;
+    _zero_ = new_num (1,0);
+    _one_  = new_num (1,0);
+    _one_->n_value[0] = 1;
+    _two_  = new_num (1,0);
+    _two_->n_value[0] = 2;
 }


@@ -88,8 +91,8 @@ bc_num
 copy_num (num)
      bc_num num;
 {
-  num->n_refs++;
-  return num;
+    num->n_refs++;
+    return num;
 }


@@ -99,7 +102,7 @@ void
 init_num (num)
      bc_num *num;
 {
-  *num = copy_num (_zero_);
+    *num = copy_num (_zero_);
 }


@@ -110,40 +113,40 @@ int2num (num, val)
      bc_num *num;
      int val;
 {
-  char buffer[30];
-  char *bptr, *vptr;
-  int  ix = 1;
-  char neg = 0;
+    char buffer[30];
+    char *bptr, *vptr;
+    int  ix = 1;
+    char neg = 0;

-  /* Sign. */
-  if (val < 0)
-    {
-      neg = 1;
-      val = -val;
-    }
+    /* Sign. */
+    if (val < 0)
+        {
+            neg = 1;
+            val = -val;
+        }

-  /* Get things going. */
-  bptr = buffer;
-  *bptr++ = val % 10;
-  val = val / 10;
+    /* Get things going. */
+    bptr = buffer;
+    *bptr++ = (char)(val % 10);
+    val = val / 10;

-  /* Extract remaining digits. */
-  while (val != 0)
-    {
-      *bptr++ = val % 10;
-      val = val / 10;
-      ix++;         /* Count the digits. */
-    }
+    /* Extract remaining digits. */
+    while (val != 0)
+        {
+            *bptr++ = (char)(val % 10);
+            val = val / 10;
+            ix++;         /* Count the digits. */
+        }

-  /* Make the number. */
-  free_num (num);
-  *num = new_num (ix, 0);
-  if (neg) (*num)->n_sign = MINUS;
+    /* Make the number. */
+    free_num (num);
+    *num = new_num (ix, 0);
+    if (neg) (*num)->n_sign = MINUS;

-  /* Assign the digits. */
-  vptr = (*num)->n_value;
-  while (ix-- > 0)
-    *vptr++ = *--bptr;
+    /* Assign the digits. */
+    vptr = (*num)->n_value;
+    while (ix-- > 0)
+        *vptr++ = *--bptr;
 }


@@ -156,36 +159,36 @@ long
 num2long (num)
      bc_num num;
 {
-  long val;
-  char *nptr;
-  int  idx;
-
-  /* Extract the int value, ignore the fraction. */
-  val = 0;
-  nptr = num->n_value;
-  for (idx=num->n_len; (idx>0) && (val<=(LONG_MAX/10)); idx--)
-    val = val*10 + *nptr++;
+    long val;
+    char *nptr;
+    int  idx;
+
+    /* Extract the int value, ignore the fraction. */
+    val = 0;
+    nptr = num->n_value;
+    for (idx=num->n_len; (idx>0) && (val<=(LONG_MAX/10)); idx--)
+        val = val*10 + *nptr++;

-  /* Check for overflow.  If overflow, return zero. */
-  if (idx>0) val = 0;
-  if (val < 0) val = 0;
+    /* Check for overflow.  If overflow, return zero. */
+    if (idx>0) val = 0;
+    if (val < 0) val = 0;

-  /* Return the value. */
-  if (num->n_sign == PLUS)
-    return (val);
-  else
-    return (-val);
+    /* Return the value. */
+    if (num->n_sign == PLUS)
+        return (val);
+    else
+        return (-val);
 }


 /* The following are some math routines for numbers. */
 _PROTOTYPE(static int _do_compare, (bc_num n1, bc_num n2, int use_sign,
-                    int ignore_last));
+                                    int ignore_last));
 _PROTOTYPE(static void _rm_leading_zeros, (bc_num num));
 _PROTOTYPE(static bc_num _do_add, (bc_num n1, bc_num n2));
 _PROTOTYPE(static bc_num _do_sub, (bc_num n1, bc_num n2));
 _PROTOTYPE(static void _one_mult, (unsigned char *num, int size, int digit,
-                   unsigned char *result));
+                                   unsigned char *result));



@@ -199,103 +202,103 @@ _do_compare (n1, n2, use_sign, ignore_last)
      int use_sign;
      int ignore_last;
 {
-  char *n1ptr, *n2ptr;
-  int  count;
+    char *n1ptr, *n2ptr;
+    int  count;

-  /* First, compare signs. */
-  if (use_sign && n1->n_sign != n2->n_sign)
-    {
-      if (n1->n_sign == PLUS)
-    return (1); /* Positive N1 > Negative N2 */
-      else
-    return (-1);    /* Negative N1 < Positive N1 */
-    }
+    /* First, compare signs. */
+    if (use_sign && n1->n_sign != n2->n_sign)
+        {
+            if (n1->n_sign == PLUS)
+                return (1); /* Positive N1 > Negative N2 */
+            else
+                return (-1);    /* Negative N1 < Positive N1 */
+        }

-  /* Now compare the magnitude. */
-  if (n1->n_len != n2->n_len)
-    {
-      if (n1->n_len > n2->n_len)
-    {
-      /* Magnitude of n1 > n2. */
-      if (!use_sign || n1->n_sign == PLUS)
-        return (1);
-      else
-        return (-1);
-    }
-      else
-    {
-      /* Magnitude of n1 < n2. */
-      if (!use_sign || n1->n_sign == PLUS)
-        return (-1);
-      else
-        return (1);
-    }
-    }
+    /* Now compare the magnitude. */
+    if (n1->n_len != n2->n_len)
+        {
+            if (n1->n_len > n2->n_len)
+                {
+                    /* Magnitude of n1 > n2. */
+                    if (!use_sign || n1->n_sign == PLUS)
+                        return (1);
+                    else
+                        return (-1);
+                }
+            else
+                {
+                    /* Magnitude of n1 < n2. */
+                    if (!use_sign || n1->n_sign == PLUS)
+                        return (-1);
+                    else
+                        return (1);
+                }
+        }

-  /* If we get here, they have the same number of integer digits.
-     check the integer part and the equal length part of the fraction. */
-  count = n1->n_len + MIN (n1->n_scale, n2->n_scale);
-  n1ptr = n1->n_value;
-  n2ptr = n2->n_value;
-
-  while ((count > 0) && (*n1ptr == *n2ptr))
-    {
-      n1ptr++;
-      n2ptr++;
-      count--;
-    }
-  if (ignore_last && count == 1 && n1->n_scale == n2->n_scale)
-    return (0);
-  if (count != 0)
-    {
-      if (*n1ptr > *n2ptr)
-    {
-      /* Magnitude of n1 > n2. */
-      if (!use_sign || n1->n_sign == PLUS)
-        return (1);
-      else
-        return (-1);
-    }
-      else
-    {
-      /* Magnitude of n1 < n2. */
-      if (!use_sign || n1->n_sign == PLUS)
-        return (-1);
-      else
-        return (1);
-    }
-    }
+    /* If we get here, they have the same number of integer digits.
+       check the integer part and the equal length part of the fraction. */
+    count = n1->n_len + MIN (n1->n_scale, n2->n_scale);
+    n1ptr = n1->n_value;
+    n2ptr = n2->n_value;

-  /* They are equal up to the last part of the equal part of the fraction. */
-  if (n1->n_scale != n2->n_scale) {
-    if (n1->n_scale > n2->n_scale)
-      {
-    for (count = n1->n_scale-n2->n_scale; count>0; count--)
-      if (*n1ptr++ != 0)
+    while ((count > 0) && (*n1ptr == *n2ptr))
         {
-          /* Magnitude of n1 > n2. */
-          if (!use_sign || n1->n_sign == PLUS)
-        return (1);
-          else
-        return (-1);
+            n1ptr++;
+            n2ptr++;
+            count--;
         }
-      }
-    else
-      {
-    for (count = n2->n_scale-n1->n_scale; count>0; count--)
-      if (*n2ptr++ != 0)
+    if (ignore_last && count == 1 && n1->n_scale == n2->n_scale)
+        return (0);
+    if (count != 0)
         {
-          /* Magnitude of n1 < n2. */
-          if (!use_sign || n1->n_sign == PLUS)
-        return (-1);
-          else
-        return (1);
+            if (*n1ptr > *n2ptr)
+                {
+                    /* Magnitude of n1 > n2. */
+                    if (!use_sign || n1->n_sign == PLUS)
+                        return (1);
+                    else
+                        return (-1);
+                }
+            else
+                {
+                    /* Magnitude of n1 < n2. */
+                    if (!use_sign || n1->n_sign == PLUS)
+                        return (-1);
+                    else
+                        return (1);
+                }
         }
-      }
-  }
+
+    /* They are equal up to the last part of the equal part of the fraction. */
+    if (n1->n_scale != n2->n_scale) {
+        if (n1->n_scale > n2->n_scale)
+            {
+                for (count = n1->n_scale-n2->n_scale; count>0; count--)
+                    if (*n1ptr++ != 0)
+                        {
+                            /* Magnitude of n1 > n2. */
+                            if (!use_sign || n1->n_sign == PLUS)
+                                return (1);
+                            else
+                                return (-1);
+                        }
+            }
+        else
+            {
+                for (count = n2->n_scale-n1->n_scale; count>0; count--)
+                    if (*n2ptr++ != 0)
+                        {
+                            /* Magnitude of n1 < n2. */
+                            if (!use_sign || n1->n_sign == PLUS)
+                                return (-1);
+                            else
+                                return (1);
+                        }
+            }
+    }

-  /* They must be equal! */
-  return (0);
+    /* They must be equal! */
+    return (0);
 }


@@ -305,7 +308,7 @@ int
 bc_compare (n1, n2)
      bc_num n1, n2;
 {
-  return _do_compare (n1, n2, TRUE, FALSE);
+    return _do_compare (n1, n2, TRUE, FALSE);
 }


@@ -315,23 +318,23 @@ char
 is_zero (num)
      bc_num num;
 {
-  int  count;
-  char *nptr;
+    int  count;
+    char *nptr;

-  /* Quick check. */
-  if (num == _zero_) return TRUE;
+    /* Quick check. */
+    if (num == _zero_) return TRUE;

-  /* Initialize */
-  count = num->n_len + num->n_scale;
-  nptr = num->n_value;
+    /* Initialize */
+    count = num->n_len + num->n_scale;
+    nptr = num->n_value;

-  /* The check */
-  while ((count > 0) && (*nptr++ == 0)) count--;
+    /* The check */
+    while ((count > 0) && (*nptr++ == 0)) count--;

-  if (count != 0)
-    return FALSE;
-  else
-    return TRUE;
+    if (count != 0)
+        return FALSE;
+    else
+        return TRUE;
 }


@@ -341,7 +344,7 @@ char
 is_neg (num)
      bc_num num;
 {
-  return num->n_sign == MINUS;
+    return num->n_sign == MINUS;
 }


@@ -353,21 +356,21 @@ static void
 _rm_leading_zeros (num)
      bc_num num;
 {
-  int bytes;
-  char *dst, *src;
-
-  /* Do a quick check to see if we need to do it. */
-  if (*num->n_value != 0) return;
-
-  /* The first digit is 0, find the first non-zero digit in the 10's or
-     greater place. */
-  bytes = num->n_len;
-  src = num->n_value;
-  while (bytes > 1 && *src == 0) src++, bytes--;
-  num->n_len = bytes;
-  bytes += num->n_scale;
-  dst = num->n_value;
-  while (bytes-- > 0) *dst++ = *src++;
+    int bytes;
+    char *dst, *src;
+
+    /* Do a quick check to see if we need to do it. */
+    if (*num->n_value != 0) return;
+
+    /* The first digit is 0, find the first non-zero digit in the 10's or
+       greater place. */
+    bytes = num->n_len;
+    src = num->n_value;
+    while (bytes > 1 && *src == 0) src++, bytes--;
+    num->n_len = bytes;
+    bytes += num->n_scale;
+    dst = num->n_value;
+    while (bytes-- > 0) *dst++ = *src++;

 }

@@ -379,76 +382,76 @@ static bc_num
 _do_add (n1, n2)
      bc_num n1, n2;
 {
-  bc_num sum;
-  int sum_scale, sum_digits;
-  char *n1ptr, *n2ptr, *sumptr;
-  int carry, n1bytes, n2bytes;
-
-  /* Prepare sum. */
-  sum_scale = MAX (n1->n_scale, n2->n_scale);
-  sum_digits = MAX (n1->n_len, n2->n_len) + 1;
-  sum = new_num (sum_digits,sum_scale);
-
-  /* Start with the fraction part.  Initialize the pointers. */
-  n1bytes = n1->n_scale;
-  n2bytes = n2->n_scale;
-  n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1);
-  n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1);
-  sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1);
-
-  /* Add the fraction part.  First copy the longer fraction.*/
-  if (n1bytes != n2bytes)
-    {
-      if (n1bytes > n2bytes)
-    while (n1bytes>n2bytes)
-      { *sumptr-- = *n1ptr--; n1bytes--;}
-      else
-    while (n2bytes>n1bytes)
-      { *sumptr-- = *n2ptr--; n2bytes--;}
-    }
+    bc_num sum;
+    int sum_scale, sum_digits;
+    char *n1ptr, *n2ptr, *sumptr;
+    int carry, n1bytes, n2bytes;
+
+    /* Prepare sum. */
+    sum_scale = MAX (n1->n_scale, n2->n_scale);
+    sum_digits = MAX (n1->n_len, n2->n_len) + 1;
+    sum = new_num (sum_digits,sum_scale);
+
+    /* Start with the fraction part.  Initialize the pointers. */
+    n1bytes = n1->n_scale;
+    n2bytes = n2->n_scale;
+    n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1);
+    n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1);
+    sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1);
+
+    /* Add the fraction part.  First copy the longer fraction.*/
+    if (n1bytes != n2bytes)
+        {
+            if (n1bytes > n2bytes)
+                while (n1bytes>n2bytes)
+                    { *sumptr-- = *n1ptr--; n1bytes--;}
+            else
+                while (n2bytes>n1bytes)
+                    { *sumptr-- = *n2ptr--; n2bytes--;}
+        }

-  /* Now add the remaining fraction part and equal size integer parts. */
-  n1bytes += n1->n_len;
-  n2bytes += n2->n_len;
-  carry = 0;
-  while ((n1bytes > 0) && (n2bytes > 0))
-    {
-      *sumptr = *n1ptr-- + *n2ptr-- + carry;
-      if (*sumptr > 9)
-    {
-       carry = 1;
-       *sumptr -= 10;
-    }
-      else
+    /* Now add the remaining fraction part and equal size integer parts. */
+    n1bytes += n1->n_len;
+    n2bytes += n2->n_len;
     carry = 0;
-      sumptr--;
-      n1bytes--;
-      n2bytes--;
-    }
+    while ((n1bytes > 0) && (n2bytes > 0))
+        {
+            *sumptr = (char)(*n1ptr-- + *n2ptr-- + carry);
+            if (*sumptr > 9)
+                {
+                    carry = 1;
+                    *sumptr = (char)((*sumptr)-10);
+                }
+            else
+                carry = 0;
+            sumptr--;
+            n1bytes--;
+            n2bytes--;
+        }

-  /* Now add carry the longer integer part. */
-  if (n1bytes == 0)
-    { n1bytes = n2bytes; n1ptr = n2ptr; }
-  while (n1bytes-- > 0)
-    {
-      *sumptr = *n1ptr-- + carry;
-      if (*sumptr > 9)
-    {
-       carry = 1;
-       *sumptr -= 10;
-     }
-      else
-    carry = 0;
-      sumptr--;
-    }
+    /* Now add carry the longer integer part. */
+    if (n1bytes == 0)
+        { n1bytes = n2bytes; n1ptr = n2ptr; }
+    while (n1bytes-- > 0)
+        {
+            *sumptr = (char)(*n1ptr-- + carry);
+            if (*sumptr > 9)
+                {
+                    carry = 1;
+                    *sumptr = (char)((*sumptr)-10);
+                }
+            else
+                carry = 0;
+            sumptr--;
+        }

-  /* Set final carry. */
-  if (carry == 1)
-    *sumptr += 1;
+    /* Set final carry. */
+    if (carry == 1)
+        *sumptr = (char)((*sumptr)+1);

-  /* Adjust sum and return. */
-  _rm_leading_zeros (sum);
-  return sum;
+    /* Adjust sum and return. */
+    _rm_leading_zeros (sum);
+    return sum;
 }


@@ -460,86 +463,86 @@ static bc_num
 _do_sub (n1, n2)
      bc_num n1, n2;
 {
-  bc_num diff;
-  int diff_scale, diff_len;
-  int min_scale, min_len;
-  char *n1ptr, *n2ptr, *diffptr;
-  int borrow, count, val;
-
-  /* Allocate temporary storage. */
-  diff_len = MAX (n1->n_len, n2->n_len);
-  diff_scale = MAX (n1->n_scale, n2->n_scale);
-  min_len = MIN  (n1->n_len, n2->n_len);
-  min_scale = MIN (n1->n_scale, n2->n_scale);
-  diff = new_num (diff_len, diff_scale);
-
-  /* Initialize the subtract. */
-  n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1);
-  n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1);
-  diffptr = (char *) (diff->n_value + diff_len + diff_scale -1);
-
-  /* Subtract the numbers. */
-  borrow = 0;
+    bc_num diff;
+    int diff_scale, diff_len;
+    int min_scale, min_len;
+    char *n1ptr, *n2ptr, *diffptr;
+    int borrow, count, val;
+
+    /* Allocate temporary storage. */
+    diff_len = MAX (n1->n_len, n2->n_len);
+    diff_scale = MAX (n1->n_scale, n2->n_scale);
+    min_len = MIN  (n1->n_len, n2->n_len);
+    min_scale = MIN (n1->n_scale, n2->n_scale);
+    diff = new_num (diff_len, diff_scale);
+
+    /* Initialize the subtract. */
+    n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1);
+    n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1);
+    diffptr = (char *) (diff->n_value + diff_len + diff_scale -1);
+
+    /* Subtract the numbers. */
+    borrow = 0;

-  /* Take care of the longer scaled number. */
-  if (n1->n_scale != min_scale)
-    {
-      /* n1 has the longer scale */
-      for (count = n1->n_scale - min_scale; count > 0; count--)
-    *diffptr-- = *n1ptr--;
-    }
-  else
-    {
-      /* n2 has the longer scale */
-      for (count = n2->n_scale - min_scale; count > 0; count--)
-    {
-      val = - *n2ptr-- - borrow;
-      if (val < 0)
+    /* Take care of the longer scaled number. */
+    if (n1->n_scale != min_scale)
         {
-          val += 10;
-          borrow = 1;
+            /* n1 has the longer scale */
+            for (count = n1->n_scale - min_scale; count > 0; count--)
+                *diffptr-- = *n1ptr--;
+        }
+    else
+        {
+            /* n2 has the longer scale */
+            for (count = n2->n_scale - min_scale; count > 0; count--)
+                {
+                    val = - *n2ptr-- - borrow;
+                    if (val < 0)
+                        {
+                            val += 10;
+                            borrow = 1;
+                        }
+                    else
+                        borrow = 0;
+                    *diffptr-- = (char)val;
+                }
         }
-      else
-        borrow = 0;
-      *diffptr-- = val;
-    }
-    }

-  /* Now do the equal length scale and integer parts. */
+    /* Now do the equal length scale and integer parts. */

-  for (count = 0; count < min_len + min_scale; count++)
-    {
-      val = *n1ptr-- - *n2ptr-- - borrow;
-      if (val < 0)
-    {
-      val += 10;
-      borrow = 1;
-    }
-      else
-    borrow = 0;
-      *diffptr-- = val;
-    }
+    for (count = 0; count < min_len + min_scale; count++)
+        {
+            val = *n1ptr-- - *n2ptr-- - borrow;
+            if (val < 0)
+                {
+                    val += 10;
+                    borrow = 1;
+                }
+            else
+                borrow = 0;
+            *diffptr-- = (char)val;
+        }

-  /* If n1 has more digits then n2, we now do that subtract. */
-  if (diff_len != min_len)
-    {
-      for (count = diff_len - min_len; count > 0; count--)
-    {
-      val = *n1ptr-- - borrow;
-      if (val < 0)
+    /* If n1 has more digits then n2, we now do that subtract. */
+    if (diff_len != min_len)
         {
-          val += 10;
-          borrow = 1;
+            for (count = diff_len - min_len; count > 0; count--)
+                {
+                    val = *n1ptr-- - borrow;
+                    if (val < 0)
+                        {
+                            val += 10;
+                            borrow = 1;
+                        }
+                    else
+                        borrow = 0;
+                    *diffptr-- = (char)val;
+                }
         }
-      else
-        borrow = 0;
-      *diffptr-- = val;
-    }
-    }

-  /* Clean up and return. */
-  _rm_leading_zeros (diff);
-  return diff;
+    /* Clean up and return. */
+    _rm_leading_zeros (diff);
+    return diff;
 }


@@ -550,39 +553,39 @@ void
 bc_add ( n1, n2, result)
      bc_num n1, n2, *result;
 {
-  bc_num sum=0;
-  int cmp_res;
+    bc_num sum=0;
+    int cmp_res;

-  if (n1->n_sign == n2->n_sign)
-    {
-      sum = _do_add (n1, n2);
-      sum->n_sign = n1->n_sign;
-    }
-  else
-    {
-      /* subtraction must be done. */
-      cmp_res = _do_compare (n1, n2, FALSE, FALSE);  /* Compare magnitudes. */
-      switch (cmp_res)
-    {
-    case -1:
-      /* n1 is less than n2, subtract n1 from n2. */
-      sum = _do_sub (n2, n1);
-      sum->n_sign = n2->n_sign;
-      break;
-    case  0:
-      /* They are equal! return zero! */
-      sum = copy_num (_zero_);
-      break;
-    case  1:
-      /* n2 is less than n1, subtract n2 from n1. */
-      sum = _do_sub (n1, n2);
-      sum->n_sign = n1->n_sign;
-    }
-    }
+    if (n1->n_sign == n2->n_sign)
+        {
+            sum = _do_add (n1, n2);
+            sum->n_sign = n1->n_sign;
+        }
+    else
+        {
+            /* subtraction must be done. */
+            cmp_res = _do_compare (n1, n2, FALSE, FALSE);  /* Compare magnitudes. */
+            switch (cmp_res)
+                {
+                case -1:
+                    /* n1 is less than n2, subtract n1 from n2. */
+                    sum = _do_sub (n2, n1);
+                    sum->n_sign = n2->n_sign;
+                    break;
+                case  0:
+                    /* They are equal! return zero! */
+                    sum = copy_num (_zero_);
+                    break;
+                case  1:
+                    /* n2 is less than n1, subtract n2 from n1. */
+                    sum = _do_sub (n1, n2);
+                    sum->n_sign = n1->n_sign;
+                }
+        }

-  /* Clean up and return. */
-  free_num (result);
-  *result = sum;
+    /* Clean up and return. */
+    free_num (result);
+    *result = sum;
 }


@@ -593,102 +596,102 @@ void
 bc_sub ( n1, n2, result)
      bc_num n1, n2, *result;
 {
-  bc_num diff=0;
-  int cmp_res;
+    bc_num diff=0;
+    int cmp_res;

-  if (n1->n_sign != n2->n_sign)
-    {
-      diff = _do_add (n1, n2);
-      diff->n_sign = n1->n_sign;
-    }
-  else
-    {
-      /* subtraction must be done. */
-      cmp_res = _do_compare (n1, n2, FALSE, FALSE);  /* Compare magnitudes. */
-      switch (cmp_res)
-    {
-    case -1:
-      /* n1 is less than n2, subtract n1 from n2. */
-      diff = _do_sub (n2, n1);
-      diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS);
-      break;
-    case  0:
-      /* They are equal! return zero! */
-      diff = copy_num (_zero_);
-      break;
-    case  1:
-      /* n2 is less than n1, subtract n2 from n1. */
-      diff = _do_sub (n1, n2);
-      diff->n_sign = n1->n_sign;
-      break;
-    }
-    }
+    if (n1->n_sign != n2->n_sign)
+        {
+            diff = _do_add (n1, n2);
+            diff->n_sign = n1->n_sign;
+        }
+    else
+        {
+            /* subtraction must be done. */
+            cmp_res = _do_compare (n1, n2, FALSE, FALSE);  /* Compare magnitudes. */
+            switch (cmp_res)
+                {
+                case -1:
+                    /* n1 is less than n2, subtract n1 from n2. */
+                    diff = _do_sub (n2, n1);
+                    diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS);
+                    break;
+                case  0:
+                    /* They are equal! return zero! */
+                    diff = copy_num (_zero_);
+                    break;
+                case  1:
+                    /* n2 is less than n1, subtract n2 from n1. */
+                    diff = _do_sub (n1, n2);
+                    diff->n_sign = n1->n_sign;
+                    break;
+                }
+        }

-  /* Clean up and return. */
-  free_num (result);
-  *result = diff;
+    /* Clean up and return. */
+    free_num (result);
+    *result = diff;
 }


 /* The multiply routine.  N2 time N1 is put int PROD with the scale of
    the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)).
-   */
+*/

 void
 bc_multiply (n1, n2, prod, scale)
      bc_num n1, n2, *prod;
      int scale;
 {
-  bc_num pval;          /* For the working storage. */
-  char *n1ptr, *n2ptr, *pvptr;  /* Work pointers. */
-  char *n1end, *n2end;      /* To the end of n1 and n2. */
-
-  int indx;
-  int len1, len2, total_digits;
-  long sum;
-  int full_scale, prod_scale;
-  int toss;
-
-  /* Initialize things. */
-  len1 = n1->n_len + n1->n_scale;
-  len2 = n2->n_len + n2->n_scale;
-  total_digits = len1 + len2;
-  full_scale = n1->n_scale + n2->n_scale;
-  prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale)));
-  toss = full_scale - prod_scale;
-  pval =  new_num (total_digits-full_scale, prod_scale);
-  pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
-  n1end = (char *) (n1->n_value + len1 - 1);
-  n2end = (char *) (n2->n_value + len2 - 1);
-  pvptr = (char *) (pval->n_value + total_digits - toss - 1);
-  sum = 0;
-
-  /* Here are the loops... */
-  for (indx = 0; indx < toss; indx++)
-    {
-      n1ptr = (char *) (n1end - MAX(0, indx-len2+1));
-      n2ptr = (char *) (n2end - MIN(indx, len2-1));
-      while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
-    sum += *n1ptr-- * *n2ptr++;
-      sum = sum / 10;
-    }
-  for ( ; indx < total_digits-1; indx++)
-    {
-      n1ptr = (char *) (n1end - MAX(0, indx-len2+1));
-      n2ptr = (char *) (n2end - MIN(indx, len2-1));
-      while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
-    sum += *n1ptr-- * *n2ptr++;
-      *pvptr-- = sum % 10;
-      sum = sum / 10;
-    }
-  *pvptr-- = sum;
-
-  /* Assign to prod and clean up the number. */
-  free_num (prod);
-  *prod = pval;
-  _rm_leading_zeros (*prod);
-  if (is_zero (*prod))
-    (*prod)->n_sign = PLUS;
+    bc_num pval;          /* For the working storage. */
+    char *n1ptr, *n2ptr, *pvptr;  /* Work pointers. */
+    char *n1end, *n2end;      /* To the end of n1 and n2. */
+
+    int indx;
+    int len1, len2, total_digits;
+    long sum;
+    int full_scale, prod_scale;
+    int toss;
+
+    /* Initialize things. */
+    len1 = n1->n_len + n1->n_scale;
+    len2 = n2->n_len + n2->n_scale;
+    total_digits = len1 + len2;
+    full_scale = n1->n_scale + n2->n_scale;
+    prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale)));
+    toss = full_scale - prod_scale;
+    pval =  new_num (total_digits-full_scale, prod_scale);
+    pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
+    n1end = (char *) (n1->n_value + len1 - 1);
+    n2end = (char *) (n2->n_value + len2 - 1);
+    pvptr = (char *) (pval->n_value + total_digits - toss - 1);
+    sum = 0;
+
+    /* Here are the loops... */
+    for (indx = 0; indx < toss; indx++)
+        {
+            n1ptr = (char *) (n1end - MAX(0, indx-len2+1));
+            n2ptr = (char *) (n2end - MIN(indx, len2-1));
+            while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
+                sum += *n1ptr-- * *n2ptr++;
+            sum = sum / 10;
+        }
+    for ( ; indx < total_digits-1; indx++)
+        {
+            n1ptr = (char *) (n1end - MAX(0, indx-len2+1));
+            n2ptr = (char *) (n2end - MIN(indx, len2-1));
+            while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
+                sum += *n1ptr-- * *n2ptr++;
+            *pvptr-- = (char)(sum % 10);
+            sum = sum / 10;
+        }
+    *pvptr-- = (char)sum;
+
+    /* Assign to prod and clean up the number. */
+    free_num (prod);
+    *prod = pval;
+    _rm_leading_zeros (*prod);
+    if (is_zero (*prod))
+        (*prod)->n_sign = PLUS;
 }


@@ -703,32 +706,32 @@ _one_mult (num, size, digit, result)
      int size, digit;
      unsigned char *result;
 {
-  int carry, value;
-  unsigned char *nptr, *rptr;
-
-  if (digit == 0)
-    memset (result, 0, (unsigned)size);
-  else
-    {
-      if (digit == 1)
-    memcpy (result, num,(unsigned) size);
-      else
-    {
-      /* Initialize */
-      nptr = (unsigned char *) (num+size-1);
-      rptr = (unsigned char *) (result+size-1);
-      carry = 0;
-
-      while (size-- > 0)
+    int carry, value;
+    unsigned char *nptr, *rptr;
+
+    if (digit == 0)
+        memset (result, 0, (unsigned)size);
+    else
         {
-          value = *nptr-- * digit + carry;
-          *rptr-- = value % 10;
-          carry = value / 10;
-        }
+            if (digit == 1)
+                memcpy (result, num,(unsigned) size);
+            else
+                {
+                    /* Initialize */
+                    nptr = (unsigned char *) (num+size-1);
+                    rptr = (unsigned char *) (result+size-1);
+                    carry = 0;
+
+                    while (size-- > 0)
+                        {
+                            value = *nptr-- * digit + carry;
+                            *rptr-- = (unsigned char)(value % 10);
+                            carry = value / 10;
+                        }

-      if (carry != 0) *rptr = carry;
-    }
-    }
+                    if (carry != 0) *rptr = (unsigned char)carry;
+                }
+        }
 }


@@ -742,189 +745,189 @@ bc_divide (n1, n2, quot, scale)
      bc_num n1, n2, *quot;
      int scale;
 {
-  bc_num qval;
-  unsigned char *num1, *num2;
-  unsigned char *ptr1, *ptr2, *n2ptr, *qptr;
-  int  scale1, val;
-  unsigned int  len1, len2, scale2, qdigits, extra, count;
-  unsigned int  qdig, qguess, borrow, carry;
-  unsigned char *mval;
-  char zero;
-  unsigned int  norm;
-
-  /* Test for divide by zero. */
-  if (is_zero (n2)) return -1;
-
-  /* Test for divide by 1.  If it is we must truncate. */
-  if (n2->n_scale == 0)
-    {
-      if (n2->n_len == 1 && *n2->n_value == 1)
-    {
-      qval = new_num (n1->n_len, scale);
-      qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS);
-      memset (&qval->n_value[n1->n_len],0,(unsigned)scale);
-      memcpy (qval->n_value, n1->n_value,
-          (unsigned)(n1->n_len + MIN(n1->n_scale,scale)));
-      free_num (quot);
-      *quot = qval;
-    }
-    }
-
-  /* Set up the divide.  Move the decimal point on n1 by n2's scale.
-     Remember, zeros on the end of num2 are wasted effort for dividing. */
-  scale2 = n2->n_scale;
-  n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1;
-  while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--;
-
-  len1 = n1->n_len + scale2;
-  scale1 = n1->n_scale - scale2;
-  if (scale1 < scale)
-    extra = scale - scale1;
-  else
-    extra = 0;
-  num1 = (unsigned char *) malloc (n1->n_len+n1->n_scale+extra+2);
-  if (num1 == NULL) out_of_memory();
-  memset (num1, 0, (unsigned)(n1->n_len+n1->n_scale+extra+2));
-  memcpy (num1+1, n1->n_value, (unsigned)(n1->n_len+n1->n_scale));
-
-  len2 = n2->n_len + scale2;
-  num2 = (unsigned char *) malloc (len2+1);
-  if (num2 == NULL) out_of_memory();
-  memcpy (num2, n2->n_value, len2);
-  *(num2+len2) = 0;
-  n2ptr = num2;
-  while (*n2ptr == 0)
-    {
-      n2ptr++;
-      len2--;
-    }
-
-  /* Calculate the number of quotient digits. */
-  if (len2 > len1+scale)
-    {
-      qdigits = scale+1;
-      zero = TRUE;
-    }
-  else
-    {
-      zero = FALSE;
-      if (len2>len1)
-    qdigits = scale+1;      /* One for the zero integer part. */
-      else
-    qdigits = len1-len2+scale+1;
-    }
-
-  /* Allocate and zero the storage for the quotient. */
-  qval = new_num ((signed)(qdigits-scale),scale);
-  memset (qval->n_value, 0, qdigits);
-
-  /* Allocate storage for the temporary storage mval. */
-  mval = (unsigned char *) malloc (len2+1);
-  if (mval == NULL) out_of_memory ();
-
-  /* Now for the full divide algorithm. */
-  if (!zero)
-    {
-      /* Normalize */
-      norm =  10 / ((int)*n2ptr + 1);
-      if (norm != 1)
-    {
-      _one_mult (num1, (signed)(len1+scale1+extra+1), (signed)norm, num1);
-      _one_mult (n2ptr, (signed)len2, (signed)norm, n2ptr);
-    }
-
-      /* Initialize divide loop. */
-      qdig = 0;
-      if (len2 > len1)
-    qptr = (unsigned char *) qval->n_value+len2-len1;
-      else
-    qptr = (unsigned char *) qval->n_value;
-
-      /* Loop */
-      while (qdig <= len1+scale-len2)
-    {
-      /* Calculate the quotient digit guess. */
-      if (*n2ptr == num1[qdig])
-        qguess = 9;
-      else
-        qguess = (num1[qdig]*10 + num1[qdig+1]) / *n2ptr;
-
-      /* Test qguess. */
-      if (n2ptr[1]*qguess >
-          (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
-           + num1[qdig+2])
+    bc_num qval;
+    unsigned char *num1, *num2;
+    unsigned char *ptr1, *ptr2, *n2ptr, *qptr;
+    int  scale1, val;
+    unsigned int  len1, len2, scale2, qdigits, extra, count;
+    unsigned int  qdig, qguess, borrow, carry;
+    unsigned char *mval;
+    char zero;
+    unsigned int  norm;
+
+    /* Test for divide by zero. */
+    if (is_zero (n2)) return -1;
+
+    /* Test for divide by 1.  If it is we must truncate. */
+    if (n2->n_scale == 0)
         {
-          qguess--;
-          /* And again. */
-          if (n2ptr[1]*qguess >
-          (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
-          + num1[qdig+2])
-        qguess--;
+            if (n2->n_len == 1 && *n2->n_value == 1)
+                {
+                    qval = new_num (n1->n_len, scale);
+                    qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS);
+                    memset (&qval->n_value[n1->n_len],0,(unsigned)scale);
+                    memcpy (qval->n_value, n1->n_value,
+                            (unsigned)(n1->n_len + MIN(n1->n_scale,scale)));
+                    free_num (quot);
+                    *quot = qval;
+                }
         }
-
-      /* Multiply and subtract. */
-      borrow = 0;
-      if (qguess != 0)
-        {
-          *mval = 0;
-          _one_mult (n2ptr,(signed)len2, (signed)qguess, mval+1);
-          ptr1 = (unsigned char *) num1+qdig+len2;
-          ptr2 = (unsigned char *) mval+len2;
-          for (count = 0; count < len2+1; count++)
+
+    /* Set up the divide.  Move the decimal point on n1 by n2's scale.
+       Remember, zeros on the end of num2 are wasted effort for dividing. */
+    scale2 =(unsigned int)(n2->n_scale);
+    n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1;
+    while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--;
+
+    len1 = (unsigned int)(n1->n_len) + scale2;
+    scale1 = n1->n_scale - (int)scale2;
+    if (scale1 < scale)
+        extra = (unsigned int)(scale - scale1);
+    else
+        extra = 0;
+    num1 = (unsigned char *) malloc ((unsigned int)(n1->n_len)+(unsigned int)(n1->n_scale)+(unsigned int)(extra)+2);
+    if (num1 == NULL) out_of_memory();
+    memset (num1, 0, (unsigned int)(n1->n_len)+(unsigned int)(n1->n_scale)+(unsigned int)(extra)+2);
+    memcpy (num1+1, n1->n_value, (unsigned int)(n1->n_len)+(unsigned int)(n1->n_scale));
+
+    len2 = (unsigned)(n2->n_len) + scale2;
+    num2 = (unsigned char *) malloc (len2+1);
+    if (num2 == NULL) out_of_memory();
+    memcpy (num2, n2->n_value, len2);
+    *(num2+len2) = 0;
+    n2ptr = num2;
+    while (*n2ptr == 0)
         {
-          val = (int) *ptr1 - (int) *ptr2-- - borrow;
-          if (val < 0)
-            {
-              val += 10;
-              borrow = 1;
-            }
-          else
-            borrow = 0;
-          *ptr1-- = val;
-        }
+            n2ptr++;
+            len2--;
         }

-      /* Test for negative result. */
-      if (borrow == 1)
-        {
-          qguess--;
-          ptr1 = (unsigned char *) num1+qdig+len2;
-          ptr2 = (unsigned char *) n2ptr+len2-1;
-          carry = 0;
-          for (count = 0; count < len2; count++)
+    /* Calculate the number of quotient digits. */
+    if (len2 > (unsigned)((int)len1+scale))
         {
-          val = (int) *ptr1 + (int) *ptr2-- + carry;
-          if (val > 9)
-            {
-              val -= 10;
-              carry = 1;
-            }
-          else
-            carry = 0;
-          *ptr1-- = val;
+            qdigits = (unsigned)(scale+1);
+            zero = TRUE;
         }
-          if (carry == 1) *ptr1 = (*ptr1 + 1) % 10;
+    else
+        {
+            zero = FALSE;
+            if (len2>len1)
+                qdigits = (unsigned)(scale+1);      /* One for the zero integer part. */
+            else
+                qdigits = (unsigned)((int)(len1-len2)+scale+1);
         }
+
+    /* Allocate and zero the storage for the quotient. */
+    qval = new_num ((int)qdigits-scale,scale);
+    memset (qval->n_value, 0, qdigits);
+
+    /* Allocate storage for the temporary storage mval. */
+    mval = (unsigned char *) malloc (len2+1);
+    if (mval == NULL) out_of_memory ();
+
+    /* Now for the full divide algorithm. */
+    if (!zero)
+        {
+            /* Normalize */
+            norm = (unsigned)( 10 / ((int)*n2ptr + 1));
+            if (norm != 1)
+                {
+                    _one_mult (num1, ((int)len1+(int)scale1+(int)extra+1), (signed)norm, num1);
+                    _one_mult (n2ptr, (signed)len2, (signed)norm, n2ptr);
+                }
+
+            /* Initialize divide loop. */
+            qdig = 0;
+            if (len2 > len1)
+                qptr = (unsigned char *) qval->n_value+len2-len1;
+            else
+                qptr = (unsigned char *) qval->n_value;
+
+            /* Loop */
+            while (qdig <= (int)(len1-len2)+scale)
+                {
+                    /* Calculate the quotient digit guess. */
+                    if (*n2ptr == num1[qdig])
+                        qguess = 9;
+                    else
+                        qguess = (unsigned)((num1[qdig]*10 + num1[qdig+1]) / *n2ptr);
+
+                    /* Test qguess. */
+                    if (n2ptr[1]*qguess >
+                        ((int)(num1[qdig])*10 + (int)(num1[qdig+1]) - (int)(*n2ptr)*(int)qguess)*10
+                        + (int)(num1[qdig+2]))
+                        {
+                            qguess--;
+                            /* And again. */
+                            if (n2ptr[1]*qguess >
+                                ((int)(num1[qdig])*10 + (int)(num1[qdig+1]) - (int)(*n2ptr)*(int)qguess)*10
+                                + num1[qdig+2])
+                                qguess--;
+                        }
+
+                    /* Multiply and subtract. */
+                    borrow = 0;
+                    if (qguess != 0)
+                        {
+                            *mval = 0;
+                            _one_mult (n2ptr,(signed)len2, (signed)qguess, mval+1);
+                            ptr1 = (unsigned char *) num1+qdig+len2;
+                            ptr2 = (unsigned char *) mval+len2;
+                            for (count = 0; count < len2+1; count++)
+                                {
+                                    val = (int) *ptr1 - (int) *ptr2-- - (int)borrow;
+                                    if (val < 0)
+                                        {
+                                            val += 10;
+                                            borrow = 1;
+                                        }
+                                    else
+                                        borrow = 0;
+                                    *ptr1-- = (unsigned char)val;
+                                }
+                        }
+
+                    /* Test for negative result. */
+                    if (borrow == 1)
+                        {
+                            qguess--;
+                            ptr1 = (unsigned char *) num1+qdig+len2;
+                            ptr2 = (unsigned char *) n2ptr+len2-1;
+                            carry = 0;
+                            for (count = 0; count < len2; count++)
+                                {
+                                    val = (int) *ptr1 + (int) *ptr2-- + (int)carry;
+                                    if (val > 9)
+                                        {
+                                            val -= 10;
+                                            carry = 1;
+                                        }
+                                    else
+                                        carry = 0;
+                                    *ptr1-- = (unsigned char)val;
+                                }
+                            if (carry == 1) *ptr1 = (unsigned char)(((int)(*ptr1) + 1) % 10);
+                        }

-      /* We now know the quotient digit. */
-      *qptr++ =  qguess;
-      qdig++;
-    }
-    }
+                    /* We now know the quotient digit. */
+                    *qptr++ =  (unsigned char)qguess;
+                    qdig++;
+                }
+        }

-  /* Clean up and return the number. */
-  qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
-  if (is_zero (qval)) qval->n_sign = PLUS;
-  _rm_leading_zeros (qval);
-  free_num (quot);
-  *quot = qval;
+    /* Clean up and return the number. */
+    qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
+    if (is_zero (qval)) qval->n_sign = PLUS;
+    _rm_leading_zeros (qval);
+    free_num (quot);
+    *quot = qval;

-  /* Clean up temporary storage. */
-  free (mval);
-  free (num1);
-  free (num2);
+    /* Clean up temporary storage. */
+    free (mval);
+    free (num1);
+    free (num2);

-  return 0; /* Everything is OK. */
+    return 0; /* Everything is OK. */
 }


@@ -936,23 +939,23 @@ bc_modulo (num1, num2, result, scale)
      bc_num num1, num2, *result;
      int scale;
 {
-  bc_num temp;
-  int rscale;
+    bc_num temp;
+    int rscale;

-  /* Check for correct numbers. */
-  if (is_zero (num2)) return -1;
+    /* Check for correct numbers. */
+    if (is_zero (num2)) return -1;

-  /* Calculate final scale. */
-  rscale = MAX (num1->n_scale, num2->n_scale+scale);
-  init_num (&temp);
+    /* Calculate final scale. */
+    rscale = MAX (num1->n_scale, num2->n_scale+scale);
+    init_num (&temp);

-  /* Calculate it. */
-  bc_divide (num1, num2, &temp, scale);
-  bc_multiply (temp, num2, &temp, rscale);
-  bc_sub (num1, temp, result);
-  free_num (&temp);
+    /* Calculate it. */
+    bc_divide (num1, num2, &temp, scale);
+    bc_multiply (temp, num2, &temp, rscale);
+    bc_sub (num1, temp, result);
+    free_num (&temp);

-  return 0; /* Everything is OK. */
+    return 0; /* Everything is OK. */
 }


@@ -960,70 +963,70 @@ bc_modulo (num1, num2, result, scale)
    Maximum exponent is LONG_MAX.  If a NUM2 is not an integer,
    only the integer part is used.  */

-    void rt_warn(const char*);
-    void rt_error(const char*);
+void rt_warn(const char*);
+void rt_error(const char*);

 void
 bc_raise (num1, num2, result, scale)
      bc_num num1, num2, *result;
      int scale;
 {
-   bc_num temp, power;
-   long exponent;
-   int rscale;
-   char neg;
-
-   /* Check the exponent for scale digits and convert to a long. */
-   if (num2->n_scale != 0)
-     rt_warn ("non-zero scale in exponent");
-   exponent = num2long (num2);
-   if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
-       rt_error ("exponent too large in raise");
-
-   /* Special case if exponent is a zero. */
-   if (exponent == 0)
-     {
-       free_num (result);
-       *result = copy_num (_one_);
-       return;
-     }
-
-   /* Other initializations. */
-   if (exponent < 0)
-     {
-       neg = TRUE;
-       exponent = -exponent;
-       rscale = scale;
-     }
-   else
-     {
-       neg = FALSE;
-       rscale = MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale));
-     }
-   temp = copy_num (_one_);
-   power = copy_num (num1);
-
-   /* Do the calculation. */
-   while (exponent != 0)
-     {
-       if ((exponent & 1) != 0)
-     bc_multiply (temp, power, &temp, rscale);
-       bc_multiply (power, power, &power, rscale);
-       exponent = exponent >> 1;
-     }
+    bc_num temp, power;
+    long exponent;
+    int rscale;
+    char neg;
+
+    /* Check the exponent for scale digits and convert to a long. */
+    if (num2->n_scale != 0)
+        rt_warn ("non-zero scale in exponent");
+    exponent = num2long (num2);
+    if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
+        rt_error ("exponent too large in raise");
+
+    /* Special case if exponent is a zero. */
+    if (exponent == 0)
+        {
+            free_num (result);
+            *result = copy_num (_one_);
+            return;
+        }
+
+    /* Other initializations. */
+    if (exponent < 0)
+        {
+            neg = TRUE;
+            exponent = -exponent;
+            rscale = scale;
+        }
+    else
+        {
+            neg = FALSE;
+            rscale = (int)MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale));
+        }
+    temp = copy_num (_one_);
+    power = copy_num (num1);
+
+    /* Do the calculation. */
+    while (exponent != 0)
+        {
+            if ((exponent & 1) != 0)
+                bc_multiply (temp, power, &temp, rscale);
+            bc_multiply (power, power, &power, rscale);
+            exponent = exponent >> 1;
+        }

-   /* Assign the value. */
-   if (neg)
-     {
-       bc_divide (_one_, temp, result, rscale);
-       free_num (&temp);
-     }
-   else
-     {
-       free_num (result);
-       *result = temp;
-     }
-   free_num (&power);
+    /* Assign the value. */
+    if (neg)
+        {
+            bc_divide (_one_, temp, result, rscale);
+            free_num (&temp);
+        }
+    else
+        {
+            free_num (result);
+            *result = temp;
+        }
+    free_num (&power);
 }


@@ -1035,75 +1038,75 @@ bc_sqrt (num, scale)
      bc_num *num;
      int scale;
 {
-  int rscale, cmp_res, done;
-  int cscale;
-  bc_num guess, guess1, point5;
-
-  /* Initial checks. */
-  cmp_res = bc_compare (*num, _zero_);
-  if (cmp_res < 0)
-    return 0;       /* error */
-  else
-    {
-      if (cmp_res == 0)
-    {
-      free_num (num);
-      *num = copy_num (_zero_);
-      return 1;
-    }
-    }
-  cmp_res = bc_compare (*num, _one_);
-  if (cmp_res == 0)
-    {
-      free_num (num);
-      *num = copy_num (_one_);
-      return 1;
-    }
+    int rscale, cmp_res, done;
+    int cscale;
+    bc_num guess, guess1, point5;
+
+    /* Initial checks. */
+    cmp_res = bc_compare (*num, _zero_);
+    if (cmp_res < 0)
+        return 0;       /* error */
+    else
+        {
+            if (cmp_res == 0)
+                {
+                    free_num (num);
+                    *num = copy_num (_zero_);
+                    return 1;
+                }
+        }
+    cmp_res = bc_compare (*num, _one_);
+    if (cmp_res == 0)
+        {
+            free_num (num);
+            *num = copy_num (_one_);
+            return 1;
+        }

-  /* Initialize the variables. */
-  rscale = MAX (scale, (*num)->n_scale);
-  cscale = rscale + 2;
-  init_num (&guess);
-  init_num (&guess1);
-  point5 = new_num (1,1);
-  point5->n_value[1] = 5;
+    /* Initialize the variables. */
+    rscale = MAX (scale, (*num)->n_scale);
+    cscale = rscale + 2;
+    init_num (&guess);
+    init_num (&guess1);
+    point5 = new_num (1,1);
+    point5->n_value[1] = 5;


-  /* Calculate the initial guess. */
-  if (cmp_res < 0)
-    /* The number is between 0 and 1.  Guess should start at 1. */
-    guess = copy_num (_one_);
-  else
-    {
-      /* The number is greater than 1.  Guess should start at 10^(exp/2). */
-      int2num (&guess,10);
-      int2num (&guess1,(*num)->n_len);
-      bc_multiply (guess1, point5, &guess1, rscale);
-      guess1->n_scale = 0;
-      bc_raise (guess, guess1, &guess, rscale);
-      free_num (&guess1);
-    }
+    /* Calculate the initial guess. */
+    if (cmp_res < 0)
+        /* The number is between 0 and 1.  Guess should start at 1. */
+        guess = copy_num (_one_);
+    else
+        {
+            /* The number is greater than 1.  Guess should start at 10^(exp/2). */
+            int2num (&guess,10);
+            int2num (&guess1,(*num)->n_len);
+            bc_multiply (guess1, point5, &guess1, rscale);
+            guess1->n_scale = 0;
+            bc_raise (guess, guess1, &guess, rscale);
+            free_num (&guess1);
+        }

-  /* Find the square root using Newton's algorithm. */
-  done = FALSE;
-  while (!done)
-    {
-      free_num (&guess1);
-      guess1 = copy_num (guess);
-      bc_divide (*num,guess,&guess,cscale);
-      bc_add (guess,guess1,&guess);
-      bc_multiply (guess,point5,&guess,cscale);
-      cmp_res = _do_compare (guess,guess1,FALSE,TRUE);
-      if (cmp_res == 0) done = TRUE;
-    }
+    /* Find the square root using Newton's algorithm. */
+    done = FALSE;
+    while (!done)
+        {
+            free_num (&guess1);
+            guess1 = copy_num (guess);
+            bc_divide (*num,guess,&guess,cscale);
+            bc_add (guess,guess1,&guess);
+            bc_multiply (guess,point5,&guess,cscale);
+            cmp_res = _do_compare (guess,guess1,FALSE,TRUE);
+            if (cmp_res == 0) done = TRUE;
+        }

-  /* Assign the number and clean up. */
-  free_num (num);
-  bc_divide (guess,_one_,num,rscale);
-  free_num (&guess);
-  free_num (&guess1);
-  free_num (&point5);
-  return 1;
+    /* Assign the number and clean up. */
+    free_num (num);
+    bc_divide (guess,_one_,num,rscale);
+    free_num (&guess);
+    free_num (&guess1);
+    free_num (&point5);
+    return 1;
 }


@@ -1135,19 +1138,19 @@ out_long (val, size, space, out_char)
      void (*out_char)();
 #endif
 {
-  char digits[40];
-  int len, ix;
-
-  if (space) (*out_char) (' ');
-  sprintf (digits, "%ld", val);
-  len = strlen (digits);
-  while (size > len)
-    {
-      (*out_char) ('0');
-      size--;
-    }
-  for (ix=0; ix < len; ix++)
-    (*out_char) (digits[ix]);
+    char digits[40];
+    int len, ix;
+
+    if (space) (*out_char) (' ');
+    sprintf (digits, "%ld", val);
+    len =(int) strlen (digits);
+    while (size > len)
+        {
+            (*out_char) ('0');
+            size--;
+        }
+    for (ix=0; ix < len; ix++)
+        (*out_char) (digits[ix]);
 }

 /* Output of a bcd number.  NUM is written in base O_BASE using OUT_CHAR
@@ -1163,103 +1166,103 @@ out_num (num, o_base, out_char)
      void (*out_char)();
 #endif
 {
-  char *nptr;
-  int  idx, fdigit, pre_space;
-  stk_rec *digits, *temp;
-  bc_num int_part, frac_part, base, cur_dig, t_num;
-
-  /* The negative sign if needed. */
-  if (num->n_sign == MINUS) (*out_char) ('-');
-
-  /* Output the number. */
-  if (is_zero (num))
-    (*out_char) ('0');
-  else
-    if (o_base == 10)
-      {
-    /* The number is in base 10, do it the fast way. */
-    nptr = num->n_value;
-    if (num->n_len > 1 || *nptr != 0)
-      for (idx=num->n_len; idx>0; idx--)
-        (*out_char) (BCD_CHAR(*nptr++));
+    char *nptr;
+    int  idx, fdigit, pre_space;
+    stk_rec *digits, *temp;
+    bc_num int_part, frac_part, base, cur_dig, t_num;
+
+    /* The negative sign if needed. */
+    if (num->n_sign == MINUS) (*out_char) ('-');
+
+    /* Output the number. */
+    if (is_zero (num))
+        (*out_char) ('0');
     else
-      nptr++;
+        if (o_base == 10)
+            {
+                /* The number is in base 10, do it the fast way. */
+                nptr = num->n_value;
+                if (num->n_len > 1 || *nptr != 0)
+                    for (idx=num->n_len; idx>0; idx--)
+                        (*out_char) (BCD_CHAR(*nptr++));
+                else
+                    nptr++;

-    /* Now the fraction. */
-    if (num->n_scale > 0)
-      {
-        (*out_char) ('.');
-        for (idx=0; idx<num->n_scale; idx++)
-          (*out_char) (BCD_CHAR(*nptr++));
-      }
-      }
-    else
-      {
-    /* The number is some other base. */
-    digits = NULL;
-    init_num (&int_part);
-    bc_divide (num, _one_, &int_part, 0);
-    init_num (&frac_part);
-    init_num (&cur_dig);
-    init_num (&base);
-    bc_sub (num, int_part, &frac_part);
-    int2num (&base, o_base);
-
-    /* Get the digits of the integer part and push them on a stack. */
-    while (!is_zero (int_part))
-      {
-        bc_modulo (int_part, base, &cur_dig, 0);
-        temp = (stk_rec *) malloc (sizeof(stk_rec));
-        if (temp == NULL) out_of_memory();
-        temp->digit = num2long (cur_dig);
-        temp->next = digits;
-        digits = temp;
-        bc_divide (int_part, base, &int_part, 0);
-      }
-
-    /* Print the digits on the stack. */
-    if (digits != NULL)
-      {
-        /* Output the digits. */
-        while (digits != NULL)
-          {
-        temp = digits;
-        digits = digits->next;
-        if (o_base <= 16)
-          (*out_char) (ref_str[ (int) temp->digit]);
+                /* Now the fraction. */
+                if (num->n_scale > 0)
+                    {
+                        (*out_char) ('.');
+                        for (idx=0; idx<num->n_scale; idx++)
+                            (*out_char) (BCD_CHAR(*nptr++));
+                    }
+            }
         else
-          out_long (temp->digit, base->n_len, 1, out_char);
-        free (temp);
-          }
-      }
-
-    /* Get and print the digits of the fraction part. */
-    if (num->n_scale > 0)
-      {
-        (*out_char) ('.');
-        pre_space = 0;
-        t_num = copy_num (_one_);
-        while (t_num->n_len <= num->n_scale) {
-          bc_multiply (frac_part, base, &frac_part, num->n_scale);
-          fdigit = num2long (frac_part);
-          int2num (&int_part, fdigit);
-          bc_sub (frac_part, int_part, &frac_part);
-          if (o_base <= 16)
-        (*out_char) (ref_str[fdigit]);
-          else {
-        out_long (fdigit, base->n_len, pre_space, out_char);
-        pre_space = 1;
-          }
-          bc_multiply (t_num, base, &t_num, 0);
-        }
-      }
+            {
+                /* The number is some other base. */
+                digits = NULL;
+                init_num (&int_part);
+                bc_divide (num, _one_, &int_part, 0);
+                init_num (&frac_part);
+                init_num (&cur_dig);
+                init_num (&base);
+                bc_sub (num, int_part, &frac_part);
+                int2num (&base, o_base);
+
+                /* Get the digits of the integer part and push them on a stack. */
+                while (!is_zero (int_part))
+                    {
+                        bc_modulo (int_part, base, &cur_dig, 0);
+                        temp = (stk_rec *) malloc (sizeof(stk_rec));
+                        if (temp == NULL) out_of_memory();
+                        temp->digit = num2long (cur_dig);
+                        temp->next = digits;
+                        digits = temp;
+                        bc_divide (int_part, base, &int_part, 0);
+                    }
+
+                /* Print the digits on the stack. */
+                if (digits != NULL)
+                    {
+                        /* Output the digits. */
+                        while (digits != NULL)
+                            {
+                                temp = digits;
+                                digits = digits->next;
+                                if (o_base <= 16)
+                                    (*out_char) (ref_str[ (int) temp->digit]);
+                                else
+                                    out_long (temp->digit, base->n_len, 1, out_char);
+                                free (temp);
+                            }
+                    }
+
+                /* Get and print the digits of the fraction part. */
+                if (num->n_scale > 0)
+                    {
+                        (*out_char) ('.');
+                        pre_space = 0;
+                        t_num = copy_num (_one_);
+                        while (t_num->n_len <= num->n_scale) {
+                            bc_multiply (frac_part, base, &frac_part, num->n_scale);
+                            fdigit = (int)num2long (frac_part);
+                            int2num (&int_part, fdigit);
+                            bc_sub (frac_part, int_part, &frac_part);
+                            if (o_base <= 16)
+                                (*out_char) (ref_str[fdigit]);
+                            else {
+                                out_long (fdigit, base->n_len, pre_space, out_char);
+                                pre_space = 1;
+                            }
+                            bc_multiply (t_num, base, &t_num, 0);
+                        }
+                    }

-    /* Clean up. */
-    free_num (&int_part);
-    free_num (&frac_part);
-    free_num (&base);
-    free_num (&cur_dig);
-      }
+                /* Clean up. */
+                free_num (&int_part);
+                free_num (&frac_part);
+                free_num (&base);
+                free_num (&cur_dig);
+            }
 }

 #ifdef DEBUG
@@ -1275,8 +1278,8 @@ void
 p_n (num)
      bc_num num;
 {
-  out_num (num, 10, out_char);
-  return 0;
+    out_num (num, 10, out_char);
+    return 0;
 }
 #endif
 #endif
@@ -1288,10 +1291,10 @@ p_v (name, num, len)
      unsigned char *num;
      int len;
 {
-  int i;
-  printf ("%s=", name);
-  for (i=0; i<len; i++) printf ("%c",BCD_CHAR(num[i]));
-  printf ("\n");
+    int i;
+    printf ("%s=", name);
+    for (i=0; i<len; i++) printf ("%c",BCD_CHAR(num[i]));
+    printf ("\n");
 }


@@ -1303,108 +1306,108 @@ str2num (num, str, scale)
      char *str;
      int scale;
 {
-  int digits, strscale;
-  char *ptr, *nptr;
-  char zero_int;
-
-  /* Prepare num. */
-  free_num (num);
-
-  /* Check for valid number and count digits. */
-  ptr = str;
-  digits = 0;
-  strscale = 0;
-  zero_int = FALSE;
-  if ( (*ptr == '+') || (*ptr == '-'))  ptr++;  /* Sign */
-  while (*ptr == '0') ptr++;            /* Skip leading zeros. */
-  while (isdigit(*ptr)) ptr++, digits++;    /* digits */
-  if (*ptr == '.') ptr++;           /* decimal point */
-  while (isdigit(*ptr)) ptr++, strscale++;  /* digits */
-  if ((*ptr != '\0') || (digits+strscale == 0))
-    {
-      *num = copy_num (_zero_);
-      return;
-    }
+    int digits, strscale;
+    char *ptr, *nptr;
+    char zero_int;
+
+    /* Prepare num. */
+    free_num (num);
+
+    /* Check for valid number and count digits. */
+    ptr = str;
+    digits = 0;
+    strscale = 0;
+    zero_int = FALSE;
+    if ( (*ptr == '+') || (*ptr == '-'))  ptr++;  /* Sign */
+    while (*ptr == '0') ptr++;            /* Skip leading zeros. */
+    while (isdigit(*ptr)) ptr++, digits++;    /* digits */
+    if (*ptr == '.') ptr++;           /* decimal point */
+    while (isdigit(*ptr)) ptr++, strscale++;  /* digits */
+    if ((*ptr != '\0') || (digits+strscale == 0))
+        {
+            *num = copy_num (_zero_);
+            return;
+        }

-  /* Adjust numbers and allocate storage and initialize fields. */
-  strscale = MIN(strscale, scale);
-  if (digits == 0)
-    {
-      zero_int = TRUE;
-      digits = 1;
-    }
-  *num = new_num (digits, strscale);
-
-  /* Build the whole number. */
-  ptr = str;
-  if (*ptr == '-')
-    {
-      (*num)->n_sign = MINUS;
-      ptr++;
-    }
-  else
-    {
-      (*num)->n_sign = PLUS;
-      if (*ptr == '+') ptr++;
-    }
-  while (*ptr == '0') ptr++;            /* Skip leading zeros. */
-  nptr = (*num)->n_value;
-  if (zero_int)
-    {
-      *nptr++ = 0;
-      digits = 0;
-    }
-  for (;digits > 0; digits--)
-    *nptr++ = CH_VAL(*ptr++);
+    /* Adjust numbers and allocate storage and initialize fields. */
+    strscale = MIN(strscale, scale);
+    if (digits == 0)
+        {
+            zero_int = TRUE;
+            digits = 1;
+        }
+    *num = new_num (digits, strscale);
+
+    /* Build the whole number. */
+    ptr = str;
+    if (*ptr == '-')
+        {
+            (*num)->n_sign = MINUS;
+            ptr++;
+        }
+    else
+        {
+            (*num)->n_sign = PLUS;
+            if (*ptr == '+') ptr++;
+        }
+    while (*ptr == '0') ptr++;            /* Skip leading zeros. */
+    nptr = (*num)->n_value;
+    if (zero_int)
+        {
+            *nptr++ = 0;
+            digits = 0;
+        }
+    for (;digits > 0; digits--)
+        *nptr++ = CH_VAL(*ptr++);


-  /* Build the fractional part. */
-  if (strscale > 0)
-    {
-      ptr++;  /* skip the decimal point! */
-      for (;strscale > 0; strscale--)
-    *nptr++ = CH_VAL(*ptr++);
-    }
+    /* Build the fractional part. */
+    if (strscale > 0)
+        {
+            ptr++;  /* skip the decimal point! */
+            for (;strscale > 0; strscale--)
+                *nptr++ = CH_VAL(*ptr++);
+        }
 }

 /* Convert a numbers to a string.  Base 10 only.*/

 char
 *num2str (num)
-      bc_num num;
+     bc_num num;
 {
-  char *str, *sptr;
-  char *nptr;
-  int  idx, signch;
-
-  /* Allocate the string memory. */
-  signch = ( num->n_sign == PLUS ? 0 : 1 );  /* Number of sign chars. */
-  if (num->n_scale > 0)
-    str = (char *) malloc (num->n_len + num->n_scale + 2 + signch);
-  else
-    str = (char *) malloc (num->n_len + 1 + signch);
-  if (str == NULL) out_of_memory();
-
-  /* The negative sign if needed. */
-  sptr = str;
-  if (signch) *sptr++ = '-';
-
-  /* Load the whole number. */
-  nptr = num->n_value;
-  for (idx=num->n_len; idx>0; idx--)
-    *sptr++ = BCD_CHAR(*nptr++);
-
-  /* Now the fraction. */
-  if (num->n_scale > 0)
-    {
-      *sptr++ = '.';
-      for (idx=0; idx<num->n_scale; idx++)
-    *sptr++ = BCD_CHAR(*nptr++);
-    }
+    char *str, *sptr;
+    char *nptr;
+    int  idx, signch;
+
+    /* Allocate the string memory. */
+    signch = ( num->n_sign == PLUS ? 0 : 1 );  /* Number of sign chars. */
+    if (num->n_scale > 0)
+        str = (char *) malloc (num->n_len + num->n_scale + 2 + signch);
+    else
+        str = (char *) malloc (num->n_len + 1 + signch);
+    if (str == NULL) out_of_memory();
+
+    /* The negative sign if needed. */
+    sptr = str;
+    if (signch) *sptr++ = '-';
+
+    /* Load the whole number. */
+    nptr = num->n_value;
+    for (idx=num->n_len; idx>0; idx--)
+        *sptr++ = BCD_CHAR(*nptr++);
+
+    /* Now the fraction. */
+    if (num->n_scale > 0)
+        {
+            *sptr++ = '.';
+            for (idx=0; idx<num->n_scale; idx++)
+                *sptr++ = BCD_CHAR(*nptr++);
+        }

-  /* Terminate the string and return it! */
-  *sptr = '\0';
-  return (str);
+    /* Terminate the string and return it! */
+    *sptr = '\0';
+    return (str);
 }
 #endif
ViewGit